MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / linespace_loader

Function linespace_loader

imperative/python/megengine/traced_module/compat.py:276–290  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

274
275@register_functional_loader(("megengine.functional.tensor", "linspace"))
276def linespace_loader(expr):
277 args, kwargs = expr.args, expr.kwargs
278 if not hasattr(expr, "version"):
279
280 def orig_linspace_signature(start, stop, num, dtype="float32", device=None):
281 pass
282
283 args, kwargs = _convert_kwargs_to_args(
284 orig_linspace_signature, expr.args, expr.kwargs
285 )
286 expr.set_args_kwargs(*args, **kwargs)
287 if len(args) == 5:
288 new_args = args[0:-2]
289 new_kwargs = {"dtype": args[-2], "device": args[-1]}
290 expr.set_args_kwargs(*new_args, **new_kwargs)
291
292
293@register_functional_loader(("megengine.functional.tensor", "full"))

Callers

nothing calls this directly

Calls 2

_convert_kwargs_to_argsFunction · 0.85
set_args_kwargsMethod · 0.80

Tested by

no test coverage detected