MCPcopy Create free account
hub / github.com/alibaba/MNN / _Pad

Function _Pad

express/NeuralNetWorkOp.cpp:739–759  ·  view source on GitHub ↗

Pads a variable. Args: x: A variable. paddings: A variable of type Halide_Type_Int. The shape is [n, 2] where n is the rank of variable. mode: A enum, One of PadValueMode_CONSTANT, PadValueMode_SYMMETRIC, or PadValueMode_REFLECT. Returns: A variable. Has the same type as x. */

Source from the content-addressed store, hash-verified

737A variable. Has the same type as x.
738*/
739VARP _Pad(VARP x, VARP paddings, PadValueMode mode) {
740 std::unique_ptr<OpT> pad(new OpT);
741 pad->type = OpType_Padding;
742 pad->main.type = OpParameter_PadParam;
743 pad->main.value = new PadParamT;
744 switch (mode) {
745 case CONSTANT:
746 pad->main.AsPadParam()->mode = MNN::PadValueMode_CONSTANT;
747 break;
748 case SYMMETRIC:
749 pad->main.AsPadParam()->mode = MNN::PadValueMode_SYMMETRIC;
750 break;
751 case REFLECT:
752 pad->main.AsPadParam()->mode = MNN::PadValueMode_REFLECT;
753 break;
754 default:
755 pad->main.AsPadParam()->mode = MNN::PadValueMode_CONSTANT;
756 break;
757 }
758 return (Variable::create(Expr::create(std::move(pad), {x, paddings})));
759}
760/*Returns a variable with an additional dimension inserted at index axis.
761Args:
762input: A variable.

Callers 14

PadForConvFunction · 0.85
spectrogramFunction · 0.85
conformer_fbankFunction · 0.85
usm_fbankFunction · 0.85
onExecuteMethod · 0.85
_winogradConvMethod · 0.85
minicpmVisionProcessMethod · 0.85
runMethod · 0.85
CreateCaseSymmetricFunction · 0.85
CreateCaseReflectFunction · 0.85
runMethod · 0.85

Calls 2

AsPadParamMethod · 0.80
createFunction · 0.50

Tested by 5

runMethod · 0.68
CreateCaseSymmetricFunction · 0.68
CreateCaseReflectFunction · 0.68
runMethod · 0.68
referenceWinogradMethod · 0.68