1 #include <torch/csrc/autograd/generated/python_functions.h>
2
3 // ${generated_comment}
4
5 #include <Python.h>
6 #include <ATen/ATen.h>
7
8 #include <c10/core/SymNodeImpl.h>
9 #include "torch/csrc/autograd/generated/Functions.h"
10 #include "torch/csrc/autograd/python_cpp_function.h"
11 #include <torch/csrc/autograd/python_variable.h>
12 #include <torch/csrc/autograd/saved_variable.h>
13 #include <torch/csrc/utils/pybind.h>
14 #include <pybind11/pybind11.h>
15 #include <torch/csrc/utils/pybind.h>
16
17 // NOTE: See [Sharded File] comment in VariableType
18
19 namespace torch::autograd::generated {
20
21 template<typename C>
addClass(PyObject * module,PyTypeObject & type,const char * name,PyGetSetDef * function_properties=NULL,PyMethodDef * function_methods=NULL)22 static void addClass(PyObject* module, PyTypeObject& type, const char* name,
23 PyGetSetDef* function_properties=NULL, PyMethodDef* function_methods=NULL)
24 {
25 _initFunctionPyTypeObject(type, name, function_properties, function_methods);
26 Py_INCREF(&type);
27 PyModule_AddObject(module, name, (PyObject*)&type);
28 registerCppFunction(typeid(C), &type);
29 }
30
31 ${py_function_props_and_getters}
32
33 void initialize_autogenerated_functions${shard_id}(PyObject* module) {
34 ${py_function_initializers}
35 }
36
37 } // namespace torch::autograd::generated
38