MCPcopy
hub / github.com/hpcaitech/ColossalAI / __call__

Method __call__

colossalai/fx/proxy.py:113–127  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

111 return self._node
112
113 def __call__(self, *args, **kwargs):
114 proxy = self.tracer.create_proxy("call_method", self.attr, (self.root,) + args, kwargs)
115 if not isinstance(proxy, ColoProxy):
116 meta_args, meta_kwargs = extract_meta(*((self.root,) + args), **kwargs)
117 method = getattr(meta_args[0].__class__, self.attr)
118 if meta_patched_function.has(method):
119 meta_target = meta_patched_function.get(method)
120 elif meta_patched_function.has(method.__name__):
121 meta_target = meta_patched_function.get(method.__name__)
122 else:
123 meta_target = method
124 meta_out = meta_target(*meta_args, **meta_kwargs)
125 proxy = ColoProxy(proxy.node)
126 proxy.meta_data = meta_out
127 return proxy

Callers

nothing calls this directly

Calls 5

extract_metaFunction · 0.70
ColoProxyClass · 0.70
create_proxyMethod · 0.45
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected