René's URL Explorer Experiment


Title: Custom Classes — PyTorch main documentation

Description: Custom classes in PyTorch C++ — registering C++ classes for use in TorchScript and Python.

Keywords:

direct link

Domain: docs.pytorch.org


Hey, it has json ld scripts:
    {
       "@context": "https://schema.org",
       "@type": "Article",
       "name": "Custom Classes",
       "headline": "Custom Classes",
       "description": "Custom classes in PyTorch C++ \u2014 registering C++ classes for use in TorchScript and Python.",
       "url": "/api/library/custom_classes.html",
       "articleBody": "Custom Classes# PyTorch allows registering custom C++ classes that can be used from Python and TorchScript. Header: torch/custom_class.h class_ Template# template\u003cclass CurClass\u003eclass class_ : public torch::detail::class_base# Entry point for custom C++ class registration. To register a C++ class in PyTorch, instantiate torch::class_ with the desired class as the template parameter. Typically, this instantiation should be done in the initialization of a global variable, so that the class will be made available on dynamic library loading without any additional API calls needed. For example, to register a class named Foo, you might create a global variable like so: static auto register_foo = torch::class_\u003cFoo\u003e(\"myclasses\", \"Foo\") .def(\"myMethod\", \u0026Foo::myMethod) .def(\"lambdaMethod\", [](const c10::intrusive_ptr\u003cFoo\u003e\u0026 self) { // Do something with `self` }); In addition to registering the class, this registration also chains def() calls to register methods. myMethod() is registered with a pointer to the Foo class\u2019s myMethod() method. lambdaMethod() is registered with a C++ lambda expression. Public Functions inline explicit class_(const std::string \u0026namespaceName, const std::string \u0026className, std::string doc_string = \"\")# This constructor actually registers the class type. String argument namespaceName is an identifier for the namespace you would like this class to appear in. String argument className is the name you would like to see this class exposed as in Python and TorchScript. For example, if you pass foo as the namespace name and Bar as the className, the class will appear as torch.classes.foo.Bar in Python and TorchScript template\u003ctypename ...Types\u003einline class_ \u0026def(torch::detail::types\u003cvoid, Types...\u003e, std::string doc_string = \"\", std::initializer_list\u003carg\u003e default_args = {})# def() can be used in conjunction with torch::init() to register a constructor for a given C++ class type. For example, passing torch::init\u003cint, std::string\u003e() would register a two-argument constructor taking an int and a std::string as argument. template\u003ctypename Func, typename ...ParameterTypes\u003einline class_ \u0026def(InitLambda\u003cFunc, c10::guts::typelist::typelist\u003cParameterTypes...\u003e\u003e init, std::string doc_string = \"\", std::initializer_list\u003carg\u003e default_args = {})# template\u003ctypename Func\u003einline class_ \u0026def(std::string name, Func f, std::string doc_string = \"\", std::initializer_list\u003carg\u003e default_args = {})# This is the normal method registration API. name is the name that the method will be made accessible by in Python and TorchScript. f is a callable object that defines the method. Typically f will either be a pointer to a method on CurClass, or a lambda expression that takes a c10::intrusive_ptr\u003cCurClass\u003e as the first argument (emulating a this argument in a C++ method.) Examples: // Exposes method `foo` on C++ class `Foo` as `call_foo()` in // Python and TorchScript .def(\"call_foo\", \u0026Foo::foo) // Exposes the given lambda expression as method `call_lambda()` // in Python and TorchScript. .def(\"call_lambda\", [](const c10::intrusive_ptr\u003cFoo\u003e\u0026 self) { // do something }) template\u003ctypename Func\u003einline class_ \u0026def_static(std::string name, Func func, std::string doc_string = \"\", std::initializer_list\u003carg\u003e default_args = {})# Method registration API for static methods. template\u003ctypename GetterFunc, typename SetterFunc\u003einline class_ \u0026def_property(const std::string \u0026name, GetterFunc getter_func, SetterFunc setter_func, std::string doc_string = \"\")# Property registration API for properties with both getter and setter functions. template\u003ctypename GetterFunc\u003einline class_ \u0026def_property(const std::string \u0026name, GetterFunc getter_func, std::string doc_string = \"\")# Property registration API for properties with only getter function. template\u003ctypename T\u003einline class_ \u0026def_readwrite(const std::string \u0026name, T CurClass::* field)# Property registration API for properties with read-write access. template\u003ctypename T\u003einline class_ \u0026def_readonly(const std::string \u0026name, T CurClass::* field)# Property registration API for properties with read-only access. inline class_ \u0026_def_unboxed(const std::string \u0026name, std::function\u003cvoid(jit::Stack\u0026)\u003e func, c10::FunctionSchema schema, std::string doc_string = \"\")# This is an unsafe method registration API added for adding custom JIT backend support via custom C++ classes. It is not for general purpose use. template\u003ctypename GetStateFn, typename SetStateFn\u003einline class_ \u0026def_pickle(GetStateFn \u0026\u0026get_state, SetStateFn \u0026\u0026set_state)# def_pickle() is used to define exactly what state gets serialized or deserialized for a given instance of a custom C++ class in Python or TorchScript. This protocol is equivalent to the Pickle concept of __getstate__ and __setstate__ from Python (https://docs.python.org/2/library/pickle.html#object.__getstate__) Currently, both the get_state and set_state callables must be C++ lambda expressions. They should have the following signatures, where CurClass is the class you\u2019re registering and T1 is some object that encapsulates the state of the object. __getstate__(intrusive_ptr\u003cCurClass\u003e) -\u003e T1 __setstate__(T2) -\u003e intrusive_ptr\u003cCurClass\u003e T1 must be an object that is convertible to IValue by the same rules for custom op/method registration. For the common case, T1 == T2. T1 can also be a subtype of T2. An example where it makes sense for T1 and T2 to differ is if setstate handles legacy formats in a backwards compatible way. Example: .def_pickle( // __getstate__ [](const c10::intrusive_ptr\u003cMyStackClass\u003cstd::string\u003e\u003e\u0026 self) { return self-\u003estack_; }, [](std::vector\u003cstd::string\u003e state) { // __setstate__ return c10::make_intrusive\u003cMyStackClass\u003cstd::string\u003e\u003e( std::vector\u003cstd::string\u003e{\"i\", \"was\", \"deserialized\"}); }) Example: #include \u003ctorch/custom_class.h\u003e struct MyClass : torch::CustomClassHolder { int value; MyClass(int v) : value(v) {} int getValue() const { return value; } void setValue(int v) { value = v; } }; TORCH_LIBRARY(my_classes, m) { m.class_\u003cMyClass\u003e(\"MyClass\") .def(torch::init\u003cint\u003e()) .def(\"getValue\", \u0026MyClass::getValue) .def(\"setValue\", \u0026MyClass::setValue) .def_readwrite(\"value\", \u0026MyClass::value); } Registering Methods# Constructor: m.class_\u003cMyClass\u003e(\"MyClass\") .def(torch::init\u003cint\u003e()) // Constructor taking int Methods: m.class_\u003cMyClass\u003e(\"MyClass\") .def(\"getValue\", \u0026MyClass::getValue) .def(\"setValue\", \u0026MyClass::setValue) Properties: m.class_\u003cMyClass\u003e(\"MyClass\") .def_readwrite(\"value\", \u0026MyClass::value) // Read-write .def_readonly(\"const_value\", \u0026MyClass::const_value) // Read-only Using Custom Classes# From C++: auto my_obj = c10::make_intrusive\u003cMyClass\u003e(42); int val = my_obj-\u003egetValue(); From Python: import torch torch.classes.load_library(\"path/to/library.so\") obj = torch.classes.my_classes.MyClass(42) print(obj.getValue()) In TorchScript: @torch.jit.script def use_my_class(x: torch.classes.my_classes.MyClass) -\u003e int: return x.getValue()",
       "author": {
         "@type": "Organization",
         "name": "PyTorch Contributors",
         "url": "https://pytorch.org"
       },
       "image": "https://pytorch.org/docs/stable/_static/img/pytorch_seo.png",
       "mainEntityOfPage": {
         "@type": "WebPage",
         "@id": "/api/library/custom_classes.html"
       },
       "datePublished": "2023-01-01T00:00:00Z",
       "dateModified": "2023-01-01T00:00:00Z"
     }
 

