| @@ -242,6 +242,7 @@ set(LITE_KERNEL_SRC | |||||
| ${LITE_DIR}/nnacl/infer/group_conv2d_grad_input_infer.c | ${LITE_DIR}/nnacl/infer/group_conv2d_grad_input_infer.c | ||||
| ${LITE_DIR}/nnacl/infer/gru_infer.c | ${LITE_DIR}/nnacl/infer/gru_infer.c | ||||
| ${LITE_DIR}/nnacl/infer/hashtable_lookup_infer.c | ${LITE_DIR}/nnacl/infer/hashtable_lookup_infer.c | ||||
| ${LITE_DIR}/nnacl/infer/infer_register.c | |||||
| ${LITE_DIR}/nnacl/infer/invert_permutation_infer.c | ${LITE_DIR}/nnacl/infer/invert_permutation_infer.c | ||||
| ${LITE_DIR}/nnacl/infer/layer_norm_infer.c | ${LITE_DIR}/nnacl/infer/layer_norm_infer.c | ||||
| ${LITE_DIR}/nnacl/infer/layer_norm_grad_infer.c | ${LITE_DIR}/nnacl/infer/layer_norm_grad_infer.c | ||||
| @@ -14,6 +14,7 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "nnacl/infer/adam_infer.h" | #include "nnacl/infer/adam_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AdamInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AdamInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int AdamInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Adam, PrimType_Adam, AdamInferShape) | |||||
| @@ -16,6 +16,8 @@ | |||||
| #include "nnacl/infer/add_sub_grad_infer.h" | #include "nnacl/infer/add_sub_grad_infer.h" | ||||
| #include "nnacl/arithmetic.h" | #include "nnacl/arithmetic.h" | ||||
| #include "nnacl/infer/arithmetic_grad_infer.h" | |||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AddSubGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AddSubGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -58,3 +60,6 @@ int AddSubGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso | |||||
| SetDataTypeFormat(dx2, dy); | SetDataTypeFormat(dx2, dy); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(AddGrad, PrimType_AddGrad, AddSubGradInferShape) | |||||
| REG_INFER(SubGrad, PrimType_SubGrad, AddSubGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/addn_infer.h" | #include "nnacl/infer/addn_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AddnInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AddnInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -71,3 +72,5 @@ int AddnInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(AddN, PrimType_AddN, AddnInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/apply_momentum_infer.h" | #include "nnacl/infer/apply_momentum_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ApplyMomentumInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ApplyMomentumInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -42,3 +43,5 @@ int ApplyMomentumInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ApplyMomentum, PrimType_ApplyMomentum, ApplyMomentumInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/argmin_max_infer.h" | #include "nnacl/infer/argmin_max_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ArgMinMaxInferShape(const TensorC *const *inputs, const size_t inputs_size, TensorC **outputs, | int ArgMinMaxInferShape(const TensorC *const *inputs, const size_t inputs_size, TensorC **outputs, | ||||
| const size_t outputs_size, OpParameter *parameter) { | const size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -73,3 +74,6 @@ int ArgMinMaxInferShape(const TensorC *const *inputs, const size_t inputs_size, | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ArgMin, PrimType_ArgMinFusion, ArgMinMaxInferShape) | |||||
| REG_INFER(ArgMax, PrimType_ArgMaxFusion, ArgMinMaxInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/arithmetic_compare_infer.h" | #include "nnacl/infer/arithmetic_compare_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ArithmeticCompareInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int ArithmeticCompareInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -26,3 +27,10 @@ int ArithmeticCompareInferShape(const TensorC *const *inputs, size_t inputs_size | |||||
| output->data_type_ = kNumberTypeBool; | output->data_type_ = kNumberTypeBool; | ||||
| return res; | return res; | ||||
| } | } | ||||
| REG_INFER(Equal, PrimType_Equal, ArithmeticCompareInferShape) | |||||
| REG_INFER(Greater, PrimType_Greater, ArithmeticCompareInferShape) | |||||
| REG_INFER(GreaterEqual, PrimType_GreaterEqual, ArithmeticCompareInferShape) | |||||
| REG_INFER(Less, PrimType_Less, ArithmeticCompareInferShape) | |||||
| REG_INFER(LessEqual, PrimType_LessEqual, ArithmeticCompareInferShape) | |||||
| REG_INFER(NotEqual, PrimType_NotEqual, ArithmeticCompareInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/arithmetic_grad_infer.h" | #include "nnacl/infer/arithmetic_grad_infer.h" | ||||
| #include "nnacl/arithmetic.h" | #include "nnacl/arithmetic.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| /* | /* | ||||
| * the Arithmetic Grad op include AddGrad, SubGrad, MulGrad, DivGrad, MaximumGrad, MinimumGrad | * the Arithmetic Grad op include AddGrad, SubGrad, MulGrad, DivGrad, MaximumGrad, MinimumGrad | ||||
| @@ -99,3 +100,6 @@ int ArithmeticGradInferShape(const TensorC *const *inputs, size_t inputs_size, T | |||||
| dx2->data_type_ = dy->data_type_; | dx2->data_type_ = dy->data_type_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(DivGrad, PrimType_DivGrad, ArithmeticGradInferShape) | |||||
| REG_INFER(MulGrad, PrimType_MulGrad, ArithmeticGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/arithmetic_infer.h" | #include "nnacl/infer/arithmetic_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ArithmeticInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ArithmeticInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -117,3 +118,18 @@ int ArithmeticInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Add, PrimType_AddFusion, ArithmeticInferShape) | |||||
| REG_INFER(Div, PrimType_DivFusion, ArithmeticInferShape) | |||||
| REG_INFER(Eltwise, PrimType_Eltwise, ArithmeticInferShape) | |||||
| REG_INFER(FloorDiv, PrimType_FloorDiv, ArithmeticInferShape) | |||||
| REG_INFER(FloorMod, PrimType_FloorMod, ArithmeticInferShape) | |||||
| REG_INFER(LogicalAnd, PrimType_LogicalAnd, ArithmeticInferShape) | |||||
| REG_INFER(LogicalOr, PrimType_LogicalOr, ArithmeticInferShape) | |||||
| REG_INFER(Maximum, PrimType_Maximum, ArithmeticInferShape) | |||||
| REG_INFER(Minimum, PrimType_Minimum, ArithmeticInferShape) | |||||
| REG_INFER(Mod, PrimType_Mod, ArithmeticInferShape) | |||||
| REG_INFER(Mul, PrimType_MulFusion, ArithmeticInferShape) | |||||
| REG_INFER(RealDiv, PrimType_RealDiv, ArithmeticInferShape) | |||||
| REG_INFER(Sub, PrimType_SubFusion, ArithmeticInferShape) | |||||
| REG_INFER(SquaredDifference, PrimType_SquaredDifference, ArithmeticInferShape) | |||||
| @@ -15,8 +15,11 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/assert_op_infer.h" | #include "nnacl/infer/assert_op_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AssertOpInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AssertOpInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Assert, PrimType_Assert, AssertOpInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/assign_add_infer.h" | #include "nnacl/infer/assign_add_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AssignAddInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AssignAddInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -35,3 +36,5 @@ int AssignAddInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor | |||||
| SetShapeTensor(out, x); | SetShapeTensor(out, x); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(AssignAdd, PrimType_AssignAdd, AssignAddInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/assign_infer.h" | #include "nnacl/infer/assign_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int AssignInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int AssignInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -37,3 +38,5 @@ int AssignInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Assign, PrimType_Assign, AssignInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/audio_spectrogram_infer.h" | #include "nnacl/infer/audio_spectrogram_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int Log2Ceil(uint32_t length) { | int Log2Ceil(uint32_t length) { | ||||
| if (length == 0) { | if (length == 0) { | ||||
| @@ -72,3 +73,5 @@ int AudioSpectrogramInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| SetShapeArray(output, output_shape, 3); | SetShapeArray(output, output_shape, 3); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(AudioSpectrogram, PrimType_AudioSpectrogram, AudioSpectrogramInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/batch_to_space_infer.h" | #include "nnacl/infer/batch_to_space_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SetOutputShapeFromParam(const TensorC *const *inputs, TensorC **outputs, OpParameter *parameter) { | int SetOutputShapeFromParam(const TensorC *const *inputs, TensorC **outputs, OpParameter *parameter) { | ||||
| int input_shape[MAX_SHAPE_SIZE]; | int input_shape[MAX_SHAPE_SIZE]; | ||||
| @@ -135,3 +136,5 @@ int BatchToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, Ten | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(BatchToSpace, PrimType_BatchToSpace, BatchToSpaceInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/bias_grad_infer.h" | #include "nnacl/infer/bias_grad_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int BiasGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int BiasGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -40,3 +41,5 @@ int BiasGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(BiasAddGrad, PrimType_BiasAddGrad, BiasGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/binary_cross_entropy_infer.h" | #include "nnacl/infer/binary_cross_entropy_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int BinaryCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int BinaryCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -31,3 +32,5 @@ int BinaryCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_siz | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(BinaryCrossEntropy, PrimType_BinaryCrossEntropy, BinaryCrossEntropyInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/bn_grad_infer.h" | #include "nnacl/infer/bn_grad_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int BnGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int BnGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int BnGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| SetDataTypeFormat(outputs[2], scale); | SetDataTypeFormat(outputs[2], scale); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(BatchNormGrad, PrimType_BatchNormGrad, BnGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/broadcast_to_infer.h" | #include "nnacl/infer/broadcast_to_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int BroadcastToInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int BroadcastToInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -66,3 +67,5 @@ int BroadcastToInferShape(const TensorC *const *inputs, size_t inputs_size, Tens | |||||
| SetShapeArray(outputs[0], shape, shape_size); | SetShapeArray(outputs[0], shape, shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(BroadcastTo, PrimType_BroadcastTo, BroadcastToInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/cast_infer.h" | #include "nnacl/infer/cast_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int CastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -42,3 +43,5 @@ int CastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| SetShapeTensor(output, input); | SetShapeTensor(output, input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Cast, PrimType_Cast, CastInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/common_infer.h" | #include "nnacl/infer/common_infer.h" | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MallocTensorListData(TensorListC *tensor_list, TypeIdC dtype, vvector *tensor_shape) { | int MallocTensorListData(TensorListC *tensor_list, TypeIdC dtype, vvector *tensor_shape) { | ||||
| // This function will create a new tensors_ | // This function will create a new tensors_ | ||||
| @@ -437,3 +438,48 @@ void VectorCFree(VectorC *vc) { | |||||
| free(vc->data_); | free(vc->data_); | ||||
| vc->data_ = NULL; | vc->data_ = NULL; | ||||
| } | } | ||||
| REG_INFER(Abs, PrimType_Abs, CommonInferShape) | |||||
| REG_INFER(AbsGrad, PrimType_AbsGrad, CommonInferShape) | |||||
| REG_INFER(Activation, PrimType_Activation, CommonInferShape) | |||||
| REG_INFER(ActivationGrad, PrimType_ActivationGrad, CommonInferShape) | |||||
| REG_INFER(BatchNorm, PrimType_BatchNorm, CommonInferShape) | |||||
| REG_INFER(BinaryCrossEntropyGrad, PrimType_BinaryCrossEntropyGrad, CommonInferShape) | |||||
| REG_INFER(BiasAdd, PrimType_BiasAdd, CommonInferShape) | |||||
| REG_INFER(Ceil, PrimType_Ceil, CommonInferShape) | |||||
| REG_INFER(Clip, PrimType_Clip, CommonInferShape) | |||||
| REG_INFER(ControlDepend, PrimType_ControlDepend, CommonInferShape) | |||||
| REG_INFER(Cos, PrimType_Cos, CommonInferShape) | |||||
| REG_INFER(Depend, PrimType_Depend, CommonInferShape) | |||||
| REG_INFER(Elu, PrimType_Elu, CommonInferShape) | |||||
| REG_INFER(Erf, PrimType_Erf, CommonInferShape) | |||||
| REG_INFER(Exp, PrimType_ExpFusion, CommonInferShape) | |||||
| REG_INFER(FakeQuantWithMinMaxVars, PrimType_FakeQuantWithMinMaxVars, CommonInferShape) | |||||
| REG_INFER(Floor, PrimType_Floor, CommonInferShape) | |||||
| REG_INFER(If, PrimType_If, CommonInferShape) | |||||
| REG_INFER(InstanceNorm, PrimType_InstanceNorm, CommonInferShape) | |||||
| REG_INFER(IsFinite, PrimType_IsFinite, CommonInferShape) | |||||
| REG_INFER(LeakyRelu, PrimType_LeakyRelu, CommonInferShape) | |||||
| REG_INFER(Log, PrimType_Log, CommonInferShape) | |||||
| REG_INFER(LogGrad, PrimType_LogGrad, CommonInferShape) | |||||
| REG_INFER(LogicalNot, PrimType_LogicalNot, CommonInferShape) | |||||
| REG_INFER(LRN, PrimType_LRN, CommonInferShape) | |||||
| REG_INFER(L2Normalize, PrimType_L2NormalizeFusion, CommonInferShape) | |||||
| REG_INFER(Neg, PrimType_Neg, CommonInferShape) | |||||
| REG_INFER(NegGrad, PrimType_NegGrad, CommonInferShape) | |||||
| REG_INFER(PowerGrad, PrimType_PowerGrad, CommonInferShape) | |||||
| REG_INFER(PReLU, PrimType_PReLUFusion, CommonInferShape) | |||||
| REG_INFER(Reciprocal, PrimType_Reciprocal, CommonInferShape) | |||||
| REG_INFER(ReverseSequence, PrimType_ReverseSequence, CommonInferShape) | |||||
| REG_INFER(Reverse, PrimType_ReverseV2, CommonInferShape) | |||||
| REG_INFER(Round, PrimType_Round, CommonInferShape) | |||||
| REG_INFER(Rsqrt, PrimType_Rsqrt, CommonInferShape) | |||||
| REG_INFER(Scale, PrimType_ScaleFusion, CommonInferShape) | |||||
| REG_INFER(SigmoidCrossEntropyWithLogits, PrimType_SigmoidCrossEntropyWithLogits, CommonInferShape) | |||||
| REG_INFER(SigmoidCrossEntropyWithLogitsGrad, PrimType_SigmoidCrossEntropyWithLogitsGrad, CommonInferShape) | |||||
| REG_INFER(Sin, PrimType_Sin, CommonInferShape) | |||||
| REG_INFER(SmoothL1Loss, PrimType_SmoothL1Loss, CommonInferShape) | |||||
| REG_INFER(SmoothL1LossGrad, PrimType_SmoothL1LossGrad, CommonInferShape) | |||||
| REG_INFER(Sqrt, PrimType_Sqrt, CommonInferShape) | |||||
| REG_INFER(Square, PrimType_Square, CommonInferShape) | |||||
| REG_INFER(ZerosLike, PrimType_ZerosLike, CommonInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/concat_infer.h" | #include "nnacl/infer/concat_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ConcatInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ConcatInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -73,3 +74,5 @@ int ConcatInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| SetShapeArray(outputs[0], output_shape, output_shape_size); | SetShapeArray(outputs[0], output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Concat, PrimType_Concat, ConcatInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/constant_of_shape_infer.h" | #include "nnacl/infer/constant_of_shape_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ConstantOfShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ConstantOfShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -64,3 +65,5 @@ int ConstantOfShapeInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| SetShapeArray(out_tensor, out_shape, out_shape_size); | SetShapeArray(out_tensor, out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ConstantOfShape, PrimType_ConstantOfShape, ConstantOfShapeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/conv2d_grad_filter_infer.h" | #include "nnacl/infer/conv2d_grad_filter_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int Conv2dGradFilterInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int Conv2dGradFilterInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -33,3 +34,5 @@ int Conv2dGradFilterInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| SetShapeArray(outputs[0], filter_shape_, filter_shape_size_); | SetShapeArray(outputs[0], filter_shape_, filter_shape_size_); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Conv2DBackpropFilterFusion, PrimType_Conv2DBackpropFilterFusion, Conv2dGradFilterInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/conv2d_grad_input_infer.h" | #include "nnacl/infer/conv2d_grad_input_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int Conv2dGradInputInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int Conv2dGradInputInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int Conv2dGradInputInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Conv2DBackpropInputFusion, PrimType_Conv2DBackpropInputFusion, Conv2dGradInputInferShape) | |||||
| @@ -14,6 +14,7 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "nnacl/infer/conv2d_infer.h" | #include "nnacl/infer/conv2d_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| void ConvInferShape(int input_h, int input_w, int *output_h, int *output_w, ConvParameter *param) { | void ConvInferShape(int input_h, int input_w, int *output_h, int *output_w, ConvParameter *param) { | ||||
| int kernel_w = param->kernel_w_; | int kernel_w = param->kernel_w_; | ||||
| @@ -100,3 +101,6 @@ int Conv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Adder, PrimType_AdderFusion, Conv2dInferShape) | |||||
| REG_INFER(Conv2D, PrimType_Conv2DFusion, Conv2dInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/crop_and_resize_infer.h" | #include "nnacl/infer/crop_and_resize_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CropAndResizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int CropAndResizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -56,3 +57,5 @@ int CropAndResizeInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| SetShapeArray(output, output_shape, output_shape_size); | SetShapeArray(output, output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(CropAndResize, PrimType_CropAndResize, CropAndResizeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/crop_infer.h" | #include "nnacl/infer/crop_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CropInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int CropInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -32,3 +33,5 @@ int CropInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| SetShapeTensor(outputs[0], inputs[1]); | SetShapeTensor(outputs[0], inputs[1]); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Crop, PrimType_Crop, CropInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/custom_extract_features_infer.h" | #include "nnacl/infer/custom_extract_features_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CustomExtractFeaturesInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int CustomExtractFeaturesInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -46,3 +47,5 @@ int CustomExtractFeaturesInferShape(const TensorC *const *inputs, size_t inputs_ | |||||
| output1->shape_[0] = res; | output1->shape_[0] = res; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(CustomExtractFeatures, PrimType_CustomExtractFeatures, CustomExtractFeaturesInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/custom_normalize_infer.h" | #include "nnacl/infer/custom_normalize_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CustomNormalizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int CustomNormalizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int CustomNormalizeInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| output->shape_[0] = (string_num == 0 ? 1 : string_num); | output->shape_[0] = (string_num == 0 ? 1 : string_num); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(CustomNormalize, PrimType_CustomNormalize, CustomNormalizeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/custom_predict_infer.h" | #include "nnacl/infer/custom_predict_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CustomPredictInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int CustomPredictInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -40,3 +41,5 @@ int CustomPredictInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| output1->format_ = input->format_; | output1->format_ = input->format_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(CustomPredict, PrimType_CustomPredict, CustomPredictInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/deconv2d_infer.h" | #include "nnacl/infer/deconv2d_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -97,3 +98,5 @@ int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| param->output_channel_ = output_c; | param->output_channel_ = output_c; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Conv2dTranspose, PrimType_Conv2dTransposeFusion, Deconv2dInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/dedepthwise_conv2d_infer.h" | #include "nnacl/infer/dedepthwise_conv2d_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DeDepthwiseConv2DInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int DeDepthwiseConv2DInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/depth_to_space_infer.h" | #include "nnacl/infer/depth_to_space_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DepthToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int DepthToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -54,3 +55,5 @@ int DepthToSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, Ten | |||||
| SetShapeArray(outputs[0], output_shape, output_shape_size); | SetShapeArray(outputs[0], output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(DepthToSpace, PrimType_DepthToSpace, DepthToSpaceInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/depthwise_conv2d_infer.h" | #include "nnacl/infer/depthwise_conv2d_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DepthwiseConv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int DepthwiseConv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/detection_post_process_infer.h" | #include "nnacl/infer/detection_post_process_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DetectionPostProcessInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int DetectionPostProcessInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -77,3 +78,5 @@ int DetectionPostProcessInferShape(const TensorC *const *inputs, size_t inputs_s | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(DetectionPostProcess, PrimType_DetectionPostProcess, DetectionPostProcessInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/dropout_grad_infer.h" | #include "nnacl/infer/dropout_grad_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DropoutGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int DropoutGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -34,3 +35,5 @@ int DropoutGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens | |||||
| SetShapeTensor(output, input); | SetShapeTensor(output, input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(DropoutGrad, PrimType_DropoutGrad, DropoutGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/dropout_infer.h" | #include "nnacl/infer/dropout_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int DropoutInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int DropoutInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int DropoutInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Dropout, PrimType_Dropout, DropoutInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/embedding_lookup_infer.h" | #include "nnacl/infer/embedding_lookup_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int EmbeddingLookupInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int EmbeddingLookupInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -59,3 +60,5 @@ int EmbeddingLookupInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| SetShapeArray(output, output_shape, output_shape_size); | SetShapeArray(output, output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(EmbeddingLookup, PrimType_EmbeddingLookupFusion, EmbeddingLookupInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/expand_dims_infer.h" | #include "nnacl/infer/expand_dims_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ExpandDimsInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ExpandDimsInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -44,3 +45,5 @@ int ExpandDimsInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso | |||||
| ShapeInsert(output->shape_, &(output->shape_size_), dim, 1); | ShapeInsert(output->shape_, &(output->shape_size_), dim, 1); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ExpandDims, PrimType_ExpandDims, ExpandDimsInferShape) | |||||
| @@ -15,8 +15,11 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/fft_imag_infer.h" | #include "nnacl/infer/fft_imag_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FftImagInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FftImagInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| return FftInferShape(inputs, inputs_size, outputs, outputs_size, parameter); | return FftInferShape(inputs, inputs_size, outputs, outputs_size, parameter); | ||||
| } | } | ||||
| REG_INFER(FftImag, PrimType_FftImag, FftImagInferShape) | |||||
| @@ -15,8 +15,11 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/fft_real_infer.h" | #include "nnacl/infer/fft_real_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FftRealInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FftRealInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| return FftInferShape(inputs, inputs_size, outputs, outputs_size, parameter); | return FftInferShape(inputs, inputs_size, outputs, outputs_size, parameter); | ||||
| } | } | ||||
| REG_INFER(FftReal, PrimType_FftReal, FftRealInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/fill_infer.h" | #include "nnacl/infer/fill_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FillInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FillInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -46,3 +47,5 @@ int FillInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| SetShapeArray(output, output_shape, output_shape_size); | SetShapeArray(output, output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Fill, PrimType_Fill, FillInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/flatten_grad_infer.h" | #include "nnacl/infer/flatten_grad_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FlattenGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FlattenGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -37,3 +38,5 @@ int FlattenGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens | |||||
| SetShapeArray(output, (int *)(inputs[1]->data_), output_shape_size); | SetShapeArray(output, (int *)(inputs[1]->data_), output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(FlattenGrad, PrimType_FlattenGrad, FlattenGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/flatten_infer.h" | #include "nnacl/infer/flatten_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FlattenInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FlattenInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -45,3 +46,5 @@ int FlattenInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeArray(output, output_shape, 2); | SetShapeArray(output, output_shape, 2); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Flatten, PrimType_Flatten, FlattenInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/full_connection_infer.h" | #include "nnacl/infer/full_connection_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FullConnectionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FullConnectionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -75,3 +76,5 @@ int FullConnectionInferShape(const TensorC *const *inputs, size_t inputs_size, T | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(FullConnection, PrimType_FullConnection, FullConnectionInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/fused_batchnorm_infer.h" | #include "nnacl/infer/fused_batchnorm_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int FusedBatchNormInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int FusedBatchNormInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -32,3 +33,5 @@ int FusedBatchNormInferShape(const TensorC *const *inputs, size_t inputs_size, T | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| REG_INFER(FusedBatchNorm, PrimType_FusedBatchNorm, FusedBatchNormInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/gather_infer.h" | #include "nnacl/infer/gather_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int GatherInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int GatherInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -57,3 +58,5 @@ int GatherInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| SetShapeArray(output, out_shape, out_shape_size); | SetShapeArray(output, out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Gather, PrimType_Gather, GatherInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/gather_nd_infer.h" | #include "nnacl/infer/gather_nd_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int GatherNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int GatherNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -50,3 +51,5 @@ int GatherNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeArray(output, out_shape, out_shape_size); | SetShapeArray(output, out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(GatherNd, PrimType_GatherNd, GatherNdInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/group_conv2d_grad_input_infer.h" | #include "nnacl/infer/group_conv2d_grad_input_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int GroupConv2dGradInputInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int GroupConv2dGradInputInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/gru_infer.h" | #include "nnacl/infer/gru_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int GruInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int GruInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -80,3 +81,5 @@ int GruInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou | |||||
| SetShapeArray(outputs[1], state_shape, state_shape_size); | SetShapeArray(outputs[1], state_shape, state_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(GRU, PrimType_GRU, GruInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/hashtable_lookup_infer.h" | #include "nnacl/infer/hashtable_lookup_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int HashtableLoopupInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int HashtableLoopupInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -42,3 +43,5 @@ int HashtableLoopupInferShape(const TensorC *const *inputs, size_t inputs_size, | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(HashtableLookup, PrimType_HashtableLookup, HashtableLoopupInferShape) | |||||
| @@ -0,0 +1,33 @@ | |||||
| /** | |||||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||||
| * | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| * you may not use this file except in compliance with the License. | |||||
| * You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| */ | |||||
| #ifndef MINDSPORE_LITE_NNACL_INFER_INFER_H_ | |||||
| #define MINDSPORE_LITE_NNACL_INFER_INFER_H_ | |||||
| #include "nnacl/tensor_c.h" | |||||
| #include "nnacl/op_base.h" | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| typedef int (*InferShape)(const TensorC *const *inputs, size_t input_size, TensorC **outputs, size_t output_size, | |||||
| OpParameter *parameter); | |||||
| InferShape GetInferFunc(int prim_type); | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif // MINDSPORE_LITE_NNACL_INFER_INFER_H_ | |||||
| @@ -0,0 +1,31 @@ | |||||
| /** | |||||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||||
| * | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| * you may not use this file except in compliance with the License. | |||||
| * You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| */ | |||||
| #include "nnacl/infer/infer_register.h" | |||||
| InferShape g_infer_func[PrimType_MAX]; | |||||
| InferShape GetInferFunc(int prim_type) { | |||||
| if (prim_type < PrimType_MAX) { | |||||
| return g_infer_func[prim_type]; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| void RegInfer(int prim_type, InferShape func) { | |||||
| if (prim_type < PrimType_MAX) { | |||||
| g_infer_func[prim_type] = func; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,226 @@ | |||||
| /** | |||||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||||
| * | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| * you may not use this file except in compliance with the License. | |||||
| * You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| */ | |||||
| #ifndef MINDSPORE_LITE_NNACL_INFER_INFER_REGISTER_H_ | |||||
| #define MINDSPORE_LITE_NNACL_INFER_INFER_REGISTER_H_ | |||||
| #include "nnacl/tensor_c.h" | |||||
| #include "nnacl/op_base.h" | |||||
| #include "nnacl/infer/infer.h" | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| enum PrimType { | |||||
| PrimType_NONE = 0, | |||||
| PrimType_Abs = 1, | |||||
| PrimType_Activation = 2, | |||||
| PrimType_ActivationGrad = 3, | |||||
| PrimType_Adam = 4, | |||||
| PrimType_AddFusion = 5, | |||||
| PrimType_AdderFusion = 6, | |||||
| PrimType_AddGrad = 7, | |||||
| PrimType_AddN = 8, | |||||
| PrimType_All = 9, | |||||
| PrimType_ApplyMomentum = 10, | |||||
| PrimType_ArgMaxFusion = 11, | |||||
| PrimType_ArgMinFusion = 12, | |||||
| PrimType_Assert = 13, | |||||
| PrimType_Assign = 14, | |||||
| PrimType_AssignAdd = 15, | |||||
| PrimType_AudioSpectrogram = 16, | |||||
| PrimType_AvgPoolFusion = 17, | |||||
| PrimType_AvgPoolGrad = 18, | |||||
| PrimType_BatchNorm = 19, | |||||
| PrimType_BatchNormGrad = 20, | |||||
| PrimType_BatchToSpace = 21, | |||||
| PrimType_BatchToSpaceND = 22, | |||||
| PrimType_BiasAdd = 23, | |||||
| PrimType_BinaryCrossEntropy = 24, | |||||
| PrimType_BinaryCrossEntropyGrad = 25, | |||||
| PrimType_BiasAddGrad = 26, | |||||
| PrimType_BroadcastTo = 27, | |||||
| PrimType_Cast = 28, | |||||
| PrimType_Ceil = 29, | |||||
| PrimType_Clip = 30, | |||||
| PrimType_Concat = 31, | |||||
| PrimType_ControlDepend = 32, | |||||
| PrimType_Conv2DBackpropFilterFusion = 33, | |||||
| PrimType_Conv2DBackpropInputFusion = 34, | |||||
| PrimType_Conv2DFusion = 35, | |||||
| PrimType_Conv2dTransposeFusion = 36, | |||||
| PrimType_Cos = 37, | |||||
| PrimType_ConstantOfShape = 38, | |||||
| PrimType_Crop = 39, | |||||
| PrimType_CustomExtractFeatures = 40, | |||||
| PrimType_CustomNormalize = 41, | |||||
| PrimType_CustomPredict = 42, | |||||
| PrimType_DeConv2DGradFilter = 43, | |||||
| PrimType_Depend = 44, | |||||
| PrimType_DepthToSpace = 45, | |||||
| PrimType_DetectionPostProcess = 46, | |||||
| PrimType_DivFusion = 47, | |||||
| PrimType_DivGrad = 48, | |||||
| PrimType_Dropout = 49, | |||||
| PrimType_DropoutGrad = 50, | |||||
| PrimType_Elu = 51, | |||||
| PrimType_Eltwise = 52, | |||||
| PrimType_Equal = 53, | |||||
| PrimType_EmbeddingLookupFusion = 54, | |||||
| PrimType_ExpFusion = 55, | |||||
| PrimType_ExpandDims = 56, | |||||
| PrimType_FakeQuantWithMinMaxVars = 57, | |||||
| PrimType_FakeQuantWithMinMaxVarsPerChannel = 58, | |||||
| PrimType_FftReal = 59, | |||||
| PrimType_FftImag = 60, | |||||
| PrimType_Flatten = 61, | |||||
| PrimType_FlattenGrad = 62, | |||||
| PrimType_Floor = 63, | |||||
| PrimType_FloorDiv = 64, | |||||
| PrimType_FloorMod = 65, | |||||
| PrimType_Fill = 66, | |||||
| PrimType_FullConnection = 67, | |||||
| PrimType_FusedBatchNorm = 68, | |||||
| PrimType_Gather = 69, | |||||
| PrimType_GatherNd = 70, | |||||
| PrimType_Greater = 71, | |||||
| PrimType_GreaterEqual = 72, | |||||
| PrimType_HashtableLookup = 73, | |||||
| PrimType_InstanceNorm = 74, | |||||
| PrimType_LayerNormFusion = 75, | |||||
| PrimType_LeakyRelu = 76, | |||||
| PrimType_Less = 77, | |||||
| PrimType_LessEqual = 78, | |||||
| PrimType_Log = 79, | |||||
| PrimType_LogGrad = 80, | |||||
| PrimType_LogicalAnd = 81, | |||||
| PrimType_LogicalNot = 82, | |||||
| PrimType_LogicalOr = 83, | |||||
| PrimType_LpNormalization = 84, | |||||
| PrimType_LRN = 85, | |||||
| PrimType_LshProjection = 86, | |||||
| PrimType_LSTM = 87, | |||||
| PrimType_L2NormalizeFusion = 88, | |||||
| PrimType_MatMul = 89, | |||||
| PrimType_Maximum = 90, | |||||
| PrimType_MaximumGrad = 91, | |||||
| PrimType_MaxPoolFusion = 92, | |||||
| PrimType_MaxPoolGrad = 93, | |||||
| PrimType_Merge = 94, | |||||
| PrimType_Mfcc = 95, | |||||
| PrimType_Minimum = 96, | |||||
| PrimType_MinimumGrad = 97, | |||||
| PrimType_Mod = 98, | |||||
| PrimType_MulFusion = 99, | |||||
| PrimType_MulGrad = 100, | |||||
| PrimType_Neg = 101, | |||||
| PrimType_NegGrad = 102, | |||||
| PrimType_NotEqual = 103, | |||||
| PrimType_NonMaxSuppression = 104, | |||||
| PrimType_OneHot = 105, | |||||
| PrimType_OnesLike = 106, | |||||
| PrimType_PadFusion = 107, | |||||
| PrimType_PartialFusion = 108, | |||||
| PrimType_PowerGrad = 109, | |||||
| PrimType_PowFusion = 110, | |||||
| PrimType_PriorBox = 111, | |||||
| PrimType_PReLUFusion = 112, | |||||
| PrimType_QuantDTypeCast = 113, | |||||
| PrimType_Rank = 114, | |||||
| PrimType_Range = 115, | |||||
| PrimType_Reciprocal = 116, | |||||
| PrimType_RealDiv = 117, | |||||
| PrimType_ReduceFusion = 118, | |||||
| PrimType_Reshape = 119, | |||||
| PrimType_Resize = 120, | |||||
| PrimType_ReverseSequence = 121, | |||||
| PrimType_ReverseV2 = 122, | |||||
| PrimType_Rfft = 123, | |||||
| PrimType_ROIPooling = 124, | |||||
| PrimType_Round = 125, | |||||
| PrimType_Rsqrt = 126, | |||||
| PrimType_ScaleFusion = 127, | |||||
| PrimType_ScatterNd = 128, | |||||
| PrimType_SGD = 129, | |||||
| PrimType_Shape = 130, | |||||
| PrimType_SigmoidCrossEntropyWithLogits = 131, | |||||
| PrimType_SigmoidCrossEntropyWithLogitsGrad = 132, | |||||
| PrimType_Sin = 133, | |||||
| PrimType_SkipGram = 134, | |||||
| PrimType_SliceFusion = 135, | |||||
| PrimType_SmoothL1Loss = 136, | |||||
| PrimType_SmoothL1LossGrad = 137, | |||||
| PrimType_Softmax = 138, | |||||
| PrimType_SoftmaxCrossEntropyWithLogits = 139, | |||||
| PrimType_SpaceToBatch = 140, | |||||
| PrimType_SpaceToBatchND = 141, | |||||
| PrimType_SpaceToDepth = 142, | |||||
| PrimType_SparseSoftmaxCrossEntropyWithLogits = 143, | |||||
| PrimType_SparseToDense = 144, | |||||
| PrimType_Split = 145, | |||||
| PrimType_Sqrt = 146, | |||||
| PrimType_Squeeze = 147, | |||||
| PrimType_Square = 148, | |||||
| PrimType_SquaredDifference = 149, | |||||
| PrimType_Stack = 150, | |||||
| PrimType_StridedSlice = 151, | |||||
| PrimType_SubFusion = 152, | |||||
| PrimType_SubGrad = 153, | |||||
| PrimType_Switch = 154, | |||||
| PrimType_TensorListFromTensor = 155, | |||||
| PrimType_TensorListGetItem = 156, | |||||
| PrimType_TensorListReserve = 157, | |||||
| PrimType_TensorListSetItem = 158, | |||||
| PrimType_TensorListStack = 159, | |||||
| PrimType_TileFusion = 160, | |||||
| PrimType_TopKFusion = 161, | |||||
| PrimType_Transpose = 162, | |||||
| PrimType_Unique = 163, | |||||
| PrimType_UnsortedSegmentSum = 164, | |||||
| PrimType_Unsqueeze = 165, | |||||
| PrimType_Unstack = 166, | |||||
| PrimType_While = 167, | |||||
| PrimType_Where = 168, | |||||
| PrimType_ZerosLike = 169, | |||||
| PrimType_Select = 170, | |||||
| PrimType_If = 171, | |||||
| PrimType_GRU = 172, | |||||
| PrimType_NonZero = 173, | |||||
| PrimType_InvertPermutation = 174, | |||||
| PrimType_Size = 175, | |||||
| PrimType_RandomStandardNormal = 176, | |||||
| PrimType_CropAndResize = 177, | |||||
| PrimType_Erf = 178, | |||||
| PrimType_StridedSliceGrad = 179, | |||||
| PrimType_IsFinite = 180, | |||||
| PrimType_LinSpace = 181, | |||||
| PrimType_UniformReal = 182, | |||||
| PrimType_AbsGrad = 183, | |||||
| PrimType_RsqrtGrad = 184, | |||||
| PrimType_SqrtGrad = 185, | |||||
| PrimType_LayerNormGrad = 186, | |||||
| PrimType_ResizeGrad = 187, | |||||
| PrimType_MIN = PrimType_NONE, | |||||
| PrimType_MAX = PrimType_ResizeGrad | |||||
| }; | |||||
| void RegInfer(int prim_type, InferShape func); | |||||
| #define REG_INFER(op, type, func) \ | |||||
| __attribute__((constructor)) void Reg##op##Infer() { RegInfer(type, func); } | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif // MINDSPORE_LITE_NNACL_INFER_INFER_REGISTER_H_ | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/invert_permutation_infer.h" | #include "nnacl/infer/invert_permutation_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int InvertPermutationInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int InvertPermutationInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -40,3 +41,5 @@ int InvertPermutationInferShape(const TensorC *const *inputs, size_t inputs_size | |||||
| SetShapeTensor(output, input); | SetShapeTensor(output, input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(InvertPermutation, PrimType_InvertPermutation, InvertPermutationInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/layer_norm_grad_infer.h" | #include "nnacl/infer/layer_norm_grad_infer.h" | ||||
| #include "nnacl/infer/common_infer.h" | #include "nnacl/infer/common_infer.h" | ||||
| #include "nnacl/fp32_grad/layernormgrad_parameter.h" | #include "nnacl/fp32_grad/layernormgrad_parameter.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int LayerNormGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int LayerNormGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -46,3 +47,5 @@ int LayerNormGradInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| output_dg->shape_size_ = size; | output_dg->shape_size_ = size; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(LayerNormGrad, PrimType_LayerNormGrad, LayerNormGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/layer_norm_infer.h" | #include "nnacl/infer/layer_norm_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int LayerNormInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int LayerNormInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -55,3 +56,5 @@ int LayerNormInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(LayerNormFusion, PrimType_LayerNormFusion, LayerNormInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/lin_space_infer.h" | #include "nnacl/infer/lin_space_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int LinSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int LinSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -41,3 +42,5 @@ int LinSpaceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| output->shape_[0] = num[0]; | output->shape_[0] = num[0]; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(LinSpace, PrimType_LinSpace, LinSpaceInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/lsh_projection_infer.h" | #include "nnacl/infer/lsh_projection_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int LshProjectionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int LshProjectionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -49,3 +50,5 @@ int LshProjectionInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| SetShapeArray(out_tensor, out_shape, out_shape_size); | SetShapeArray(out_tensor, out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(LshProjection, PrimType_LshProjection, LshProjectionInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/lstm_infer.h" | #include "nnacl/infer/lstm_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int LstmInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int LstmInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -63,3 +64,5 @@ int LstmInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(LSTM, PrimType_LSTM, LstmInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/matmul_infer.h" | #include "nnacl/infer/matmul_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MatmulInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int MatmulInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -84,3 +85,5 @@ int MatmulInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| SetShapeArray(output, c_shape, c_shape_size); | SetShapeArray(output, c_shape, c_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(MatMul, PrimType_MatMul, MatmulInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/maximum_grad_infer.h" | #include "nnacl/infer/maximum_grad_infer.h" | ||||
| #include "nnacl/arithmetic.h" | #include "nnacl/arithmetic.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MaximumGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int MaximumGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -58,3 +59,5 @@ int MaximumGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens | |||||
| SetDataTypeFormat(dx2, dy); | SetDataTypeFormat(dx2, dy); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(MaximumGrad, PrimType_MaximumGrad, MaximumGradInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/mean_infer.h" | #include "nnacl/infer/mean_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MeanInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int MeanInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/merge_infer.h" | #include "nnacl/infer/merge_infer.h" | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MergeAbleToInfer(const TensorC *const *inputs, size_t inputs_size) { | int MergeAbleToInfer(const TensorC *const *inputs, size_t inputs_size) { | ||||
| for (size_t i = 0; i < inputs_size; i++) { | for (size_t i = 0; i < inputs_size; i++) { | ||||
| @@ -94,3 +95,5 @@ int MergeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| return NNACL_INFER_INVALID; | return NNACL_INFER_INVALID; | ||||
| } | } | ||||
| REG_INFER(Merge, PrimType_Merge, MergeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/mfcc_infer.h" | #include "nnacl/infer/mfcc_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int MfccInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int MfccInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -44,3 +45,5 @@ int MfccInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| output->shape_[2] = param->dct_coeff_num_; | output->shape_[2] = param->dct_coeff_num_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Mfcc, PrimType_Mfcc, MfccInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/non_max_suppression_infer.h" | #include "nnacl/infer/non_max_suppression_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int NonMaxSuppressionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int NonMaxSuppressionInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -31,3 +32,5 @@ int NonMaxSuppressionInferShape(const TensorC *const *inputs, size_t inputs_size | |||||
| output->format_ = input->format_; | output->format_ = input->format_; | ||||
| return NNACL_INFER_INVALID; | return NNACL_INFER_INVALID; | ||||
| } | } | ||||
| REG_INFER(NonMaxSuppression, PrimType_NonMaxSuppression, NonMaxSuppressionInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/one_hot_infer.h" | #include "nnacl/infer/one_hot_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int OneHotInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int OneHotInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -54,3 +55,5 @@ int OneHotInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(OneHot, PrimType_OneHot, OneHotInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/pad_infer.h" | #include "nnacl/infer/pad_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PadInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PadInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -59,3 +60,5 @@ int PadInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou | |||||
| SetShapeArray(output, output_shape, output_shape_size); | SetShapeArray(output, output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Pad, PrimType_PadFusion, PadInferShape) | |||||
| @@ -15,8 +15,11 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/partial_infer.h" | #include "nnacl/infer/partial_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PartialInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PartialInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Partial, PrimType_PartialFusion, PartialInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/pooling_grad_infer.h" | #include "nnacl/infer/pooling_grad_infer.h" | ||||
| #include <math.h> | #include <math.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PoolingGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PoolingGradInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -60,3 +61,6 @@ int PoolingGradInferShape(const TensorC *const *inputs, size_t inputs_size, Tens | |||||
| SetShapeTensor(outputs[0], input); | SetShapeTensor(outputs[0], input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(AvgPoolGrad, PrimType_AvgPoolGrad, PoolingGradInferShape) | |||||
| REG_INFER(MaxPoolGrad, PrimType_MaxPoolGrad, PoolingGradInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/pooling_infer.h" | #include "nnacl/infer/pooling_infer.h" | ||||
| #include <math.h> | #include <math.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -81,3 +82,6 @@ int PoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeArray(output, input_shape, input_shape_size); | SetShapeArray(output, input_shape, input_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(MaxPool, PrimType_MaxPoolFusion, PoolingInferShape) | |||||
| REG_INFER(AvgPool, PrimType_AvgPoolFusion, PoolingInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/power_infer.h" | #include "nnacl/infer/power_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PowerInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PowerInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -52,3 +53,5 @@ int PowerInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| SetShapeTensor(output_tensor, x_tensor); | SetShapeTensor(output_tensor, x_tensor); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Pow, PrimType_PowFusion, PowerInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/prior_box_infer.h" | #include "nnacl/infer/prior_box_infer.h" | ||||
| #include <math.h> | #include <math.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int PriorBoxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int PriorBoxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -75,3 +76,5 @@ int PriorBoxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| output->shape_[3] = kPriorBoxC; | output->shape_[3] = kPriorBoxC; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(PriorBox, PrimType_PriorBox, PriorBoxInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/quant_dtype_cast_infer.h" | #include "nnacl/infer/quant_dtype_cast_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int QuantDtypeCastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int QuantDtypeCastInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -40,3 +41,5 @@ int QuantDtypeCastInferShape(const TensorC *const *inputs, size_t inputs_size, T | |||||
| SetShapeTensor(output, input); | SetShapeTensor(output, input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(QuantDTypeCast, PrimType_QuantDTypeCast, QuantDtypeCastInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/random_standard_normal_infer.h" | #include "nnacl/infer/random_standard_normal_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int RandomStandardNormalInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int RandomStandardNormalInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -44,3 +45,5 @@ int RandomStandardNormalInferShape(const TensorC *const *inputs, size_t inputs_s | |||||
| outputs[0]->format_ = inputs[0]->format_; | outputs[0]->format_ = inputs[0]->format_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(RandomStandardNormal, PrimType_RandomStandardNormal, RandomStandardNormalInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/range_infer.h" | #include "nnacl/infer/range_infer.h" | ||||
| #include <math.h> | #include <math.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -75,3 +76,5 @@ int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| output->shape_[0] = shape_size; | output->shape_[0] = shape_size; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Range, PrimType_Range, RangeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/rank_infer.h" | #include "nnacl/infer/rank_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int RankInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int RankInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -35,3 +36,5 @@ int RankInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| output->shape_[0] = 1; | output->shape_[0] = 1; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Rank, PrimType_Rank, RankInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/reduce_infer.h" | #include "nnacl/infer/reduce_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ReduceOnAllAxes(const TensorC *input, TensorC *output, int *out_shape, size_t out_shape_size, bool keep_dims) { | int ReduceOnAllAxes(const TensorC *input, TensorC *output, int *out_shape, size_t out_shape_size, bool keep_dims) { | ||||
| if (keep_dims) { | if (keep_dims) { | ||||
| @@ -111,3 +112,5 @@ int ReduceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| // reduce on selected axes | // reduce on selected axes | ||||
| return ReduceOnSelectedAxes(input, num_axes, actual_axes, output, out_shape, out_shape_size, keep_dims); | return ReduceOnSelectedAxes(input, num_axes, actual_axes, output, out_shape, out_shape_size, keep_dims); | ||||
| } | } | ||||
| REG_INFER(Reduce, PrimType_ReduceFusion, ReduceInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/reshape_infer.h" | #include "nnacl/infer/reshape_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| void CalShape(int *data, const TensorC *const *inputs, int *out_shape, size_t *out_shape_size, int shape_size) { | void CalShape(int *data, const TensorC *const *inputs, int *out_shape, size_t *out_shape_size, int shape_size) { | ||||
| int input_count = GetElementNum(inputs[0]); | int input_count = GetElementNum(inputs[0]); | ||||
| @@ -176,3 +177,5 @@ int ReshapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeArray(output, out_shape, out_shape_size); | SetShapeArray(output, out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Reshape, PrimType_Reshape, ReshapeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/resize_infer.h" | #include "nnacl/infer/resize_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int CalculateNewHeightAndWidth(const TensorC *const *inputs, size_t inputs_size, ResizeParameter *param) { | int CalculateNewHeightAndWidth(const TensorC *const *inputs, size_t inputs_size, ResizeParameter *param) { | ||||
| const TensorC *input = inputs[0]; | const TensorC *input = inputs[0]; | ||||
| @@ -138,3 +139,5 @@ int ResizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| REG_INFER(Resize, PrimType_Resize, ResizeInferShape) | |||||
| @@ -15,6 +15,8 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/rfft_infer.h" | #include "nnacl/infer/rfft_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int RfftInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int RfftInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| #ifdef Debug | #ifdef Debug | ||||
| @@ -37,3 +39,5 @@ int RfftInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| ShapePush(output->shape_, &(output->shape_size_), 2); | ShapePush(output->shape_, &(output->shape_size_), 2); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Rfft, PrimType_Rfft, RfftInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/roi_pooling_infer.h" | #include "nnacl/infer/roi_pooling_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ROIPoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ROIPoolingInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -41,3 +42,5 @@ int ROIPoolingInferShape(const TensorC *const *inputs, size_t inputs_size, Tenso | |||||
| output->shape_[3] = GetChannel(input); | output->shape_[3] = GetChannel(input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ROIPooling, PrimType_ROIPooling, ROIPoolingInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/scatter_nd_infer.h" | #include "nnacl/infer/scatter_nd_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ScatterNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ScatterNdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -40,3 +41,5 @@ int ScatterNdInferShape(const TensorC *const *inputs, size_t inputs_size, Tensor | |||||
| SetShapeArray(output, shape_data, GetElementNum(shape)); | SetShapeArray(output, shape_data, GetElementNum(shape)); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(ScatterNd, PrimType_ScatterNd, ScatterNdInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/select_infer.h" | #include "nnacl/infer/select_infer.h" | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SelectInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SelectInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -54,3 +55,5 @@ int SelectInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC * | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Select, PrimType_Select, SelectInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/sgd_infer.h" | #include "nnacl/infer/sgd_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SgdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SgdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -38,3 +39,5 @@ int SgdInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **ou | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SGD, PrimType_SGD, SgdInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/shape_infer.h" | #include "nnacl/infer/shape_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int ShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int ShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -37,3 +38,5 @@ int ShapeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| out_tensor->shape_[0] = (int)(in_tensor->shape_size_); | out_tensor->shape_[0] = (int)(in_tensor->shape_size_); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Shape, PrimType_Shape, ShapeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/size_infer.h" | #include "nnacl/infer/size_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -38,3 +39,5 @@ int SizeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SizeOp, PrimType_Size, SizeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/skip_gram_infer.h" | #include "nnacl/infer/skip_gram_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SkipGramInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SkipGramInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -34,3 +35,5 @@ int SkipGramInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SkipGram, PrimType_SkipGram, SkipGramInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/slice_infer.h" | #include "nnacl/infer/slice_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -79,3 +80,5 @@ int SliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Slice, PrimType_SliceFusion, SliceInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/softmax_cross_entropy_infer.h" | #include "nnacl/infer/softmax_cross_entropy_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SoftmaxCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int SoftmaxCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -43,3 +44,5 @@ int SoftmaxCrossEntropyInferShape(const TensorC *const *inputs, size_t inputs_si | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SoftmaxCrossEntropyWithLogits, PrimType_SoftmaxCrossEntropyWithLogits, SoftmaxCrossEntropyInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/softmax_infer.h" | #include "nnacl/infer/softmax_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SoftMaxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SoftMaxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -39,3 +40,5 @@ int SoftMaxInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeTensor(output, input); | SetShapeTensor(output, input); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Softmax, PrimType_Softmax, SoftMaxInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/space_to_batch_infer.h" | #include "nnacl/infer/space_to_batch_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SpaceToBatchInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SpaceToBatchInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -57,3 +58,5 @@ int SpaceToBatchInferShape(const TensorC *const *inputs, size_t inputs_size, Ten | |||||
| outputs[0]->shape_size_ = input->shape_size_; | outputs[0]->shape_size_ = input->shape_size_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SpaceToBatch, PrimType_SpaceToBatch, SpaceToBatchInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/space_to_batch_nd_infer.h" | #include "nnacl/infer/space_to_batch_nd_infer.h" | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SpaceSetOutputShapeFromParam(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int SpaceSetOutputShapeFromParam(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -133,3 +134,5 @@ int SpaceToBatchNdInferShape(const TensorC *const *inputs, size_t inputs_size, T | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SpaceToBatchND, PrimType_SpaceToBatchND, SpaceToBatchNdInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/space_to_depth_infer.h" | #include "nnacl/infer/space_to_depth_infer.h" | ||||
| #include <limits.h> | #include <limits.h> | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SpaceToDepthInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SpaceToDepthInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -57,3 +58,5 @@ int SpaceToDepthInferShape(const TensorC *const *inputs, size_t inputs_size, Ten | |||||
| outputs[0]->shape_size_ = input->shape_size_; | outputs[0]->shape_size_ = input->shape_size_; | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SpaceToDepth, PrimType_SpaceToDepth, SpaceToDepthInferShape) | |||||
| @@ -16,6 +16,7 @@ | |||||
| #include "nnacl/infer/sparse_softmax_cross_entropy_with_logits_infer.h" | #include "nnacl/infer/sparse_softmax_cross_entropy_with_logits_infer.h" | ||||
| #include "nnacl/fp32_grad/softmax_grad.h" | #include "nnacl/fp32_grad/softmax_grad.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SparseSoftmaxCrossEntropyWithLogitsInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | int SparseSoftmaxCrossEntropyWithLogitsInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, | ||||
| size_t outputs_size, OpParameter *parameter) { | size_t outputs_size, OpParameter *parameter) { | ||||
| @@ -41,3 +42,6 @@ int SparseSoftmaxCrossEntropyWithLogitsInferShape(const TensorC *const *inputs, | |||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SparseSoftmaxCrossEntropyWithLogits, PrimType_SparseSoftmaxCrossEntropyWithLogits, | |||||
| SparseSoftmaxCrossEntropyWithLogitsInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/sparse_to_dense_infer.h" | #include "nnacl/infer/sparse_to_dense_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SparseToDenseInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SparseToDenseInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -41,3 +42,5 @@ int SparseToDenseInferShape(const TensorC *const *inputs, size_t inputs_size, Te | |||||
| SetShapeArray(output, output_shape, output_shape_size); | SetShapeArray(output, output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(SparseToDense, PrimType_SparseToDense, SparseToDenseInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/splice_infer.h" | #include "nnacl/infer/splice_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SpliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SpliceInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/split_infer.h" | #include "nnacl/infer/split_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SplitInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SplitInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -78,3 +79,5 @@ int SplitInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| } | } | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Split, PrimType_Split, SplitInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/squeeze_infer.h" | #include "nnacl/infer/squeeze_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int SqueezeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int SqueezeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -59,3 +60,5 @@ int SqueezeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC | |||||
| SetShapeArray(outputs[0], out_shape, out_shape_size); | SetShapeArray(outputs[0], out_shape, out_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Squeeze, PrimType_Squeeze, SqueezeInferShape) | |||||
| @@ -15,6 +15,7 @@ | |||||
| */ | */ | ||||
| #include "nnacl/infer/stack_infer.h" | #include "nnacl/infer/stack_infer.h" | ||||
| #include "nnacl/infer/infer_register.h" | |||||
| int StackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | int StackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **outputs, size_t outputs_size, | ||||
| OpParameter *parameter) { | OpParameter *parameter) { | ||||
| @@ -55,3 +56,5 @@ int StackInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC ** | |||||
| SetShapeArray(outputs[0], output_shape, output_shape_size); | SetShapeArray(outputs[0], output_shape, output_shape_size); | ||||
| return NNACL_OK; | return NNACL_OK; | ||||
| } | } | ||||
| REG_INFER(Stack, PrimType_Stack, StackInferShape) | |||||