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

Function wrapper

imperative/python/megengine/xla/utils.py:70–81  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

68
69def use_cpp_class(cpp_cls):
70 def wrapper(cls):
71 exclude_methods = {"__module__", "__dict__", "__doc__"}
72
73 for attr_name, attr in cls.__dict__.items():
74 if attr_name not in exclude_methods and not hasattr(
75 _unwrap_func(attr), "_use_cpp"
76 ):
77 setattr(cpp_cls, attr_name, attr)
78
79 cpp_cls.__doc__ = cls.__doc__
80
81 return cpp_cls
82
83 return wrapper
84

Callers 1

_wrapMethod · 0.50

Calls 2

_unwrap_funcFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected