mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Apply fixes to some found issues by clang-tidy in torch/csrc. Pull Request resolved: https://github.com/pytorch/pytorch/pull/108024 Approved by: https://github.com/Skylion007, https://github.com/albanD, https://github.com/malfet
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#include <torch/csrc/dynamo/init.h>
|
|
|
|
#include <torch/csrc/Exceptions.h>
|
|
#include <torch/csrc/dynamo/eval_frame.h>
|
|
#include <torch/csrc/dynamo/guards.h>
|
|
#include <torch/csrc/dynamo/python_compiled_autograd.h>
|
|
|
|
static struct PyModuleDef _module =
|
|
{PyModuleDef_HEAD_INIT, "torch._C._dynamo", "", -1, nullptr};
|
|
|
|
namespace torch {
|
|
namespace dynamo {
|
|
using torch::dynamo::autograd::torch_c_dynamo_compiled_autograd_init;
|
|
|
|
void initDynamoBindings(PyObject* torch) {
|
|
PyObject* dynamo = PyModule_Create(&_module);
|
|
if (dynamo == nullptr || PyModule_AddObject(torch, "_dynamo", dynamo) != 0) {
|
|
throw python_error();
|
|
}
|
|
|
|
PyObject* eval_frame = torch_c_dynamo_eval_frame_init();
|
|
if (eval_frame == nullptr ||
|
|
PyModule_AddObject(dynamo, "eval_frame", eval_frame) != 0) {
|
|
throw python_error();
|
|
}
|
|
|
|
PyObject* guards = torch_c_dynamo_guards_init();
|
|
if (guards == nullptr || PyModule_AddObject(dynamo, "guards", guards) != 0) {
|
|
throw python_error();
|
|
}
|
|
|
|
PyObject* compiled_autograd = torch_c_dynamo_compiled_autograd_init();
|
|
if (compiled_autograd == nullptr ||
|
|
PyModule_AddObject(dynamo, "compiled_autograd", compiled_autograd) != 0) {
|
|
throw python_error();
|
|
}
|
|
}
|
|
|
|
} // namespace dynamo
|
|
} // namespace torch
|