mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30242 Pull Request resolved: https://github.com/pytorch/pytorch/pull/29501 Currently blocked on schema serialization issue Test Plan: Imported from OSS Differential Revision: D18463063 Pulled By: jamesr66a fbshipit-source-id: c12a1b644eb9bf04e68ff93cccf91d6cb3e75359
16 lines
409 B
Python
16 lines
409 B
Python
import types
|
|
import torch._C
|
|
|
|
class _Classes(types.ModuleType):
|
|
def __init__(self):
|
|
super(_Classes, self).__init__('torch.classes')
|
|
|
|
def __getattr__(self, attr):
|
|
proxy = torch._C._get_custom_class_python_wrapper(attr)
|
|
if proxy is None:
|
|
raise RuntimeError('Class {} not registered!'.format(attr))
|
|
return proxy
|
|
|
|
# The classes "namespace"
|
|
classes = _Classes()
|