MCPcopy Create free account
hub / github.com/pybind/pybind11 / TEST_SUBMODULE

Function TEST_SUBMODULE

tests/test_pytorch_shared_ptr_cast_regression.cpp:43–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41} // namespace test_pytorch_regressions
42
43TEST_SUBMODULE(pybind11_pytorch_regressions, m) {
44 using namespace test_pytorch_regressions;
45
46 py::class_<TracingState, std::shared_ptr<TracingState>>(m, "TracingState")
47 .def(py::init<>())
48 .def_readwrite("value", &TracingState::value);
49
50 m.def("_get_tracing_state", []() { return get_tracing_state(); });
51
52 py::class_<InterfaceType, InterfaceTypePtr>(m, "InterfaceType")
53 .def(py::init<>())
54 .def_readwrite("value", &InterfaceType::value);
55
56 py::class_<CompilationUnit, std::shared_ptr<CompilationUnit>>(m, "CompilationUnit")
57 .def(py::init<>())
58 .def("get_interface",
59 [](const std::shared_ptr<CompilationUnit> &self, const std::string &name) {
60 return self->get_interface(name);
61 });
62}

Callers

nothing calls this directly

Calls 1

get_interfaceMethod · 0.80

Tested by

no test coverage detected