From a1370d8d7ba1c913cc04a2ae15e85e734242ba25 Mon Sep 17 00:00:00 2001 From: l00591931 Date: Fri, 5 Mar 2021 10:42:16 +0800 Subject: [PATCH] Change set_in_channel --- mindspore/core/ops/conv2d_transpose.cc | 2 +- mindspore/core/ops/is_finite.cc | 24 +++++++++++++ mindspore/core/ops/is_finite.h | 37 +++++++++++++++++++++ mindspore/core/utils/check_convert_utils.cc | 10 ------ 4 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 mindspore/core/ops/is_finite.cc create mode 100644 mindspore/core/ops/is_finite.h diff --git a/mindspore/core/ops/conv2d_transpose.cc b/mindspore/core/ops/conv2d_transpose.cc index 281e5e38a0..ea41d32ba3 100644 --- a/mindspore/core/ops/conv2d_transpose.cc +++ b/mindspore/core/ops/conv2d_transpose.cc @@ -67,7 +67,7 @@ void Conv2dTranspose::Init(int64_t in_channel, int64_t out_channel, const std::v } void Conv2dTranspose::set_in_channel(int64_t in_channel) { - AddAttr(kOutChannel, MakeValue(CheckAndConvertUtils::CheckInteger(kInChannel, in_channel, kGreaterThan, 0, name()))); + AddAttr(kInChannel, MakeValue(CheckAndConvertUtils::CheckInteger(kInChannel, in_channel, kGreaterThan, 0, name()))); } void Conv2dTranspose::set_out_channel(int64_t out_channel) { diff --git a/mindspore/core/ops/is_finite.cc b/mindspore/core/ops/is_finite.cc new file mode 100644 index 0000000000..7654b81b10 --- /dev/null +++ b/mindspore/core/ops/is_finite.cc @@ -0,0 +1,24 @@ +/** + * Copyright 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 "ops/is_finite.h" +#include "ops/op_utils.h" + +namespace mindspore { +namespace ops { +REGISTER_PRIMITIVE_C(kNameIsFinite, IsFinite); +} // namespace ops +} // namespace mindspore diff --git a/mindspore/core/ops/is_finite.h b/mindspore/core/ops/is_finite.h new file mode 100644 index 0000000000..8f73b7c24a --- /dev/null +++ b/mindspore/core/ops/is_finite.h @@ -0,0 +1,37 @@ +/** + * Copyright 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. + */ + +#ifndef MINDSPORE_CORE_OPS_IS_FINITE_H_ +#define MINDSPORE_CORE_OPS_IS_FINITE_H_ + +#include "ops/primitive_c.h" +#include "abstract/abstract_value.h" +#include "utils/check_convert_utils.h" + +namespace mindspore { +namespace ops { +constexpr auto kNameIsFinite = "IsFinite"; +class IsFinite : public PrimitiveC { + public: + IsFinite() : PrimitiveC(kNameIsFinite) {} + ~IsFinite() = default; + MS_DECLARE_PARENT(IsFinite, PrimitiveC); + void Init() {} +}; +} // namespace ops +} // namespace mindspore + +#endif // MINDSPORE_CORE_OPS_IS_FINITE_H_ diff --git a/mindspore/core/utils/check_convert_utils.cc b/mindspore/core/utils/check_convert_utils.cc index a858b51b01..79b3b89034 100644 --- a/mindspore/core/utils/check_convert_utils.cc +++ b/mindspore/core/utils/check_convert_utils.cc @@ -301,16 +301,6 @@ std::vector CheckAndConvertUtils::CheckPositiveVector(const std::string raise_message(); } } - // if (arg_value.size() == 1) { - // return ret_four ? std::vector{1, 1, arg_value[0], arg_value[0]} - // : std::vector{arg_value[0], arg_value[0]}; - // } - // if (arg_value.size() == 2) { - // return ret_four ? std::vector{1, 1, arg_value[0], arg_value[1]} : arg_value; - // } else if (arg_value.size() == 4 && allow_four) { - // return ret_four ? arg_value : std::vector{arg_value[2], arg_value[3]}; - // } - // raise_message(); return arg_value; }