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

Method apply_create_tensor

imperative/src/impl/transformations/eval.cpp:87–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87ValueRefList InterpreterTransformation::apply_create_tensor(
88 const CreateTensor& create_tensor, Span<ValueRef> inputs) {
89 auto args = create_tensor.parse(inputs);
90 if (!args.device) {
91 // implies H2D
92 mgb_assert(args.host, "neither host and device value is valid");
93 return {m_value_type.make(share_handle(
94 m_channel->put(*args.host, args.kind == CreateTensor::Unique)))};
95 } else {
96 return {m_value_type.make(share_handle(m_channel->put(
97 *args.device, args.host ? *args.host : HostTensorND())))};
98 }
99}
100
101ValueRefList InterpreterTransformation::apply_transformation(
102 const Operator& op, Span<ValueRef> inputs) {

Callers

nothing calls this directly

Calls 3

parseMethod · 0.45
makeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected