MCPcopy Create free account
hub / github.com/pytorch/executorch / __new__

Method __new__

exir/tracer.py:245–254  ·  view source on GitHub ↗
(
        cls, elem: torch.Tensor, proxy: torch.fx.Proxy, is_immutable: bool = False
    )

Source from the content-addressed store, hash-verified

243
244 @staticmethod
245 def __new__(
246 cls, elem: torch.Tensor, proxy: torch.fx.Proxy, is_immutable: bool = False
247 ) -> torch.Tensor:
248 # assert not elem.requires_grad or not torch.is_grad_enabled()
249
250 r = torch.Tensor._make_subclass(cls, elem, elem.requires_grad)
251 assert isinstance(r, PythonTensor)
252 r.is_immutable: bool = is_immutable
253 r.update_proxy(proxy)
254 return r
255
256 def update_proxy(self, proxy: torch.fx.Proxy) -> None:
257 self.proxy = proxy

Calls 1

update_proxyMethod · 0.80