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

Method InputCallback

imperative/src/impl/opr_utility.cpp:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20MGB_DYN_TYPE_OBJ_FINAL_IMPL(InputCallback);
21
22InputCallback::InputCallback(
23 cg::ComputingGraph& graph, callback_t callback, const VarNodeArray& inputs,
24 const TensorShape& output_shape, const OperatorNodeConfig& config,
25 bool use_static_shape)
26 : Super(&graph, config, "input_callback", inputs),
27 m_output_shape(output_shape),
28 m_callback(callback),
29 m_use_static_shape(use_static_shape) {
30 for (VarNode* i : inputs) {
31 add_input({i});
32 }
33 DType dt = config.output_dtype();
34 mgb_assert(dt.valid());
35 if (m_use_static_shape) {
36 mgb_assert(m_output_shape.ndim);
37 }
38 add_output(None)
39 ->add_flag(VarNode::Flag::ALLOW_EMPTY_SHAPE)
40 .add_flag(VarNode::Flag::NO_SYS_MEM_ALLOC)
41 .dtype(dt);
42 add_output(None)
43 ->add_flag(VarNode::Flag::ALLOW_EMPTY_SHAPE)
44 .add_flag(VarNode::Flag::NO_SYS_MEM_ALLOC)
45 .dtype(DType::from_enum(DTypeEnum::Byte));
46 add_equivalence_component<ScalarHash<void*>>(this);
47}
48
49SymbolVarArray InputCallback::make(
50 cg::ComputingGraph& graph, callback_t callback, CompNode comp_node, DType dtype,

Callers

nothing calls this directly

Calls 3

output_dtypeMethod · 0.80
validMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected