Gurkenglas
Gurkenglas
Yes, that's what I'm proposing! That your syntax is `lens.Recur(Foo).GetAttr("id").F((str)).collect()(arg)` can be read as a hint that the `lens.Recur(Foo).GetAttr("id").F((str)).collect()` part can be precomputed, and that function values don't come with...
``` code = """ def f(x): y = x+2 print(5) 1/0 return y*x """ with open("/tmp/codef.py", "w") as f: f.write(code) co = compile(code, "/tmp/codef.py", "exec") exec(co) f(2) ``` produces this...
See it as just-in-time compilation! Have you ever written code such that you couldn't cache the compiled version per calling code location with length_of_tmp_code in O(length_of_calling_code)?
Completely untested: ``` def nameTensors(): # All tensors defined from here on out will carry a name around in their grad_fn. oldinit = torch.Tensor.__init__ def newinit(self, *args, **kwargs): self.oldinit(*args, **kwargs)...
Hmm. How about something like this, then? Even more untested, if that's even possible. ``` def nameTensors(module): # Wraps module (presumably torch) to have every function name every returned unnamed...