| 12 | namespace mgb::imperative::python { |
| 13 | |
| 14 | struct GradKeyWrapper : NonCopyableObj { |
| 15 | using wrap_t = pyext17::wrap<GradKeyWrapper>; |
| 16 | static constexpr auto tp_name = pybind11::detail::_("GradKey"); |
| 17 | |
| 18 | std::string m_name; |
| 19 | std::shared_ptr<GradKey> m_key; |
| 20 | std::shared_ptr<GradTransformation> m_transformation; |
| 21 | std::unique_ptr<CleanupGuard<>> m_transformation_guard; |
| 22 | |
| 23 | GradKeyWrapper(); |
| 24 | |
| 25 | PyObject* get_name(); |
| 26 | void set_name(pybind11::handle name); |
| 27 | void attach(PyObject* const* args, size_t nargs); |
| 28 | static void backward(GradKeyWrapper* self, pybind11::list, pybind11::list); |
| 29 | static pybind11::function get_backward_closure( |
| 30 | GradKeyWrapper* self, pybind11::list); |
| 31 | PyObject* is_attached_to(PyObject* const* args, size_t nargs); |
| 32 | void enter(); |
| 33 | void exit(); |
| 34 | void suppress(); |
| 35 | void resume(); |
| 36 | static GradKeyWrapper* get(std::shared_ptr<GradKey> key); |
| 37 | ~GradKeyWrapper(); |
| 38 | }; |
| 39 | |
| 40 | } // namespace mgb::imperative::python |
| 41 | |