[1/N] Remove usage of C array (#139567)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/139567
Approved by: https://github.com/Skylion007, https://github.com/ezyang
This commit is contained in:
cyy
2024-11-04 04:52:46 +00:00
committed by PyTorch MergeBot
parent cadc50e7e9
commit 3179eb15ae
8 changed files with 24 additions and 22 deletions

View File

@ -1367,7 +1367,7 @@ static PyObject* THPModule_are_vmap_fallback_warnings_enabled(
END_HANDLE_TH_ERRORS
}
static PyMethodDef TorchMethods[] = { // NOLINT
static std::initializer_list<PyMethodDef> TorchMethods = {
{"_initExtension", THPModule_initExtension, METH_O, nullptr},
{"_autograd_init", THPAutograd_initExtension, METH_NOARGS, nullptr},
{"_add_docstr", THPModule_addDocStr, METH_VARARGS, nullptr},
@ -1703,7 +1703,7 @@ PyObject* initModule() {
if (!(cmd)) \
return nullptr
THPUtils_addPyMethodDefs(methods, TorchMethods);
THPUtils_addPyMethodDefs(methods, std::data(TorchMethods));
THPUtils_addPyMethodDefs(methods, DataLoaderMethods);
THPUtils_addPyMethodDefs(methods, torch::autograd::python_functions());
THPUtils_addPyMethodDefs(methods, torch::multiprocessing::python_functions());
@ -1848,7 +1848,8 @@ PyObject* initModule() {
at::init();
// Automatically translate errors thrown from pybind11 functions
py::register_exception_translator([](std::exception_ptr e) { // NOLINT
// NOLINTNEXTLINE(performance-unnecessary-value-param)
py::register_exception_translator([](std::exception_ptr e) {
try {
if (e) {
std::rethrow_exception(e);