docsearch:languageen
llm:site-typedocumentation
llm:frameworkPyTorch
llm:descriptionCustom classes in PyTorch C++ — registering C++ classes for use in TorchScript and Python.
llm:navigation-filehttps://pytorch.org/docs/stable/llms.txt
llm:sitemaphttps://pytorch.org/docs/stable/sitemap.xml
llm:versionmain
llm:projectPyTorch
llm:page-typedocumentation
og:imagehttps://docs.pytorch.org/docs/stable/_static/img/pytorch_seo.png
None3

Links:

Skip to main contenthttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#main-content
Home https://docs.pytorch.org/cppdocs/index.html
mainhttps://docs.pytorch.org/cppdocs/index.html
Installing C++ Distributions of PyTorch https://docs.pytorch.org/cppdocs/installing.html
The C++ Frontend https://docs.pytorch.org/cppdocs/frontend.html
C++ API Reference https://docs.pytorch.org/cppdocs/api/index.html
ATen: Tensor Library https://docs.pytorch.org/cppdocs/api/aten/index.html
C10: Core Utilities https://docs.pytorch.org/cppdocs/api/c10/index.html
Autograd: Automatic Differentiation https://docs.pytorch.org/cppdocs/api/autograd/index.html
CUDA Support https://docs.pytorch.org/cppdocs/api/cuda/index.html
XPU Support https://docs.pytorch.org/cppdocs/api/xpu/index.html
Neural Network Modules (torch::nn) https://docs.pytorch.org/cppdocs/api/nn/index.html
Optimizers (torch::optim) https://docs.pytorch.org/cppdocs/api/optim/index.html
Data Loading (torch::data) https://docs.pytorch.org/cppdocs/api/data/index.html
Serialization (torch::serialize) https://docs.pytorch.org/cppdocs/api/serialize/index.html
Torch Library API https://docs.pytorch.org/cppdocs/api/library/index.html
Torch Stable API https://docs.pytorch.org/cppdocs/api/stable/index.html
FAQ https://docs.pytorch.org/cppdocs/faq.html
Go to pytorch.org https://pytorch.org
Xhttps://x.com/PyTorch
GitHubhttps://github.com/pytorch/pytorch
PyTorch Forumhttps://discuss.pytorch.org/
PyPihttps://pypi.org/project/torch/
mainhttps://docs.pytorch.org/cppdocs/index.html
Installing C++ Distributions of PyTorch https://docs.pytorch.org/cppdocs/installing.html
The C++ Frontend https://docs.pytorch.org/cppdocs/frontend.html
C++ API Reference https://docs.pytorch.org/cppdocs/api/index.html
ATen: Tensor Library https://docs.pytorch.org/cppdocs/api/aten/index.html
C10: Core Utilities https://docs.pytorch.org/cppdocs/api/c10/index.html
Autograd: Automatic Differentiation https://docs.pytorch.org/cppdocs/api/autograd/index.html
CUDA Support https://docs.pytorch.org/cppdocs/api/cuda/index.html
XPU Support https://docs.pytorch.org/cppdocs/api/xpu/index.html
Neural Network Modules (torch::nn) https://docs.pytorch.org/cppdocs/api/nn/index.html
Optimizers (torch::optim) https://docs.pytorch.org/cppdocs/api/optim/index.html
Data Loading (torch::data) https://docs.pytorch.org/cppdocs/api/data/index.html
Serialization (torch::serialize) https://docs.pytorch.org/cppdocs/api/serialize/index.html
Torch Library API https://docs.pytorch.org/cppdocs/api/library/index.html
Torch Stable API https://docs.pytorch.org/cppdocs/api/stable/index.html
FAQ https://docs.pytorch.org/cppdocs/faq.html
Go to pytorch.org https://pytorch.org
Xhttps://x.com/PyTorch
GitHubhttps://github.com/pytorch/pytorch
PyTorch Forumhttps://discuss.pytorch.org/
PyPihttps://pypi.org/project/torch/
ATen: Tensor Libraryhttps://docs.pytorch.org/cppdocs/api/aten/index.html
Tensor Classhttps://docs.pytorch.org/cppdocs/api/aten/tensor.html
Tensor Creationhttps://docs.pytorch.org/cppdocs/api/aten/creation.html
Tensor Indexinghttps://docs.pytorch.org/cppdocs/api/aten/indexing.html
Tensor Accessorshttps://docs.pytorch.org/cppdocs/api/aten/accessors.html
C10: Core Utilitieshttps://docs.pytorch.org/cppdocs/api/c10/index.html
Device and DeviceTypehttps://docs.pytorch.org/cppdocs/api/c10/device.html
Device Guardshttps://docs.pytorch.org/cppdocs/api/c10/guards.html
Streamshttps://docs.pytorch.org/cppdocs/api/c10/streams.html
Core Typeshttps://docs.pytorch.org/cppdocs/api/c10/types.html
Utilitieshttps://docs.pytorch.org/cppdocs/api/c10/utilities.html
Autograd: Automatic Differentiationhttps://docs.pytorch.org/cppdocs/api/autograd/index.html
Gradient Computationhttps://docs.pytorch.org/cppdocs/api/autograd/gradient.html
Custom Autograd Functionshttps://docs.pytorch.org/cppdocs/api/autograd/custom_functions.html
Gradient Modeshttps://docs.pytorch.org/cppdocs/api/autograd/modes.html
CUDA Supporthttps://docs.pytorch.org/cppdocs/api/cuda/index.html
CUDA Streamshttps://docs.pytorch.org/cppdocs/api/cuda/streams.html
CUDA Guardshttps://docs.pytorch.org/cppdocs/api/cuda/guards.html
CUDA Utility Functionshttps://docs.pytorch.org/cppdocs/api/cuda/utilities.html
XPU Supporthttps://docs.pytorch.org/cppdocs/api/xpu/index.html
XPU Streamshttps://docs.pytorch.org/cppdocs/api/xpu/streams.html
XPU Utility Functionshttps://docs.pytorch.org/cppdocs/api/xpu/utilities.html
Neural Network Modules (torch::nn)https://docs.pytorch.org/cppdocs/api/nn/index.html
Containershttps://docs.pytorch.org/cppdocs/api/nn/containers.html
Convolution Layershttps://docs.pytorch.org/cppdocs/api/nn/convolution.html
Pooling Layershttps://docs.pytorch.org/cppdocs/api/nn/pooling.html
Linear Layershttps://docs.pytorch.org/cppdocs/api/nn/linear.html
Activation Functionshttps://docs.pytorch.org/cppdocs/api/nn/activation.html
Normalization Layershttps://docs.pytorch.org/cppdocs/api/nn/normalization.html
Dropout Layershttps://docs.pytorch.org/cppdocs/api/nn/dropout.html
Embedding Layershttps://docs.pytorch.org/cppdocs/api/nn/embedding.html
Recurrent Layershttps://docs.pytorch.org/cppdocs/api/nn/recurrent.html
Transformer Layershttps://docs.pytorch.org/cppdocs/api/nn/transformer.html
Loss Functionshttps://docs.pytorch.org/cppdocs/api/nn/loss.html
Functional APIhttps://docs.pytorch.org/cppdocs/api/nn/functional.html
Utilitieshttps://docs.pytorch.org/cppdocs/api/nn/utilities.html
Optimizers (torch::optim)https://docs.pytorch.org/cppdocs/api/optim/index.html
Gradient Descent Optimizershttps://docs.pytorch.org/cppdocs/api/optim/gradient_descent.html
Adaptive Learning Rate Optimizershttps://docs.pytorch.org/cppdocs/api/optim/adaptive.html
Second-Order Optimizershttps://docs.pytorch.org/cppdocs/api/optim/second_order.html
Learning Rate Schedulershttps://docs.pytorch.org/cppdocs/api/optim/schedulers.html
Data Loading (torch::data)https://docs.pytorch.org/cppdocs/api/data/index.html
Datasetshttps://docs.pytorch.org/cppdocs/api/data/datasets.html
DataLoaderhttps://docs.pytorch.org/cppdocs/api/data/dataloader.html
Samplershttps://docs.pytorch.org/cppdocs/api/data/samplers.html
Transformshttps://docs.pytorch.org/cppdocs/api/data/transforms.html
Serialization (torch::serialize)https://docs.pytorch.org/cppdocs/api/serialize/index.html
Saving and Loadinghttps://docs.pytorch.org/cppdocs/api/serialize/save_load.html
Archiveshttps://docs.pytorch.org/cppdocs/api/serialize/archives.html
Checkpointshttps://docs.pytorch.org/cppdocs/api/serialize/checkpoints.html
Torch Library APIhttps://docs.pytorch.org/cppdocs/api/library/index.html
Operator Registrationhttps://docs.pytorch.org/cppdocs/api/library/registration.html
Custom Classeshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html
Library Versioninghttps://docs.pytorch.org/cppdocs/api/library/versioning.html
Torch Stable APIhttps://docs.pytorch.org/cppdocs/api/stable/index.html
Library Registration Macroshttps://docs.pytorch.org/cppdocs/api/stable/registration.html
Stable Operatorshttps://docs.pytorch.org/cppdocs/api/stable/operators.html
Utilitieshttps://docs.pytorch.org/cppdocs/api/stable/utilities.html
https://docs.pytorch.org/cppdocs/index.html
C++ API Referencehttps://docs.pytorch.org/cppdocs/api/index.html
Torch Library APIhttps://docs.pytorch.org/cppdocs/api/library/index.html
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#custom-classes
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#class-template
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
torch::class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#PyTorchclasstorch_1_1class__
def()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#PyTorchclasstorch_1_1class___1a2256bb75d09458b68746e3cd0052c75a
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4N5torch6class_6class_ERKNSt6stringERKNSt6stringENSt6stringE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Typeshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4IDpEN5torch6class_3defER6class_N5torch6detail5typesIvDp5TypesEENSt6stringENSt16initializer_listI3argEE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4IDpEN5torch6class_3defER6class_N5torch6detail5typesIvDp5TypesEENSt6stringENSt16initializer_listI3argEE
def()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#PyTorchclasstorch_1_1class___1a2256bb75d09458b68746e3cd0052c75a
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Funchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0DpEN5torch6class_3defER6class_10InitLambdaI4FuncN3c104guts8typelist8typelistIDp14ParameterTypesEEENSt6stringENSt16initializer_listI3argEE
ParameterTypeshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0DpEN5torch6class_3defER6class_10InitLambdaI4FuncN3c104guts8typelist8typelistIDp14ParameterTypesEEENSt6stringENSt16initializer_listI3argEE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0DpEN5torch6class_3defER6class_10InitLambdaI4FuncN3c104guts8typelist8typelistIDp14ParameterTypesEEENSt6stringENSt16initializer_listI3argEE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Funchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_3defER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_3defER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Funchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_10def_staticER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_10def_staticER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
GetterFunchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFunc10SetterFuncNSt6stringE
SetterFunchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFunc10SetterFuncNSt6stringE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFunc10SetterFuncNSt6stringE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
GetterFunchttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFuncNSt6stringE
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFuncNSt6stringE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Thttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_13def_readwriteER6class_RKNSt6stringEM8CurClass1T
CurClasshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_13def_readwriteER6class_RKNSt6stringEM8CurClass1T
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
Thttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_readonlyER6class_RKNSt6stringEM8CurClass1T
CurClasshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_readonlyER6class_RKNSt6stringEM8CurClass1T
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4N5torch6class_12_def_unboxedERKNSt6stringENSt8functionIFvRN3jit5StackEEEEN3c1014FunctionSchemaENSt6stringE
class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
GetStateFnhttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_10def_pickleER6class_RR10GetStateFnRR10SetStateFn
SetStateFnhttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_10def_pickleER6class_RR10GetStateFnRR10SetStateFn
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_10def_pickleER6class_RR10GetStateFnRR10SetStateFn
def_pickle()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#PyTorchclasstorch_1_1class___1a924c2048593e53a5d371fffe07dfb166
https://docs.python.org/2/library/pickle.html#object.__getstate__https://docs.python.org/2/library/pickle.html#object.__getstate__
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#registering-methods
#https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#using-custom-classes
previous Operator Registration https://docs.pytorch.org/cppdocs/api/library/registration.html
next Library Versioning https://docs.pytorch.org/cppdocs/api/library/versioning.html
PyData Sphinx Themehttps://pydata-sphinx-theme.readthedocs.io/en/stable/index.html
previous Operator Registration https://docs.pytorch.org/cppdocs/api/library/registration.html
next Library Versioning https://docs.pytorch.org/cppdocs/api/library/versioning.html
class_ Templatehttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#class-template
torch::class_https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_E
class_()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4N5torch6class_6class_ERKNSt6stringERKNSt6stringENSt6stringE
def()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4IDpEN5torch6class_3defER6class_N5torch6detail5typesIvDp5TypesEENSt6stringENSt16initializer_listI3argEE
def()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0DpEN5torch6class_3defER6class_10InitLambdaI4FuncN3c104guts8typelist8typelistIDp14ParameterTypesEEENSt6stringENSt16initializer_listI3argEE
def()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_3defER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
def_static()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_10def_staticER6class_NSt6stringE4FuncNSt6stringENSt16initializer_listI3argEE
def_property()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFunc10SetterFuncNSt6stringE
def_property()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_propertyER6class_RKNSt6stringE10GetterFuncNSt6stringE
def_readwrite()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_13def_readwriteER6class_RKNSt6stringEM8CurClass1T
def_readonly()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I0EN5torch6class_12def_readonlyER6class_RKNSt6stringEM8CurClass1T
_def_unboxed()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4N5torch6class_12_def_unboxedERKNSt6stringENSt8functionIFvRN3jit5StackEEEEN3c1014FunctionSchemaENSt6stringE
def_pickle()https://docs.pytorch.org/cppdocs/api/library/custom_classes.html#_CPPv4I00EN5torch6class_10def_pickleER6class_RR10GetStateFnRR10SetStateFn
Registering Methodshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#registering-methods
Using Custom Classeshttps://docs.pytorch.org/cppdocs/api/library/custom_classes.html#using-custom-classes
Show Source https://docs.pytorch.org/cppdocs/_sources/api/library/custom_classes.md.txt
ExecuTorchhttps://docs.pytorch.org/executorch
Helionhttps://docs.pytorch.org/helion
torchaohttps://docs.pytorch.org/ao
kinetohttps://github.com/pytorch/kineto
torchtitanhttps://github.com/pytorch/torchtitan
TorchRLhttps://docs.pytorch.org/rl
torchvisionhttps://docs.pytorch.org/vision
torchaudiohttps://docs.pytorch.org/audio
tensordicthttps://docs.pytorch.org/tensordict
PyTorch on XLA Deviceshttps://docs.pytorch.org/xla
View Docshttps://docs.pytorch.org/docs/stable/index.html
View Tutorialshttps://docs.pytorch.org/tutorials
View Resourceshttps://pytorch.org/resources
Privacy Policyhttps://www.linuxfoundation.org/privacy/
https://www.facebook.com/pytorch
https://twitter.com/pytorch
https://www.youtube.com/pytorch
https://www.linkedin.com/company/pytorch
https://pytorch.slack.com
https://pytorch.org/wechat
Policieshttps://www.linuxfoundation.org/legal/policies
Trademark Usagehttps://www.linuxfoundation.org/trademark-usage
Privacy Policyhttp://www.linuxfoundation.org/privacy
Cookies Policyhttps://opensource.fb.com/legal/cookie-policy
Sphinxhttps://www.sphinx-doc.org/
PyData Sphinx Themehttps://pydata-sphinx-theme.readthedocs.io/en/stable/index.html

Viewport: width=device-width, initial-scale=1


URLs of crawlers that visited me.