From cb95589f0d6ebfee241d597005ac9b473b303e35 Mon Sep 17 00:00:00 2001 From: kai00 Date: Fri, 7 Aug 2020 19:23:29 +0800 Subject: [PATCH] fix bias add --- mindspore/lite/src/populate_parameter.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mindspore/lite/src/populate_parameter.cc b/mindspore/lite/src/populate_parameter.cc index 22e5b42deb5..26b532da8f3 100644 --- a/mindspore/lite/src/populate_parameter.cc +++ b/mindspore/lite/src/populate_parameter.cc @@ -1227,6 +1227,17 @@ OpParameter *PopulateEmbeddingLookupParameter(const lite::Primitive *primitive) return reinterpret_cast(embedding_lookup_parameter); } +OpParameter *PopulateBiasAddParameter(const lite::Primitive *primitive) { + ArithmeticParameter *arithmetic_param = new (std::nothrow) ArithmeticParameter(); + if (arithmetic_param == nullptr) { + MS_LOG(ERROR) << "new Bias Add Parameter failed"; + return nullptr; + } + arithmetic_param->op_parameter_.type_ = primitive->Type(); + + return reinterpret_cast(arithmetic_param); +} + PopulateParameterRegistry::PopulateParameterRegistry() { populate_parameter_funcs_[schema::PrimitiveType_SoftMax] = PopulateSoftmaxParameter; populate_parameter_funcs_[schema::PrimitiveType_Activation] = PopulateActivationParameter; @@ -1251,7 +1262,7 @@ PopulateParameterRegistry::PopulateParameterRegistry() { populate_parameter_funcs_[schema::PrimitiveType_FloorDiv] = PopulateArithmetic; populate_parameter_funcs_[schema::PrimitiveType_FloorMod] = PopulateArithmetic; populate_parameter_funcs_[schema::PrimitiveType_SquaredDifference] = PopulateArithmetic; - populate_parameter_funcs_[schema::PrimitiveType_BiasAdd] = PopulateArithmetic; + populate_parameter_funcs_[schema::PrimitiveType_BiasAdd] = PopulateBiasAddParameter; populate_parameter_funcs_[schema::PrimitiveType_Eltwise] = PopulateEltwiseParameter; populate_parameter_funcs_[schema::PrimitiveType_ExpandDims] = PopulateExpandDimsParameter; populate_parameter_funcs_[schema::PrimitiveType_Abs] = PopulateArithmeticSelf;