parent
c5867d2d7e
commit
7945bbf9f2
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/add.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "src/ops/populate/populate_register.h"
|
||||
#include "nnacl/arithmetic_common.h"
|
||||
#include "src/ops/populate/arithmetic_populate.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
OpParameter *PopulateAddParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
|
||||
if (param == nullptr) {
|
||||
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
|
||||
return nullptr;
|
||||
}
|
||||
param->activation_type_ = reinterpret_cast<const mindspore::lite::Add *>(primitive)->GetActivationType();
|
||||
return reinterpret_cast<OpParameter *>(param);
|
||||
}
|
||||
Registry AddParameterRegistry(schema::PrimitiveType_Add, PopulateAddParameter);
|
||||
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
ArithmeticParameter *PopulateArithmeticCommonPara(const mindspore::lite::PrimitiveC *primitive);
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/div.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "src/ops/populate/populate_register.h"
|
||||
#include "src/ops/populate/arithmetic_populate.h"
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
OpParameter *PopulateDivParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
|
||||
if (param == nullptr) {
|
||||
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
|
||||
return nullptr;
|
||||
}
|
||||
param->activation_type_ = reinterpret_cast<const mindspore::lite::Div *>(primitive)->GetActivationType();
|
||||
return reinterpret_cast<OpParameter *>(param);
|
||||
}
|
||||
|
||||
Registry DivParameterRegistry(schema::PrimitiveType_Div, PopulateDivParameter);
|
||||
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/div.h"
|
||||
#include "src/ops/eltwise.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "src/ops/populate/populate_register.h"
|
||||
#include "src/ops/populate/arithmetic_populate.h"
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
OpParameter *PopulateEltwiseParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
|
||||
if (param == nullptr) {
|
||||
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
|
||||
return nullptr;
|
||||
}
|
||||
auto eltwise = reinterpret_cast<const mindspore::lite::Eltwise *>(primitive);
|
||||
switch (eltwise->GetMode()) {
|
||||
case schema::EltwiseMode_PROD:
|
||||
param->op_parameter_.type_ = schema::PrimitiveType_Mul;
|
||||
break;
|
||||
case schema::EltwiseMode_SUM:
|
||||
param->op_parameter_.type_ = schema::PrimitiveType_Add;
|
||||
break;
|
||||
case schema::EltwiseMode_MAXIMUM:
|
||||
param->op_parameter_.type_ = schema::PrimitiveType_Maximum;
|
||||
break;
|
||||
default:
|
||||
free(param);
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<OpParameter *>(param);
|
||||
}
|
||||
|
||||
Registry EltwiseParameterRegistry(schema::PrimitiveType_Eltwise, PopulateEltwiseParameter);
|
||||
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/mul.h"
|
||||
#include "nnacl/arithmetic_common.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "src/ops/populate/populate_register.h"
|
||||
#include "src/ops/populate/arithmetic_populate.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
OpParameter *PopulateMulParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
|
||||
if (param == nullptr) {
|
||||
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
|
||||
return nullptr;
|
||||
}
|
||||
param->activation_type_ = reinterpret_cast<const mindspore::lite::Mul *>(primitive)->GetActivationType();
|
||||
return reinterpret_cast<OpParameter *>(param);
|
||||
}
|
||||
|
||||
Registry MulParameterRegistry(schema::PrimitiveType_Mul, PopulateMulParameter);
|
||||
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright 2019-2020 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 "src/ops/sub.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "src/ops/populate/populate_register.h"
|
||||
#include "nnacl/arithmetic_common.h"
|
||||
#include "src/ops/populate/arithmetic_populate.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
||||
OpParameter *PopulateSubParameter(const mindspore::lite::PrimitiveC *primitive) {
|
||||
ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive);
|
||||
if (param == nullptr) {
|
||||
MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed.";
|
||||
return nullptr;
|
||||
}
|
||||
param->activation_type_ = reinterpret_cast<const mindspore::lite::Sub *>(primitive)->GetActivationType();
|
||||
return reinterpret_cast<OpParameter *>(param);
|
||||
}
|
||||
|
||||
Registry SubParameterRegistry(schema::PrimitiveType_Sub, PopulateSubParameter);
|
||||
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue