MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / __torch_function__

Method __torch_function__

lit_gpt/utils_old.py:156–161  ·  view source on GitHub ↗
(cls, func, types, args=(), kwargs=None)

Source from the content-addressed store, hash-verified

154
155 @classmethod
156 def __torch_function__(cls, func, types, args=(), kwargs=None):
157 if kwargs is None:
158 kwargs = {}
159 loaded_args = [(a._load_tensor() if isinstance(a, NotYetLoadedTensor) else a) for a in args]
160 return func(*loaded_args, **kwargs)
161 # gc.collect would be costly here, maybe do it optionally
162
163 def __getattr__(self, name):
164 # properties

Callers

nothing calls this directly

Calls 1

_load_tensorMethod · 0.80

Tested by

no test coverage detected