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

Function infer_output_attrs_fallible

imperative/src/impl/ops/convolution.cpp:28–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28std::tuple<SmallVector<LogicalTensorDesc>, bool> infer_output_attrs_fallible(
29 const OpDef& def, const SmallVector<LogicalTensorDesc>& inputs) {
30 auto&& conv = def.cast_final_safe<Convolution>();
31 DnnOprHelper<megdnn::ConvolutionForward> dnn_opr(conv.param());
32 auto&& data = inputs[0].layout;
33 auto&& filter = inputs[1].layout;
34 TensorLayout output_layout{data.dtype};
35 if (data.ndim && filter.ndim) {
36 // deduce_layout won't override existing dtype
37 dnn_opr.opr().deduce_layout(data, filter, output_layout);
38 }
39 return {{{output_layout, inputs[0].comp_node}}, output_layout.ndim != 0};
40}
41
42// Convolution::Param -> ConvBias::Param
43auto conv_bias_param_from_convolution(const Convolution& conv) {

Callers

nothing calls this directly

Calls 7

paramMethod · 0.45
deduce_layoutMethod · 0.45
oprMethod · 0.45
deduce_dtypeMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected