| 429 | }; |
| 430 | |
| 431 | void _init_py_op_def(py::module m) { |
| 432 | using py_op = PyOp(OpDef); |
| 433 | auto& py_type = PyOpType(OpDef); |
| 434 | py_type = {PyVarObject_HEAD_INIT(NULL, 0)}; |
| 435 | py_type.tp_name = "megengine.core._imperative_rt.OpDef"; |
| 436 | py_type.tp_basicsize = sizeof(PyOp(OpDef)); |
| 437 | py_type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; |
| 438 | py_type.tp_doc = "OpDef"; |
| 439 | py_type.tp_base = &PyBaseObject_Type; |
| 440 | py_type.tp_hash = PyOp(OpDef)::tp_hash; |
| 441 | py_type.tp_richcompare = PyOp(OpDef)::tp_richcompare; |
| 442 | py_type.tp_getset = py_op::py_getsetters; |
| 443 | py_type.tp_repr = py_op::py_repr; |
| 444 | py_type.tp_dealloc = py_dealloc_generic<PyOp(OpDef)>; |
| 445 | mgb_assert(PyType_Ready(&py_type) >= 0); |
| 446 | m.add_object("OpDef", reinterpret_cast<PyObject*>(&py_type)); |
| 447 | } |
| 448 | |
| 449 | /*********** begin of hand-write opdefs **************/ |
| 450 | struct PyOpBase : PyOpDef { |