add some ops

pull/11945/head
jinyaohui 4 years ago
parent f9d9bba927
commit d9be0c102d

@ -333,14 +333,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(mindspore mindspore::pybind11_module)
target_link_libraries(mindspore mindspore_gvar)
target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore -Wl,--no-whole-archive)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_link_libraries(mindspore mindspore::pybind11_module)
target_link_libraries(mindspore mindspore_gvar)
target_link_libraries(_c_expression PRIVATE -Wl,-force_load mindspore -Wl,-noall_load)
else()
if(ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
target_link_libraries(mindspore mindspore::pslite proto_input mindspore::protobuf
mindspore::event mindspore::event_pthreads ${zeromq_DIRPATH}/zmq_install/lib/libzmq.a)
else ()
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
target_link_libraries(mindspore mindspore::pslite proto_input mindspore::protobuf mindspore::event mindspore::event_pthreads ${zeromq_DIRPATH}/zmq_install/lib/libzmq.a)
target_link_libraries(mindspore -Wl,--no-as-needed mindspore::event_core ps_cache)
if(${ENABLE_IBVERBS} STREQUAL "ON")
target_link_libraries(mindspore ibverbs rdmacm)

@ -717,7 +717,7 @@ std::unordered_set<PrimitivePtr> GetExpandOps() {
prim::kPrimMinimumGrad,
prim::kPrimGkDropout,
prim::kPrimDropoutGrad,
prim::kPrimSoftMax,
prim::kPrimSoftmax,
prim::kPrimLayerNorm,
prim::kPrimLayerNormGrad,
#endif

@ -20,7 +20,7 @@
#include <unordered_map>
#include <utility>
#include "c_ops/primitive_c.h"
#include "ops/primitive_c.h"
#include "ir/manager.h"
#include "abstract/utils.h"
#include "backend/kernel_compiler/common_utils.h"
@ -1750,8 +1750,8 @@ void SessionBasic::RunInfer(NotNull<FuncGraphPtr> func_graph, const std::vector<
input_abstracts.emplace_back(abstract);
}
auto prim = AnfAlgo::GetCNodePrimitive(node);
if (prim->isa<PrimitiveC>()) {
auto prim_c = prim->cast<std::shared_ptr<PrimitiveC>>();
if (prim->isa<ops::PrimitiveC>()) {
auto prim_c = prim->cast<std::shared_ptr<ops::PrimitiveC>>();
MS_EXCEPTION_IF_NULL(prim_c);
auto abstract = prim_c->Infer(input_abstracts);
node->set_abstract(abstract);

@ -10,11 +10,11 @@ message("************ build core ***************")
file(GLOB_RECURSE CORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"abstract/*.cc"
"base/*.cc"
"c_ops/*.cc"
"ops/*.cc"
"ir/*.cc"
"utils/*.cc"
"load_mindir/*.cc"
)
)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
add_compile_definitions(BUILDING_DLL)

File diff suppressed because it is too large Load Diff

@ -1,19 +0,0 @@
/**
* 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 "c_ops/abs.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameAbs, Abs);
} // namespace mindspore

@ -1,51 +0,0 @@
/**
* 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 "c_ops/apply_momentum.h"
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
namespace mindspore {
void ApplyMomentum::Init(bool use_nesterov, bool use_locking, float gradient_scale) {
this->set_use_nesterov(use_nesterov);
this->set_use_locking(use_locking);
this->set_gradient_scale(gradient_scale);
}
void ApplyMomentum::set_use_nesterov(bool use_nesterov) { this->AddAttr(kUseNesterov, MakeValue(use_nesterov)); }
void ApplyMomentum::set_use_locking(bool use_locking) { this->AddAttr(kUseLocking, MakeValue(use_locking)); }
void ApplyMomentum::set_gradient_scale(float gradient_scale) {
this->AddAttr(kGradientScale, MakeValue(gradient_scale));
}
bool ApplyMomentum::get_use_nesterov() const {
auto value_ptr = GetAttr(kUseNesterov);
return GetValue<bool>(value_ptr);
}
bool ApplyMomentum::get_use_locking() const {
auto value_ptr = GetAttr(kUseLocking);
return GetValue<bool>(value_ptr);
}
float ApplyMomentum::get_gradient_scale() {
auto value_ptr = GetAttr(kGradientScale);
return GetValue<float>(value_ptr);
}
REGISTER_PRIMITIVE_C(kNameApplyMomentum, ApplyMomentum);
} // namespace mindspore

@ -1,54 +0,0 @@
/**
* 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 "c_ops/audio_spectrogram.h"
#include <string>
#include <algorithm>
#include <memory>
#include <set>
#include <vector>
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
#include "abstract/primitive_infer_map.h"
namespace mindspore {
void AudioSpectrogram::set_window_size(const int64_t &window_size) {
this->AddAttr(kWindowSize, MakeValue(window_size));
}
int64_t AudioSpectrogram::get_window_size() const {
auto value_ptr = GetAttr(kWindowSize);
return GetValue<int64_t>(value_ptr);
}
void AudioSpectrogram::set_stride(const int64_t &stride) { this->AddAttr(kStride, MakeValue(stride)); }
int64_t AudioSpectrogram::get_stride() const {
auto value_ptr = GetAttr(kStride);
return GetValue<int64_t>(value_ptr);
}
void AudioSpectrogram::set_mag_square(const bool &mag_square) { this->AddAttr(kMagSquare, MakeValue(mag_square)); }
bool AudioSpectrogram::get_mag_square() const {
auto value_ptr = GetAttr(kMagSquare);
return GetValue<bool>(value_ptr);
}
void AudioSpectrogram::Init(const int64_t &window_size, const int64_t &stride, const bool &mag_square) {
this->set_window_size(window_size);
this->set_stride(stride);
this->set_mag_square(mag_square);
}
REGISTER_PRIMITIVE_C(kNameAudioSpectrogram, AudioSpectrogram);
} // namespace mindspore

@ -1,59 +0,0 @@
/**
* 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 <string>
#include <algorithm>
#include <memory>
#include <set>
#include <vector>
#include "c_ops/batch_norm.h"
#include "abstract/primitive_infer_map.h"
#include "utils/check_convert_utils.h"
namespace mindspore {
void BatchNorm::Init(bool is_training, float epsilon, const Format &format) {
set_is_training(is_training);
set_epsilon(epsilon);
set_format(format);
}
void BatchNorm::set_is_training(bool is_training) { this->AddAttr(kIsTraining, MakeValue(is_training)); }
void BatchNorm::set_epsilon(float epsilon) {
CheckAndConvertUtils::CheckInRange(kEpsilon, epsilon, kIncludeBoth, {0.0, 1.0}, this->name());
this->AddAttr(kEpsilon, MakeValue(epsilon));
}
void BatchNorm::set_format(const Format &format) {
int64_t f = format;
this->AddAttr(kFormat, MakeValue(f));
}
bool BatchNorm::get_is_trainging() {
auto value_ptr = GetAttr(kIsTraining);
return GetValue<bool>(value_ptr);
}
float BatchNorm::get_epsilon() {
auto value_ptr = GetAttr(kEpsilon);
return GetValue<float>(value_ptr);
}
Format BatchNorm::get_format() const {
auto value_ptr = GetAttr(kFormat);
return Format(GetValue<int64_t>(value_ptr));
}
REGISTER_PRIMITIVE_C(kNameBatchNorm, BatchNorm);
} // namespace mindspore

@ -1,21 +0,0 @@
/**
* 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 "c_ops/batch_norm_fold.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameBatchNormFold, BatchNormFold);
} // namespace mindspore

@ -1,31 +0,0 @@
/**
* 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 "c_ops/binary_cross_entropy_grad.h"
namespace mindspore {
void BinaryCrossEntropyGrad::Init(const std::string &reduction) { set_reduction(reduction); }
void BinaryCrossEntropyGrad::set_reduction(const std::string &reduction) {
CheckAndConvertUtils::CheckString(kReduction, reduction, {"none", "mean", "sum"}, name());
this->AddAttr(kReduction, MakeValue(reduction));
}
std::string BinaryCrossEntropyGrad::get_reduction() const {
auto value_ptr = GetAttr(kReduction);
return GetValue<std::string>(value_ptr);
}
REGISTER_PRIMITIVE_C(kNameBinaryCrossEntropyGrad, BinaryCrossEntropyGrad);
} // namespace mindspore

@ -1,42 +0,0 @@
/**
* 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 "c_ops/broadcast.h"
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
namespace mindspore {
void Broadcast::Init(int64_t root_rank, const std::string &group) {
this->set_root_rank(root_rank);
this->set_group(group);
}
void Broadcast::set_root_rank(int64_t root_rank) { this->AddAttr(kKeepProb, MakeValue(root_rank)); }
void Broadcast::set_group(const std::string &group) {
CheckAndConvertUtils::CheckString(kGroup, group, {"hccl_world_group", "hccl_world_group"}, this->name());
this->AddAttr(kGroup, MakeValue(group));
}
int64_t Broadcast::get_root_rank() {
auto value_ptr = this->GetAttr(kRootRank);
return GetValue<float>(value_ptr);
}
std::string Broadcast::get_group() const {
auto value_ptr = this->GetAttr(kGroup);
return GetValue<std::string>(value_ptr);
}
REGISTER_PRIMITIVE_C(kNameBroadcast, Broadcast);
} // namespace mindspore

@ -1,21 +0,0 @@
/**
* 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 "c_ops/ceil.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameCeil, Ceil);
}

@ -1,21 +0,0 @@
/**
* 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 "c_ops/cos.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameCos, Cos);
}

@ -1,44 +0,0 @@
/**
* 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 "c_ops/custom_predict.h"
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
#include "abstract/primitive_infer_map.h"
namespace mindspore {
void CustomPredict::Init(int64_t outputNum, float weight_threshold) {
this->set_outputNum(outputNum);
this->set_weight_threshold(weight_threshold);
}
void CustomPredict::set_outputNum(int64_t outputNum) { this->AddAttr(kOutputNum, MakeValue(outputNum)); }
int64_t CustomPredict::get_outputNum() const {
auto value_ptr = this->GetAttr(kOutputNum);
return GetValue<int64_t>(value_ptr);
}
void CustomPredict::set_weight_threshold(float weight_threshold) {
this->AddAttr(kWeightThreshold, MakeValue(weight_threshold));
}
float CustomPredict::get_weight_threshold() const {
auto value_ptr = this->GetAttr(kWeightThreshold);
return GetValue<float>(value_ptr);
}
REGISTER_PRIMITIVE_C(kNameCustomPredict, CustomPredict);
} // namespace mindspore

@ -1,21 +0,0 @@
/**
* 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 "c_ops/div.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameDiv, Div);
} // namespace mindspore

@ -1,20 +0,0 @@
/**
* 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 "c_ops/equal.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameEqual, Equal);
} // namespace mindspore

@ -1,20 +0,0 @@
/**
* 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 "c_ops/exp.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameExp, Exp);
} // namespace mindspore

@ -1,44 +0,0 @@
/**
* 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 "c_ops/fake_quant_with_min_max_vars.h"
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
#include "abstract/primitive_infer_map.h"
namespace mindspore {
void FakeQuantWithMinMaxVars::Init(const bool &narrow_range, int64_t num_bits) {
this->set_narrow_range(narrow_range);
this->set_num_bits(num_bits);
}
void FakeQuantWithMinMaxVars::set_narrow_range(const bool &narrow_range) {
this->AddAttr(kNarrowRange, MakeValue(narrow_range));
}
bool FakeQuantWithMinMaxVars::get_narrow_range() const {
auto value_ptr = this->GetAttr(kNarrowRange);
return GetValue<bool>(value_ptr);
}
void FakeQuantWithMinMaxVars::set_num_bits(int64_t num_bits) { this->AddAttr(kNumBits, MakeValue(num_bits)); }
int64_t FakeQuantWithMinMaxVars::get_num_bits() const {
auto value_ptr = this->GetAttr(kNumBits);
return GetValue<int64_t>(value_ptr);
}
REGISTER_PRIMITIVE_C(kNameFakeQuantWithMinMaxVars, FakeQuantWithMinMaxVars);
} // namespace mindspore

@ -1,22 +0,0 @@
/**
* 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 "c_ops/fft_imag.h"
#include <memory>
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameFftImag, FftImag);
}

@ -1,21 +0,0 @@
/**
* 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 "c_ops/flatten_grad.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameFlattenGrad, FlattenGrad);
}

@ -1,22 +0,0 @@
/**
* 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 "c_ops/hashtable_lookup.h"
#include "utils/check_convert_utils.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameHashtableLookup, HashtableLookup);
} // namespace mindspore

@ -1,21 +0,0 @@
/**
* 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 "c_ops/less.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameLess, Less);
}

@ -1,20 +0,0 @@
/**
* 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 "c_ops/less_equal.h"
namespace mindspore {
REGISTER_PRIMITIVE_C(kNameLessEqual, LessEqual);
} // namespace mindspore

@ -1,65 +0,0 @@
/**
* 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 "c_ops/local_response_normalization.h"
#include <string>
#include <algorithm>
#include <memory>
#include <set>
#include <vector>
#include "c_ops/op_utils.h"
#include "utils/check_convert_utils.h"
#include "abstract/primitive_infer_map.h"
namespace mindspore {
void LocalResponseNormalization::set_depth_radius(const int64_t &depth_radius) {
this->AddAttr(kDepthRadius, MakeValue(depth_radius));
}
int64_t LocalResponseNormalization::get_depth_radius() const {
auto value_ptr = GetAttr(kDepthRadius);
return GetValue<int64_t>(value_ptr);
}
void LocalResponseNormalization::set_bias(const float &bias) { this->AddAttr(kBias, MakeValue(bias)); }
float LocalResponseNormalization::get_bias() const {
auto value_ptr = GetAttr(kBias);
return GetValue<float>(value_ptr);
}
void LocalResponseNormalization::set_alpha(const float &alpha) { this->AddAttr(kAlpha, MakeValue(alpha)); }
float LocalResponseNormalization::get_alpha() const {
auto value_ptr = GetAttr(kAlpha);
return GetValue<float>(value_ptr);
}
void LocalResponseNormalization::set_beta(const float &beta) { this->AddAttr(kBeta, MakeValue(beta)); }
float LocalResponseNormalization::get_beta() const {
auto value_ptr = GetAttr(kBeta);
return GetValue<float>(value_ptr);
}
void LocalResponseNormalization::Init(const int64_t &depth_radius, const float &bias, const float &alpha,
const float &beta) {
this->set_depth_radius(depth_radius);
this->set_bias(bias);
this->set_alpha(alpha);
this->set_beta(beta);
}
REGISTER_PRIMITIVE_C(kNameLocalResponseNormalization, LocalResponseNormalization);
} // namespace mindspore

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save