MCPcopy
hub / github.com/tinygrad/tinygrad / nf

Function nf

extra/torch_backend/backend.py:678–686  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

676
677def wrap_fxn(k,f):
678 def nf(*args, **kwargs):
679 if TORCH_DEBUG:
680 print(k, len(args), [x.shape if isinstance(x, torch.Tensor) else x for x in args],
681 {k:v.shape if isinstance(v, torch.Tensor) else v for k,v in kwargs.items()})
682 args, kwargs = unwrap_args(args, kwargs)
683 out = f(*args, **kwargs)
684 if isinstance(out, Tensor): return wrap(out)
685 elif isinstance(out, tuple): return tuple(wrap(x) for x in out)
686 else: raise RuntimeError(f"unknown output type {type(out)}")
687 return nf
688
689def wrap_inplace(k,f):

Callers

nothing calls this directly

Calls 11

TensorClass · 0.90
unwrap_argsFunction · 0.85
_inplace_opFunction · 0.85
_update_torch_metadataFunction · 0.85
canonical_baseFunction · 0.85
derived_viewsFunction · 0.85
_get_view_opsFunction · 0.85
wrapFunction · 0.70
fFunction · 0.50
addMethod · 0.45
refMethod · 0.45

Tested by

no test coverage detected