MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / load

Method load

imperative/python/src/ops.cpp:489–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487namespace PYBIND11_NAMESPACE {
488namespace detail {
489bool type_caster<OpDef>::load(handle src, bool convert) {
490 PyObject* obj = src.ptr();
491 if (!PyObject_TypeCheck(obj, &PyOpType(OpDef))) {
492 return false;
493 }
494 value = reinterpret_cast<PyOp(OpDef)*>(obj)->op;
495 if (!value) {
496 // opdef only defined in Python
497 value = std::make_shared<GenericPyOp>(reinterpret_borrow<object>(src));
498 }
499 return true;
500}
501handle type_caster<OpDef>::cast(const OpDef& op, return_value_policy, handle) {
502 if (auto* pyop = op.try_cast_final<GenericPyOp>()) {
503 return object(pyop->obj).release();

Callers 15

update_modelFunction · 0.45
run_testFunction · 0.45
test_save_loadFunction · 0.45
test_metadataFunction · 0.45
test_replace_varFunction · 0.45
test_replace_oprFunction · 0.45
test_splice_networkFunction · 0.45
test_modify_paramsFunction · 0.45
test_make_constFunction · 0.45
test_add_inputFunction · 0.45
test_add_remove_outputFunction · 0.45
test_queryFunction · 0.45

Calls 1

ptrMethod · 0.45

Tested by 15

update_modelFunction · 0.36
run_testFunction · 0.36
test_save_loadFunction · 0.36
test_metadataFunction · 0.36
test_replace_varFunction · 0.36
test_replace_oprFunction · 0.36
test_splice_networkFunction · 0.36
test_modify_paramsFunction · 0.36
test_make_constFunction · 0.36
test_add_inputFunction · 0.36
test_add_remove_outputFunction · 0.36
test_queryFunction · 0.36