mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
that lambda is required
This commit is contained in:
@@ -349,7 +349,7 @@ for device in [device for device in Device.__dict__.keys() if device[0] != "_"]:
|
||||
|
||||
# register all the mlops "math" operations
|
||||
def register(name:str, fxn:Function):
|
||||
setattr(Tensor, "_"+name if hasattr(Tensor, name) else name, lambda *args, **kwargs: fxn.apply(*args, **kwargs))
|
||||
setattr(Tensor, "_"+name if hasattr(Tensor, name) else name, lambda *args, **kwargs: fxn.apply(*args, **kwargs)) # doesn't work without lambda, pylint: disable=W0108
|
||||
for name, cls in inspect.getmembers(importlib.import_module('tinygrad.mlops'), inspect.isclass):
|
||||
if name[0] != "_" and name != "Function" and not name.endswith("Ops"):
|
||||
register(name.lower(), cls)
|
||||
|
||||
Reference in New Issue
Block a user