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

Method apply_create_tensor

imperative/src/impl/transformations/trace.cpp:771–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771ValueRefList CompiledTransformation::apply_create_tensor(
772 const CreateTensor& create_tensor, Span<ValueRef> inputs) {
773 if (create_tensor.kind() == CreateTensor::NoTrace) {
774 return imperative::apply(create_tensor, inputs);
775 }
776 auto& item = next_instruction();
777 trace_assert(item.op == nullptr, "operator mismatch");
778 auto input_id = item.inputs[0];
779 auto output_id = item.outputs[0];
780 ValueRef tensor;
781 if (create_tensor.kind() == CreateTensor::Const) {
782 auto args = create_tensor.parse(inputs);
783 if (args.host) {
784 // performance issue
785 tensor = HostValue::make(*args.host);
786 }
787 }
788 if (!tensor) {
789 tensor = imperative::apply(create_tensor, inputs)[0];
790 }
791 return {trace_output(output_id, trace_input(input_id, tensor))};
792}
793
794ValueRefList CompiledTransformation::apply_transformation(
795 const Operator& op, Span<ValueRef> inputs) {

Callers

nothing calls this directly

Calls 4

applyFunction · 0.50
makeFunction · 0.50
kindMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected