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

Function apply_on_physical_tensor

imperative/src/impl/ops/vision.cpp:41–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41SmallVector<TensorPtr> apply_on_physical_tensor(
42 const OpDef& def, const SmallVector<TensorPtr>& inputs,
43 SmallVector<LogicalTensorDesc>& output_descs, const bool& validated) {
44 auto&& op = def.cast_final_safe<Flip>();
45 auto cn = inputs[0]->comp_node();
46
47 DnnOprCaller<megdnn::Flip> dnn_opr(cn, op.param());
48 auto&& out_layout = [&]() -> TensorLayout {
49 if (validated) {
50 return output_descs[0].layout;
51 } else {
52 return dnn_opr.deduce_layout(inputs[0]->layout());
53 }
54 }();
55
56 auto out = Tensor::make(out_layout, cn);
57
58 dnn_opr.exec_with_ws(inputs[0], out);
59 return {out};
60}
61
62SmallVector<VarNode::LayoutConstraintCallback> get_input_layout_constraint(
63 const OpDef& def, const SmallVector<TensorPtr>& inputs) {

Callers

nothing calls this directly

Calls 7

exec_with_wsMethod · 0.80
makeFunction · 0.70
comp_nodeMethod · 0.45
paramMethod · 0.45
deduce_layoutMethod · 0.45
layoutMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected