for numpy Interoperability, so that we can compute ``np.sum(MetaTensor([1.0]))``.
(self, func, types, args, kwargs)
| 311 | return x |
| 312 | |
| 313 | def __array_function__(self, func, types, args, kwargs): |
| 314 | """for numpy Interoperability, so that we can compute ``np.sum(MetaTensor([1.0]))``.""" |
| 315 | try: |
| 316 | if not func.__module__.startswith("numpy"): |
| 317 | return NotImplemented |
| 318 | except AttributeError: |
| 319 | return NotImplemented |
| 320 | _args = list(map(MetaTensor._convert, args)) |
| 321 | _kwargs = {k: MetaTensor._convert(v) for k, v in kwargs.items()} |
| 322 | return func(*_args, **_kwargs) |
| 323 | |
| 324 | def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): |
| 325 | """ |