forked from mindspore-Ecosystem/mindspore
add attr rename and op type rename for ascend vm op adapter
This commit is contained in:
parent
36021869f4
commit
03d1165618
|
@ -20,7 +20,7 @@
|
|||
"mindspore/mindspore/ccsrc/runtime/hardware/device_context.h" "readability/braces"
|
||||
"mindspore/mindspore/ccsrc/transform/graph_ir/convert.h" "runtime/references"
|
||||
"mindspore/mindspore/ccsrc/plugin/device/ascend/kernel/aicpu/aicpu_ops/gather_grad_kernels.cc" "build/include"
|
||||
"mindspore/mindspore/ccsrc/backend/common/optimizer/const_input_to_attr_factory.h" "runtime/explicit"
|
||||
"mindspore/mindspore/ccsrc/backend/common/optimizer/op_adaptation_info_factory.h" "runtime/explicit"
|
||||
|
||||
# Modelzoo
|
||||
"mindspore/model_zoo/official/cv/yolov4_tiny/infer/mxbase/src/Yolov4TinyDetection.h" "runtime/references"
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/**
|
||||
* Copyright 2022 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_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
||||
#define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include "ir/anf.h"
|
||||
#include "utils/hash_map.h"
|
||||
#include "utils/hash_set.h"
|
||||
#include "utils/ms_utils.h"
|
||||
#include "utils/ms_context.h"
|
||||
#include "include/backend/visible.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
class InputAttrInfo {
|
||||
public:
|
||||
explicit InputAttrInfo(const size_t input_index, const std::string attr_name, const std::string attr_data_type)
|
||||
: input_index_(input_index), attr_name_(attr_name), attr_data_type_(attr_data_type) {}
|
||||
virtual ~InputAttrInfo() = default;
|
||||
|
||||
size_t GetInputIndex() const { return input_index_; }
|
||||
std::string GetAttrName() const { return attr_name_; }
|
||||
std::string GetAttrDataType() const { return attr_data_type_; }
|
||||
|
||||
private:
|
||||
size_t input_index_;
|
||||
std::string attr_name_;
|
||||
std::string attr_data_type_;
|
||||
};
|
||||
|
||||
class ConvertOpInfo {
|
||||
public:
|
||||
explicit ConvertOpInfo(const std::string &origin_op_name, const std::string &target_op_name,
|
||||
const std::string &device_name, bool is_dynamic_shape = false)
|
||||
: origin_op_name_(origin_op_name),
|
||||
target_op_name_(target_op_name),
|
||||
device_name_(device_name),
|
||||
is_dynamic_shape_(is_dynamic_shape) {}
|
||||
|
||||
explicit ConvertOpInfo(const ConvertOpInfo &convert_op_info)
|
||||
: origin_op_name_(convert_op_info.origin_op_name_),
|
||||
target_op_name_(convert_op_info.target_op_name_),
|
||||
pre_check_func_(convert_op_info.pre_check_func_),
|
||||
need_check_supported_(convert_op_info.need_check_supported_),
|
||||
input_attr_map_(convert_op_info.input_attr_map_),
|
||||
device_name_(convert_op_info.device_name_),
|
||||
is_dynamic_shape_(convert_op_info.is_dynamic_shape_) {}
|
||||
|
||||
virtual ~ConvertOpInfo() = default;
|
||||
|
||||
ConvertOpInfo &SetTargetOpName(std::string target_op_name) {
|
||||
target_op_name_ = target_op_name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConvertOpInfo &SetPreCheckFunc(std::function<bool(CNodePtr)> pre_check_func) {
|
||||
pre_check_func_ = pre_check_func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConvertOpInfo &SetNeedCheckSupported(bool need_check_supported) {
|
||||
need_check_supported_ = need_check_supported;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ConvertOpInfo &SetInputAttrInfo(size_t input_index, std::string attr_name = "", std::string attr_dtype = "") {
|
||||
auto find = input_attr_map_.find(input_index);
|
||||
if (find != input_attr_map_.end()) {
|
||||
MS_LOG(ERROR) << "This input index (" << input_index << ")"
|
||||
<< " has been registered.";
|
||||
return *this;
|
||||
}
|
||||
input_attr_map_.insert(std::make_pair(input_index, InputAttrInfo(input_index, attr_name, attr_dtype)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string GetOriginOpName() const { return origin_op_name_; }
|
||||
std::string GetTargetOpName() const { return target_op_name_; }
|
||||
std::function<bool(CNodePtr)> GetPreCheckFunc() const { return pre_check_func_; }
|
||||
bool GetNeedCheckFlag() const { return need_check_supported_; }
|
||||
std::map<size_t, InputAttrInfo> GetInputAttrInfoMap() const { return input_attr_map_; }
|
||||
std::string GetDeviceName() const { return device_name_; }
|
||||
bool IsDynamicShape() const { return is_dynamic_shape_; }
|
||||
|
||||
private:
|
||||
std::string origin_op_name_;
|
||||
std::string target_op_name_;
|
||||
std::function<bool(CNodePtr)> pre_check_func_{nullptr};
|
||||
bool need_check_supported_{false};
|
||||
std::map<size_t, InputAttrInfo> input_attr_map_;
|
||||
std::string device_name_;
|
||||
bool is_dynamic_shape_{false};
|
||||
};
|
||||
|
||||
class BACKEND_EXPORT ConvertOpInfoRegister {
|
||||
public:
|
||||
static ConvertOpInfoRegister &GetInstance();
|
||||
void RegConvertOpInfo(ConvertOpInfo *reg_info);
|
||||
[[nodiscard]] ConvertOpInfo *GetConvertOpInfo(const std::string &origin_op_name, const std::string &device_name,
|
||||
bool is_dynamic_shape) const;
|
||||
|
||||
private:
|
||||
ConvertOpInfoRegister() = default;
|
||||
~ConvertOpInfoRegister() = default;
|
||||
DISABLE_COPY_AND_ASSIGN(ConvertOpInfoRegister)
|
||||
|
||||
static std::string GenerateKey(const std::string &op_name, const std::string &device_name, bool is_dynamic_shape);
|
||||
// key: (op_name + device_name + is_dynamic), value: <ConvertOpInfo *>
|
||||
std::map<std::string, ConvertOpInfo *> op_info_map_;
|
||||
};
|
||||
|
||||
class RegisterHelper {
|
||||
public:
|
||||
RegisterHelper(const std::string &name, const std::string &device_name, bool is_dynamic_shape, int len, ...);
|
||||
RegisterHelper(const ConvertOpInfo &convert_op_info);
|
||||
~RegisterHelper() = default;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ConvertOpInfo> convert_op_info_{nullptr};
|
||||
};
|
||||
|
||||
#define REG_CONST_TO_ATTR(origin_op_name, target_op_name, device_name, dynamic) \
|
||||
static opt::RegisterHelper g_reg_##device_name##_##dynamic##_##origin_op_name##_##target_op_name \
|
||||
__attribute__((unused)) = opt::ConvertOpInfo(origin_op_name, target_op_name, device_name, dynamic)
|
||||
|
||||
#define RER_CONST_TO_ATTR_LIST(origin_op_name, backend, dynamic, ...) \
|
||||
static opt::RegisterHelper g_reg_##backend##_##dynamic##_##origin_op_name( \
|
||||
origin_op_name, backend, dynamic, std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value, __VA_ARGS__)
|
||||
} // namespace mindspore::opt
|
||||
#endif // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
|
||||
#include <memory>
|
||||
#include "kernel/oplib/oplib.h"
|
||||
|
@ -21,41 +21,41 @@
|
|||
#include "utils/log_adapter.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
ConvertOpInfoRegister &ConvertOpInfoRegister::GetInstance() {
|
||||
static ConvertOpInfoRegister inst;
|
||||
OpAdaptationInfoRegister &OpAdaptationInfoRegister::GetInstance() {
|
||||
static OpAdaptationInfoRegister inst;
|
||||
return inst;
|
||||
}
|
||||
|
||||
std::string ConvertOpInfoRegister::GenerateKey(const std::string &op_name, const std::string &device_name,
|
||||
bool is_dynamic_shape) {
|
||||
std::string OpAdaptationInfoRegister::GenerateKey(const std::string &op_name, const std::string &device_name,
|
||||
bool flag) {
|
||||
if (device_name != kCPUDevice && device_name != kGPUDevice && device_name != kAscendDevice) {
|
||||
MS_LOG(ERROR) << "Backend type is error, " << device_name;
|
||||
}
|
||||
|
||||
std::string is_dynamic_shape_str = is_dynamic_shape ? "true" : "false";
|
||||
return std::string(op_name + device_name + is_dynamic_shape_str);
|
||||
std::string flag_str = flag ? "true" : "false";
|
||||
return std::string(op_name + device_name + flag_str);
|
||||
}
|
||||
|
||||
void ConvertOpInfoRegister::RegConvertOpInfo(ConvertOpInfo *reg_info) {
|
||||
void OpAdaptationInfoRegister::RegOpAdaptationInfo(OpAdaptationInfo *reg_info) {
|
||||
MS_EXCEPTION_IF_NULL(reg_info);
|
||||
auto key = GenerateKey(reg_info->GetOriginOpName(), reg_info->GetDeviceName(), reg_info->IsDynamicShape());
|
||||
auto key = GenerateKey(reg_info->GetOriginOpName(), reg_info->GetDeviceName(), reg_info->GetFlag());
|
||||
auto find = op_info_map_.find(key);
|
||||
if (find != op_info_map_.end()) {
|
||||
MS_LOG(ERROR) << "This key (" << key << ")"
|
||||
<< " has been registered in origin op info map.";
|
||||
return;
|
||||
}
|
||||
MS_LOG(DEBUG) << "Reg convert op info to op info map, key: " << key;
|
||||
MS_LOG(DEBUG) << "Reg op adaptation info to factory, key: " << key;
|
||||
op_info_map_[key] = reg_info;
|
||||
}
|
||||
|
||||
ConvertOpInfo *ConvertOpInfoRegister::GetConvertOpInfo(const std::string &origin_op_name,
|
||||
const std::string &device_name, bool is_dynamic_shape) const {
|
||||
auto key = GenerateKey(origin_op_name, device_name, is_dynamic_shape);
|
||||
OpAdaptationInfo *OpAdaptationInfoRegister::GetOpAdaptationInfo(const std::string &origin_op_name,
|
||||
const std::string &device_name, bool flag) const {
|
||||
auto key = GenerateKey(origin_op_name, device_name, flag);
|
||||
auto iter = op_info_map_.find(key);
|
||||
if (iter == op_info_map_.end()) {
|
||||
MS_LOG(DEBUG) << "Can't find const input to attr info for op " << origin_op_name << " on " << device_name
|
||||
<< " when dynamic shape is " << is_dynamic_shape;
|
||||
MS_LOG(DEBUG) << "Can't find op adaptation for op " << origin_op_name << " on " << device_name << " when flag is "
|
||||
<< flag;
|
||||
return nullptr;
|
||||
}
|
||||
return iter->second;
|
||||
|
@ -70,17 +70,18 @@ RegisterHelper::RegisterHelper(const string &name, const string &device_name, bo
|
|||
(void)input_to_attr.insert(static_cast<size_t>(IntToUint(va_arg(var_ptr, int))));
|
||||
}
|
||||
va_end(var_ptr);
|
||||
convert_op_info_ = std::make_shared<ConvertOpInfo>(name, name, device_name, is_dynamic_shape);
|
||||
MS_EXCEPTION_IF_NULL(convert_op_info_);
|
||||
op_adaptation_info_ = std::make_shared<OpAdaptationInfo>(name, device_name, is_dynamic_shape);
|
||||
MS_EXCEPTION_IF_NULL(op_adaptation_info_);
|
||||
op_adaptation_info_->SetTargetOpName(name);
|
||||
for (auto &index : input_to_attr) {
|
||||
convert_op_info_->SetInputAttrInfo(index);
|
||||
op_adaptation_info_->SetInputAttrInfo(index);
|
||||
}
|
||||
opt::ConvertOpInfoRegister::GetInstance().RegConvertOpInfo(convert_op_info_.get());
|
||||
opt::OpAdaptationInfoRegister::GetInstance().RegOpAdaptationInfo(op_adaptation_info_.get());
|
||||
}
|
||||
|
||||
RegisterHelper::RegisterHelper(const ConvertOpInfo &convert_op_info) {
|
||||
convert_op_info_ = std::make_shared<ConvertOpInfo>(convert_op_info);
|
||||
MS_EXCEPTION_IF_NULL(convert_op_info_);
|
||||
opt::ConvertOpInfoRegister::GetInstance().RegConvertOpInfo(convert_op_info_.get());
|
||||
RegisterHelper::RegisterHelper(const OpAdaptationInfo &op_adaptation_info) {
|
||||
op_adaptation_info_ = std::make_shared<OpAdaptationInfo>(op_adaptation_info);
|
||||
MS_EXCEPTION_IF_NULL(op_adaptation_info_);
|
||||
opt::OpAdaptationInfoRegister::GetInstance().RegOpAdaptationInfo(op_adaptation_info_.get());
|
||||
}
|
||||
} // namespace mindspore::opt
|
|
@ -0,0 +1,164 @@
|
|||
/**
|
||||
* Copyright 2022 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_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
||||
#define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include "ir/anf.h"
|
||||
#include "utils/hash_map.h"
|
||||
#include "utils/hash_set.h"
|
||||
#include "utils/ms_utils.h"
|
||||
#include "utils/ms_context.h"
|
||||
#include "include/backend/visible.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
class InputAttrInfo {
|
||||
public:
|
||||
explicit InputAttrInfo(const size_t input_index, const std::string attr_name, const std::string attr_data_type)
|
||||
: input_index_(input_index), attr_name_(attr_name), attr_data_type_(attr_data_type) {}
|
||||
virtual ~InputAttrInfo() = default;
|
||||
|
||||
size_t GetInputIndex() const { return input_index_; }
|
||||
std::string GetAttrName() const { return attr_name_; }
|
||||
std::string GetAttrDataType() const { return attr_data_type_; }
|
||||
|
||||
private:
|
||||
size_t input_index_;
|
||||
std::string attr_name_;
|
||||
std::string attr_data_type_;
|
||||
};
|
||||
|
||||
class OpAdaptationInfo {
|
||||
public:
|
||||
explicit OpAdaptationInfo(const std::string &origin_op_name, const std::string &device_name, bool flag)
|
||||
: origin_op_name_(origin_op_name), target_op_name_(origin_op_name), device_name_(device_name), flag_(flag) {}
|
||||
|
||||
explicit OpAdaptationInfo(const OpAdaptationInfo &op_adaptation_info)
|
||||
: origin_op_name_(op_adaptation_info.origin_op_name_),
|
||||
target_op_name_(op_adaptation_info.target_op_name_),
|
||||
pre_check_func_(op_adaptation_info.pre_check_func_),
|
||||
need_tbe_check_supported_(op_adaptation_info.need_tbe_check_supported_),
|
||||
input_attr_map_(op_adaptation_info.input_attr_map_),
|
||||
attr_name_map_(op_adaptation_info.attr_name_map_),
|
||||
device_name_(op_adaptation_info.device_name_),
|
||||
flag_(op_adaptation_info.flag_) {}
|
||||
|
||||
virtual ~OpAdaptationInfo() = default;
|
||||
|
||||
OpAdaptationInfo &SetTargetOpName(std::string target_op_name) {
|
||||
target_op_name_ = target_op_name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OpAdaptationInfo &SetPreCheckFunc(std::function<bool(CNodePtr)> pre_check_func) {
|
||||
pre_check_func_ = pre_check_func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OpAdaptationInfo &SetNeedTBECheckSupported(bool need_tbe_check_supported) {
|
||||
need_tbe_check_supported_ = need_tbe_check_supported;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OpAdaptationInfo &SetInputAttrInfo(size_t input_index, std::string attr_name = "", std::string attr_data_type = "") {
|
||||
auto find = input_attr_map_.find(input_index);
|
||||
if (find != input_attr_map_.end()) {
|
||||
MS_LOG(ERROR) << "This input index (" << input_index << ")"
|
||||
<< " has been registered.";
|
||||
return *this;
|
||||
}
|
||||
input_attr_map_.insert(std::make_pair(input_index, InputAttrInfo(input_index, attr_name, attr_data_type)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
OpAdaptationInfo &SetAttrNameInfo(std::string origin_attr_name, std::string target_attr_name) {
|
||||
if (origin_attr_name.empty() || target_attr_name.empty()) {
|
||||
MS_LOG(ERROR) << "Attr name is empty, origin attr name: " << origin_attr_name
|
||||
<< ", target attr name:" << target_attr_name << ", origin op name:" << origin_op_name_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto find = attr_name_map_.find(origin_attr_name);
|
||||
if (find != attr_name_map_.end()) {
|
||||
MS_LOG(ERROR) << "Attr name has been register, origin attr name: " << origin_attr_name
|
||||
<< ", old target attr name:" << attr_name_map_[origin_attr_name]
|
||||
<< ", new target attr name:" << target_attr_name << ", origin op name:" << origin_op_name_;
|
||||
}
|
||||
attr_name_map_[origin_attr_name] = target_attr_name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string GetOriginOpName() const { return origin_op_name_; }
|
||||
std::string GetTargetOpName() const { return target_op_name_; }
|
||||
std::function<bool(CNodePtr)> GetPreCheckFunc() const { return pre_check_func_; }
|
||||
bool NeedTBECheck() const { return need_tbe_check_supported_; }
|
||||
std::map<size_t, InputAttrInfo> GetInputAttrInfoMap() const { return input_attr_map_; }
|
||||
mindspore::HashMap<std::string, std::string> GetAttrNameInfoMap() const { return attr_name_map_; }
|
||||
std::string GetDeviceName() const { return device_name_; }
|
||||
bool GetFlag() const { return flag_; }
|
||||
|
||||
private:
|
||||
std::string origin_op_name_;
|
||||
std::string target_op_name_;
|
||||
std::function<bool(CNodePtr)> pre_check_func_{nullptr};
|
||||
bool need_tbe_check_supported_{false};
|
||||
std::map<size_t, InputAttrInfo> input_attr_map_;
|
||||
mindspore::HashMap<std::string, std::string> attr_name_map_;
|
||||
std::string device_name_{""};
|
||||
bool flag_{false};
|
||||
};
|
||||
|
||||
class BACKEND_EXPORT OpAdaptationInfoRegister {
|
||||
public:
|
||||
static OpAdaptationInfoRegister &GetInstance();
|
||||
void RegOpAdaptationInfo(OpAdaptationInfo *reg_info);
|
||||
[[nodiscard]] OpAdaptationInfo *GetOpAdaptationInfo(const std::string &origin_op_name, const std::string &device_name,
|
||||
bool flag) const;
|
||||
|
||||
private:
|
||||
OpAdaptationInfoRegister() = default;
|
||||
~OpAdaptationInfoRegister() = default;
|
||||
DISABLE_COPY_AND_ASSIGN(OpAdaptationInfoRegister)
|
||||
|
||||
static std::string GenerateKey(const std::string &op_name, const std::string &device_name, bool flag);
|
||||
// key: (op_name + device_name + flag), value: <OpAdaptationInfo *>
|
||||
std::map<std::string, OpAdaptationInfo *> op_info_map_;
|
||||
};
|
||||
|
||||
class RegisterHelper {
|
||||
public:
|
||||
RegisterHelper(const std::string &name, const std::string &device_name, bool is_dynamic_shape, int len, ...);
|
||||
RegisterHelper(const OpAdaptationInfo &op_adaptation_info);
|
||||
~RegisterHelper() = default;
|
||||
|
||||
private:
|
||||
std::shared_ptr<OpAdaptationInfo> op_adaptation_info_{nullptr};
|
||||
};
|
||||
|
||||
#define REG_OP_ADAPTATION_INFO(origin_op_name, device_name, flag) \
|
||||
static opt::RegisterHelper g_reg_##device_name##_##origin_op_name##_##flag __attribute__((unused)) = \
|
||||
opt::OpAdaptationInfo(origin_op_name, device_name, flag)
|
||||
|
||||
#define RER_CONST_TO_ATTR_LIST(origin_op_name, backend, is_dynamic_shape, ...) \
|
||||
static opt::RegisterHelper g_reg_##backend##_##is_dynamic_shape##_##origin_op_name( \
|
||||
origin_op_name, backend, is_dynamic_shape, std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value, \
|
||||
__VA_ARGS__)
|
||||
} // namespace mindspore::opt
|
||||
#endif // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_COMMON_CONST_INPUT_TO_ATTR_FACTORY_H_
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include "backend/common/optimizer/const_input_to_attr.h"
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
#include "include/common/utils/utils.h"
|
||||
#include "include/common/utils/anfalgo.h"
|
||||
|
||||
|
@ -43,14 +43,14 @@ const AnfNodePtr ConvertConstInputToAttr::Process(const FuncGraphPtr &, const An
|
|||
backend = primitive_target;
|
||||
}
|
||||
|
||||
// Ascend const input to attr move to AscendConvertConstInputToAttr
|
||||
// Ascend const input to attr move to AscendVmOpAdapter
|
||||
if (backend == kAscendDevice) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto is_dynamic_shape = common::AnfAlgo::IsDynamicShape(node);
|
||||
mindspore::HashSet<size_t> input_to_attr = {};
|
||||
auto reg_info = opt::ConvertOpInfoRegister::GetInstance().GetConvertOpInfo(name, backend, is_dynamic_shape);
|
||||
auto reg_info = opt::OpAdaptationInfoRegister::GetInstance().GetOpAdaptationInfo(name, backend, is_dynamic_shape);
|
||||
if (reg_info == nullptr) {
|
||||
return nullptr;
|
||||
} else {
|
||||
|
|
|
@ -32,388 +32,388 @@
|
|||
|
||||
namespace mindspore {
|
||||
// op name. Op which not exists in operator/ops.h, so define it's name here
|
||||
constexpr auto kAbsOpName = "Abs";
|
||||
constexpr auto kAdamApplyOneAssignOpName = "AdamApplyOneAssign";
|
||||
constexpr auto kAdamApplyOneOpName = "AdamApplyOne";
|
||||
constexpr auto kAdamApplyOneWithDecayAssignOpName = "AdamApplyOneWithDecayAssign";
|
||||
constexpr auto kAdamApplyOneWithDecayOpName = "AdamApplyOneWithDecay";
|
||||
constexpr auto kAdamWeightDecayName = "AdamWeightDecay";
|
||||
constexpr auto kAdaptiveMaxPool3DGradOpName = "AdaptiveMaxPool3DGrad";
|
||||
constexpr auto kFractionalAvgPoolGradOpName = "FractionalAvgPoolGrad";
|
||||
constexpr auto kSegmentMaxOpName = "SegmentMax";
|
||||
constexpr auto kSegmentMinOpName = "SegmentMin";
|
||||
constexpr auto kSegmentSumOpName = "SegmentSum";
|
||||
constexpr auto kSegmentMeanOpName = "SegmentMean";
|
||||
constexpr auto kSegmentProdOpName = "SegmentProd";
|
||||
constexpr auto kLuUnpackOpName = "LuUnpack";
|
||||
constexpr auto kConcatOpName = "Concat";
|
||||
constexpr auto kListDiffOpName = "ListDiff";
|
||||
constexpr auto kUniqueOpName = "Unique";
|
||||
constexpr auto kUniqueConsecutiveOpName = "UniqueConsecutive";
|
||||
constexpr auto kMaskedSelectOpName = "MaskedSelect";
|
||||
constexpr auto kComputeAccidentalHitsOpName = "ComputeAccidentalHits";
|
||||
constexpr auto kCTCGreedyDecoderOpName = "CTCGreedyDecoder";
|
||||
constexpr auto kDynamicStitchOpName = "DynamicStitch";
|
||||
constexpr auto kFour2FiveOpName = "Four2Five";
|
||||
constexpr auto kFive2FourOpName = "Five2Four";
|
||||
constexpr auto kConv3DOpName = "Conv3D";
|
||||
constexpr auto kConv3DBackpropFilterOpName = "Conv3DBackpropFilter";
|
||||
constexpr auto kConv3DBackpropInputOpName = "Conv3DBackpropInput";
|
||||
constexpr auto kConv2DOpName = "Conv2D";
|
||||
constexpr auto kConvBN1OpName = "ConvBN1";
|
||||
constexpr auto kBN2AddReluOpName = "BN2AddRelu";
|
||||
constexpr auto kBN2ReLUOpName = "BN2Relu";
|
||||
constexpr auto kBN2OpName = "BN2";
|
||||
constexpr auto kFusedBN1OpName = "FusedBN1";
|
||||
constexpr auto kFusedBN2OpName = "FusedBN2";
|
||||
constexpr auto kFusedBN3OpName = "FusedBN3";
|
||||
constexpr auto kBNGrad1OpName = "BNGrad1";
|
||||
constexpr auto kBNGrad2OpName = "BNGrad2";
|
||||
constexpr auto kBNGrad3OpName = "BNGrad3";
|
||||
constexpr auto kBatchNorm = "BatchNorm";
|
||||
constexpr auto kInstanceNorm = "InstanceNorm";
|
||||
constexpr auto kBatchNormWithActivation = "BatchNormWithActivation";
|
||||
constexpr auto kBatchNormWithAddAndActivation = "BatchNormWithAddAndActivation";
|
||||
constexpr auto kBatchNormGradWithActivation = "BatchNormGradWithActivation";
|
||||
constexpr auto kBatchNormGradWithAddAndActivation = "BatchNormGradWithAddAndActivation";
|
||||
constexpr auto kClearZeroOpName = "ClearZero";
|
||||
constexpr auto kAtomicAddrCleanOpName = "AtomicAddrClean";
|
||||
constexpr auto kDynamicAtomicAddrCleanOpName = "DynamicAtomicAddrClean";
|
||||
constexpr auto kGetNextOpName = "GetNext";
|
||||
constexpr auto kInitDatasetQueueOpName = "InitDataSetQueue";
|
||||
constexpr auto kEndOfSequence = "EndOfSequence";
|
||||
constexpr auto kAllToAllVOpName = "AllToAllv";
|
||||
constexpr auto kAllReduceOpName = "AllReduce";
|
||||
constexpr auto kAddNOpName = "AddN";
|
||||
constexpr auto kAddOpName = "Add";
|
||||
constexpr auto kAllGatherOpName = "AllGather";
|
||||
constexpr auto kHostAllGatherOpName = "HostAllGather";
|
||||
constexpr auto kBroadcastOpName = "Broadcast";
|
||||
constexpr auto kReceiveOpName = "Receive";
|
||||
constexpr auto kHcomSendOpName = "Send";
|
||||
constexpr auto kMuxReceiveOpName = "MuxReceive";
|
||||
constexpr auto kMuxSendOpName = "MuxSend";
|
||||
constexpr auto kReduceScatterOpName = "ReduceScatter";
|
||||
constexpr auto kHostReduceScatterOpName = "HostReduceScatter";
|
||||
constexpr auto kMemCpyAsyncOpName = "memcpy_async";
|
||||
constexpr auto kTopKOpName = "TopK";
|
||||
constexpr auto kLinSpaceOpName = "LinSpace";
|
||||
constexpr auto kExtractImagePatchesOpName = "ExtractImagePatches";
|
||||
constexpr auto kBNTrainingReduceOpName = "BNTrainingReduce";
|
||||
constexpr auto kBNTrainingUpdateOpName = "BNTrainingUpdate";
|
||||
constexpr auto kBNTrainingUpdateV2OpName = "BNTrainingUpdateV2";
|
||||
constexpr auto kBNTrainingUpdateV3OpName = "BNTrainingUpdateV3";
|
||||
constexpr auto kNonMaxSuppressionV3OpName = "NonMaxSuppressionV3";
|
||||
constexpr auto kSimpleMeanGradOpName = "SimpleMeanGrad";
|
||||
constexpr auto kMeanGradOpName = "MeanGrad";
|
||||
constexpr auto kSliceOpName = "Slice";
|
||||
constexpr auto kSliceGradOpName = "SliceGrad";
|
||||
constexpr auto kCoalesceOpName = "Coalesce";
|
||||
constexpr auto kTileOpName = "Tile";
|
||||
constexpr auto kScatterNdOpName = "ScatterNd";
|
||||
constexpr auto kStridedSliceAssignOpName = "StridedSliceAssign";
|
||||
constexpr auto kStridedSliceOpName = "StridedSlice";
|
||||
constexpr auto kEyeOpName = "Eye";
|
||||
constexpr auto kStridedSliceGradOpName = "StridedSliceGrad";
|
||||
constexpr auto kSparseGatherV2OpName = "SparseGatherV2";
|
||||
constexpr auto kUnsortedSegmentProdOpName = "UnsortedSegmentProd";
|
||||
constexpr auto kUnsortedSegmentMinOpName = "UnsortedSegmentMin";
|
||||
constexpr auto kSortOpName = "Sort";
|
||||
constexpr auto kFlattenGradOpName = "FlattenGrad";
|
||||
constexpr auto kExpandDimsOpName = "ExpandDims";
|
||||
constexpr auto kReshapeOpName = "Reshape";
|
||||
constexpr auto kTransposeOpName = "Transpose";
|
||||
constexpr auto kTransposeNODOpName = "TransposeNOD";
|
||||
constexpr auto kSplitOpName = "Split";
|
||||
constexpr auto kSplitVOpName = "SplitV";
|
||||
constexpr auto kSparseApplyAdagradOpName = "SparseApplyAdagrad";
|
||||
constexpr auto kMomentumOpName = "Momentum";
|
||||
constexpr auto kApplyMomentumOpName = "ApplyMomentum";
|
||||
constexpr auto kCombineMomentumOpName = "CombineMomentum";
|
||||
constexpr auto kCombineMomentumWeightOpName = "CombineMomentumWeight";
|
||||
constexpr auto kAllReduceOpName = "AllReduce";
|
||||
constexpr auto kAllToAllVOpName = "AllToAllv";
|
||||
constexpr auto kApplyAdadeltaOpName = "ApplyAdadelta";
|
||||
constexpr auto kApplyAdagradOpName = "ApplyAdagrad";
|
||||
constexpr auto kApplyAdagradDAName = "ApplyAdagradDA";
|
||||
constexpr auto kApplyAdamOpName = "Adam";
|
||||
constexpr auto kApplyAdagradOpName = "ApplyAdagrad";
|
||||
constexpr auto kApplyAdagradV2OpName = "ApplyAdagradV2";
|
||||
constexpr auto kApplyAdaMaxOpName = "ApplyAdaMax";
|
||||
constexpr auto kApplyAdamOpName = "Adam";
|
||||
constexpr auto kApplyAdamWithAmsgradOpName = "ApplyAdamWithAmsgrad";
|
||||
constexpr auto kApplyAddSignOpName = "ApplyAddSign";
|
||||
constexpr auto kApplyCenteredRMSPOpName = "ApplyCenteredRMSP";
|
||||
constexpr auto kApplyCenteredRMSPropOpName = "ApplyCenteredRMSProp";
|
||||
constexpr auto kApplyFtrlOpName = "ApplyFtrl";
|
||||
constexpr auto kApplyFtrlV2OpName = "ApplyFtrlV2";
|
||||
constexpr auto kApplyGradientDescentOpName = "ApplyGradientDescent";
|
||||
constexpr auto kApplyKerasMomentumOpName = "ApplyKerasMomentum";
|
||||
constexpr auto kApplyMomentumOpName = "ApplyMomentum";
|
||||
constexpr auto kApplyPowerSignOpName = "ApplyPowerSign";
|
||||
constexpr auto kApplyProximalAdagradOpName = "ApplyProximalAdagrad ";
|
||||
constexpr auto kApplyProximalGradientDescentOpName = "ApplyProximalGradientDescent";
|
||||
constexpr auto kApplyRMSPropOpName = "ApplyRMSProp";
|
||||
constexpr auto kTransDataOpName = "TransData";
|
||||
constexpr auto kTransDataRNNOpName = "TransDataRNN";
|
||||
constexpr auto kStackInitOpName = "StackInit";
|
||||
constexpr auto kStackPushOpName = "StackPush";
|
||||
constexpr auto kStackPopOpName = "StackPop";
|
||||
constexpr auto kStackOpName = "Stack";
|
||||
constexpr auto kStackDestroyOpName = "StackDestroy";
|
||||
constexpr auto kBNTrainingUpdateGradOpName = "BNTrainingUpdateGrad";
|
||||
constexpr auto kBNTrainingReduceGradOpName = "BNTrainingReduceGrad";
|
||||
constexpr auto kSquareSumV1OpName = "SquareSumV1";
|
||||
constexpr auto kSquareSumV2OpName = "SquareSumV2";
|
||||
constexpr auto kClipByNormNoDivSumOpName = "ClipByNormNoDivSum";
|
||||
constexpr auto kPReluOpName = "PReLU";
|
||||
constexpr auto kGreaterOpName = "Greater";
|
||||
constexpr auto kSqrtOpName = "Sqrt";
|
||||
constexpr auto kRsqrtOpName = "Rsqrt";
|
||||
constexpr auto kRsqrtGradOpName = "RsqrtGrad";
|
||||
constexpr auto kErfOpName = "Erf";
|
||||
constexpr auto kDivOpName = "Div";
|
||||
constexpr auto kRealDivOpName = "RealDiv";
|
||||
constexpr auto kLambUpdateWithLROpName = "LambUpdateWithLR";
|
||||
constexpr auto kLambNextMVWithDecayOpName = "LambNextMVWithDecay";
|
||||
constexpr auto kLambNextMVWithDecayV1OpName = "LambNextMVWithDecayV1";
|
||||
constexpr auto kClipByValueOpName = "ClipByValue";
|
||||
constexpr auto kLambNextRightOpName = "LambNextRight";
|
||||
constexpr auto kConfusionSoftmaxGradOpName = "ConfusionSoftmaxGrad";
|
||||
constexpr auto kLambUpdateWithLrV2OpName = "LambUpdateWithLrV2";
|
||||
constexpr auto kLayerNormXBackpropOpName = "LayerNormXBackprop";
|
||||
constexpr auto kLayerNormXBackpropV2OpName = "LayerNormXBackpropV2";
|
||||
constexpr auto kLayerNormBetaGammaBackpropOpName = "LayerNormBetaGammaBackprop";
|
||||
constexpr auto kLayerNormBetaGammaBackpropV2OpName = "LayerNormBetaGammaBackpropV2";
|
||||
constexpr auto kLambNextMVOpName = "LambNextMV";
|
||||
constexpr auto kConfusionTransposeDOpName = "ConfusionTransposeD";
|
||||
constexpr auto kAdamApplyOneWithDecayOpName = "AdamApplyOneWithDecay";
|
||||
constexpr auto kAdamApplyOneWithDecayAssignOpName = "AdamApplyOneWithDecayAssign";
|
||||
constexpr auto kBatchNormGradOpName = "BatchNormGrad";
|
||||
constexpr auto kBNInferOpName = "BNInfer";
|
||||
constexpr auto kAdamApplyOneOpName = "AdamApplyOne";
|
||||
constexpr auto kAdamApplyOneAssignOpName = "AdamApplyOneAssign";
|
||||
constexpr auto kResizeNearestNeighborGradOpName = "ResizeNearestNeighborGrad";
|
||||
constexpr auto kFusedMulAddOpName = "FusedMulAdd";
|
||||
constexpr auto kFusedMulAddNOpName = "FusedMulAddN";
|
||||
constexpr auto kFusedMulApplyMomentumOpName = "FusedMulApplyMomentum";
|
||||
constexpr auto kBiasAddOpName = "BiasAdd";
|
||||
constexpr auto kConfusionMulGradOpName = "ConfusionMulGrad";
|
||||
constexpr auto kStreamSwitchOpName = "StreamSwitch";
|
||||
constexpr auto kStreamActiveOpName = "StreamActive";
|
||||
constexpr auto kEndGraph = "EndGraph";
|
||||
constexpr auto kAssignAddOpName = "AssignAdd";
|
||||
constexpr auto kAssignSubOpName = "AssignSub";
|
||||
constexpr auto kSendOpName = "StreamSend";
|
||||
constexpr auto kRecvOpName = "StreamRecv";
|
||||
constexpr auto kRpcSendOpName = "RpcSend";
|
||||
constexpr auto kRpcRecvOpName = "RpcRecv";
|
||||
constexpr auto kReluOpName = "ReLU";
|
||||
constexpr auto kReluGradOpName = "ReluGrad";
|
||||
constexpr auto kReluV2OpName = "ReLUV2";
|
||||
constexpr auto kReluGradV2OpName = "ReluGradV2";
|
||||
constexpr auto kAddOpName = "Add";
|
||||
constexpr auto kAddNOpName = "AddN";
|
||||
constexpr auto kResizeNearestNeighborV2OpName = "ResizeNearestNeighborV2";
|
||||
constexpr auto kResizeNearestNeighborV2GradOpName = "ResizeNearestNeighborV2Grad";
|
||||
constexpr auto kApplyRMSPropOpname = "ApplyRMSProp";
|
||||
constexpr auto kCumsumOpName = "Cumsum";
|
||||
constexpr auto kInplaceAddOpName = "InplaceAdd";
|
||||
constexpr auto kInplaceSubOpName = "InplaceSub";
|
||||
constexpr auto kResizeBilinearV2OpName = "kResizeBilinearV2";
|
||||
constexpr auto kReduceProdOpName = "ReduceProd";
|
||||
constexpr auto kCumprodOpName = "Cumprod";
|
||||
constexpr auto kSpaceToBatchOpName = "SpaceToBatch";
|
||||
constexpr auto kBatchToSpaceOpName = "BatchToSpace";
|
||||
constexpr auto kSpaceToDepthOpName = "SpaceToDepth";
|
||||
constexpr auto kPadOpName = "Pad";
|
||||
constexpr auto kConv2DTransposeOpName = "Conv2DTranspose";
|
||||
constexpr auto kConv2DBackpropInputOpName = "Conv2DBackpropInput";
|
||||
constexpr auto kConv2DBackpropFilterOpName = "Conv2DBackpropFilter";
|
||||
constexpr auto kDepthwiseConv2dNativeOpName = "DepthwiseConv2dNative";
|
||||
constexpr auto kDepthwiseConv2dNativeBackpropInputOpName = "DepthwiseConv2dNativeBackpropInput";
|
||||
constexpr auto kDepthwiseConv2dNativeBackpropFilterOpName = "DepthwiseConv2dNativeBackpropFilter";
|
||||
constexpr auto kFusionOpConv2DBackpropInputReluGradV2Name = "FusionOp_Conv2DBackpropInput_ReluGradV2";
|
||||
constexpr auto kFusionOpConv2DBackpropInputAddNReluGradV2Name = "FusionOp_Conv2DBackpropInput_AddN_ReluGradV2";
|
||||
constexpr auto kLabelSetOpName = "LabelSet";
|
||||
constexpr auto kLabelSwitchOpName = "LabelSwitch";
|
||||
constexpr auto kLabelGotoOpName = "LabelGoto";
|
||||
constexpr auto kBNInferGradOpName = "BNInferGrad";
|
||||
constexpr auto kCallOpName = "call";
|
||||
constexpr auto kPartialOpName = "partial";
|
||||
constexpr auto kSwitchOpName = "Switch";
|
||||
constexpr auto kReturnOpName = "Return";
|
||||
constexpr auto kBpropCutOpName = "bprop_cut";
|
||||
constexpr auto kLarsV2OpName = "LarsV2";
|
||||
constexpr auto kLarsV2UpdateOpName = "LarsV2Update";
|
||||
constexpr auto kSquareSumAllOpName = "SquareSumAll";
|
||||
constexpr auto kNMSWithMaskOpName = "NMSWithMask";
|
||||
constexpr auto kSoftmaxGradExtOpName = "SoftmaxGradExt";
|
||||
constexpr auto kStridedReadOpName = "StridedRead";
|
||||
constexpr auto kStridedWriteOpName = "StridedWrite";
|
||||
constexpr auto kFusedAdamWeightDecayName = "FusedAdamWeightDecay";
|
||||
constexpr auto kAdamWeightDecayName = "AdamWeightDecay";
|
||||
constexpr auto kFusedCastAdamWeightDecayName = "FusedCastAdamWeightDecay";
|
||||
constexpr auto kFusedAdamName = "FusedAdam";
|
||||
constexpr auto kFusedAdaFactorName = "FusedAdaFactor";
|
||||
constexpr auto kFusedAdaFactorWithGlobalNormName = "FusedAdaFactorWithGlobalNorm";
|
||||
constexpr auto kFusedSparseAdamName = "FusedSparseAdam";
|
||||
constexpr auto kFusedMatMulBiasAddName = "FusedMatMulBiasAdd";
|
||||
constexpr auto kDeadNodeName = "DeadNode";
|
||||
constexpr auto kPolyNodeName = "PolyNode";
|
||||
constexpr auto kApplyAdagradV2OpName = "ApplyAdagradV2";
|
||||
constexpr auto kSparseApplyAdagradV2OpName = "SparseApplyAdagradV2";
|
||||
constexpr auto kSparseApplyFtrlOpName = "SparseApplyFtrl";
|
||||
constexpr auto kSparseApplyFtrlV2OpName = "SparseApplyFtrlV2";
|
||||
constexpr auto kApplyKerasMomentumOpName = "ApplyKerasMomentum";
|
||||
constexpr auto kSparseApplyProximalAdagradOpName = "SparseApplyProximalAdagrad";
|
||||
constexpr auto kSparseApplyRMSPropOpName = "SparseApplyRMSProp";
|
||||
constexpr auto kSparseApplyAdadeltaOpName = "SparseApplyAdadelta";
|
||||
constexpr auto kApplyAdamWithAmsgradOpName = "ApplyAdamWithAmsgrad";
|
||||
constexpr auto kTensorMoveOpName = "TensorMove";
|
||||
constexpr auto kTensorCopySlicesOpName = "TensorCopySlices";
|
||||
constexpr auto kTensorScatterUpdateOpName = "TensorScatterUpdate";
|
||||
constexpr auto kScatterNdUpdateOpName = "ScatterNdUpdate";
|
||||
constexpr auto kPushOpName = "Push";
|
||||
constexpr auto kPullOpName = "Pull";
|
||||
constexpr auto kPushWeightOpName = "PushWeight";
|
||||
constexpr auto kPullWeightOpName = "PullWeight";
|
||||
constexpr auto kFusedPushWeightOpName = "FusedPushWeight";
|
||||
constexpr auto kFusedPullWeightOpName = "FusedPullWeight";
|
||||
constexpr auto kUpdateCacheOpName = "UpdateCache";
|
||||
constexpr auto kCacheSwapTableOpName = "CacheSwapTable";
|
||||
constexpr auto kEmbeddingLookupOpName = "EmbeddingLookup";
|
||||
constexpr auto kEmbeddingLookupProxyOpName = "EmbeddingLookupProxy";
|
||||
constexpr auto kGatherV2OpName = "Gather";
|
||||
constexpr auto kPaddingOpName = "Padding";
|
||||
constexpr auto kPoolingOpName = "Pooling";
|
||||
constexpr auto kAvgPoolOpName = "AvgPool";
|
||||
constexpr auto kAvgPoolGradOpName = "AvgPoolGrad";
|
||||
constexpr auto kAvgPool3DOpName = "AvgPool3D";
|
||||
constexpr auto kArgminV2OpName = "ArgminV2";
|
||||
constexpr auto kAssignAddOpName = "AssignAdd";
|
||||
constexpr auto kAssignOpName = "Assign";
|
||||
constexpr auto kAssignSubOpName = "AssignSub";
|
||||
constexpr auto kAtomicAddrCleanOpName = "AtomicAddrClean";
|
||||
constexpr auto kAvgPool3DGradOpName = "AvgPool3DGrad";
|
||||
constexpr auto kAvgPool3DOpName = "AvgPool3D";
|
||||
constexpr auto kAvgPoolGradOpName = "AvgPoolGrad";
|
||||
constexpr auto kAvgPoolGradVmOpName = "AvgPoolGradVm";
|
||||
constexpr auto kMaxPoolOpName = "MaxPool";
|
||||
constexpr auto kMaxPoolGradOpName = "MaxPoolGrad";
|
||||
constexpr auto kMaxPool3DOpName = "MaxPool3D";
|
||||
constexpr auto kMaxPool3DGradOpName = "MaxPool3DGrad";
|
||||
constexpr auto kMaxPoolWithArgmaxOpName = "MaxPoolWithArgmax";
|
||||
constexpr auto kMaxPoolGradWithArgmaxOpName = "MaxPoolGradWithArgmax";
|
||||
constexpr auto kTensorAddOpName = "Add";
|
||||
constexpr auto kKLDivLossOpName = "KLDivLoss";
|
||||
constexpr auto kMaxPool3DGradGradOpName = "MaxPool3DGradGrad";
|
||||
constexpr auto kCastOpName = "Cast";
|
||||
constexpr auto kGreaterEqualOpName = "GreaterEqual";
|
||||
constexpr auto kAbsOpName = "Abs";
|
||||
constexpr auto kExpOpName = "Exp";
|
||||
constexpr auto kNegOpName = "Neg";
|
||||
constexpr auto kMinimumOpName = "Minimum";
|
||||
constexpr auto kMaximumOpName = "Maximum";
|
||||
constexpr auto kMulOpName = "Mul";
|
||||
constexpr auto kSubOpName = "Sub";
|
||||
constexpr auto kLogOpName = "Log";
|
||||
constexpr auto kPowOpName = "Pow";
|
||||
constexpr auto kReciprocalOpName = "Reciprocal";
|
||||
constexpr auto kEqualOpName = "Equal";
|
||||
constexpr auto kLessOpName = "Less";
|
||||
constexpr auto kLessEqualOpName = "LessEqual";
|
||||
constexpr auto kSquareOpName = "Square";
|
||||
constexpr auto kSelectOpName = "Select";
|
||||
constexpr auto kCSRSparseMatrixToSparseTensorOpName = "CSRSparseMatrixToSparseTensor";
|
||||
constexpr auto kSparseSparseMinimumOpName = "SparseSparseMinimum";
|
||||
constexpr auto kReduceSumOpName = "ReduceSum";
|
||||
constexpr auto kReduceMinOpName = "ReduceMin";
|
||||
constexpr auto kReduceMaxOpName = "ReduceMax";
|
||||
constexpr auto kReduceMeanOpName = "ReduceMean";
|
||||
constexpr auto kReduceAnyOpName = "ReduceAny";
|
||||
constexpr auto kReduceAllOpName = "ReduceAll";
|
||||
constexpr auto kRenormOpName = "Renorm";
|
||||
constexpr auto kFusedWeightScaleApplyMomentum = "FusedWeightScaleApplyMomentum";
|
||||
constexpr auto kFusedWeightApplyMomentum = "FusedWeightApplyMomentum";
|
||||
constexpr auto kFusedScaleApplyMomentum = "FusedScaleApplyMomentum";
|
||||
constexpr auto kBasicLSTMCellWeightGradOpName = "BasicLSTMCellWeightGrad";
|
||||
constexpr auto kBasicLSTMCellInputGradOpName = "BasicLSTMCellInputGrad";
|
||||
constexpr auto kBasicLSTMCellOpName = "BasicLSTMCell";
|
||||
constexpr auto kDynamicRNNOpName = "DynamicRNN";
|
||||
constexpr auto kLSTMOpName = "LSTM";
|
||||
constexpr auto kLSTMGradOpName = "LSTMGrad";
|
||||
constexpr auto kLSTMInputGradOpName = "LSTMInputGrad";
|
||||
constexpr auto kDynamicGRUV2OpName = "DynamicGRUV2";
|
||||
constexpr auto kGRUV2HiddenGradOpName = "GRUV2HiddenGrad";
|
||||
constexpr auto kGRUV2HiddenGradCellOpName = "GRUV2HiddenGradCell";
|
||||
constexpr auto kFusedSparseFtrlName = "FusedSparseFtrl";
|
||||
constexpr auto kFusedSparseProximalAdagradName = "FusedSparseProximalAdagrad";
|
||||
constexpr auto kFusedSparseLazyAdamName = "FusedSparseLazyAdam";
|
||||
constexpr auto kSparseApplyFtrlName = "SparseApplyFtrl";
|
||||
constexpr auto kSparseApplyFtrlV2Name = "SparseApplyFtrlV2";
|
||||
constexpr auto kSGDName = "SGD";
|
||||
constexpr auto kLARSUpdateName = "LARSUpdate";
|
||||
constexpr auto kAvgPoolOpName = "AvgPool";
|
||||
constexpr auto kBasicLSTMCellCStateGradOpName = "BasicLSTMCellCStateGrad";
|
||||
constexpr auto kBasicLSTMCellCStateGradV2OpName = "BasicLSTMCellCStateGradV2";
|
||||
constexpr auto kMatMulOpName = "MatMul";
|
||||
constexpr auto kMatMulV2OpName = "MatMulV2";
|
||||
constexpr auto kBasicLSTMCellInputGradOpName = "BasicLSTMCellInputGrad";
|
||||
constexpr auto kBasicLSTMCellOpName = "BasicLSTMCell";
|
||||
constexpr auto kBasicLSTMCellWeightGradOpName = "BasicLSTMCellWeightGrad";
|
||||
constexpr auto kBatchMatMulOpName = "BatchMatMul";
|
||||
constexpr auto kBatchMatMulV2OpName = "BatchMatMulV2";
|
||||
constexpr auto kBatchNorm = "BatchNorm";
|
||||
constexpr auto kBatchNormGradOpName = "BatchNormGrad";
|
||||
constexpr auto kBatchNormGradWithActivation = "BatchNormGradWithActivation";
|
||||
constexpr auto kBatchNormGradWithAddAndActivation = "BatchNormGradWithAddAndActivation";
|
||||
constexpr auto kBatchNormWithActivation = "BatchNormWithActivation";
|
||||
constexpr auto kBatchNormWithAddAndActivation = "BatchNormWithAddAndActivation";
|
||||
constexpr auto kBatchToSpaceOpName = "BatchToSpace";
|
||||
constexpr auto kBiasAddOpName = "BiasAdd";
|
||||
constexpr auto kBN2AddReluOpName = "BN2AddRelu";
|
||||
constexpr auto kBN2OpName = "BN2";
|
||||
constexpr auto kBN2ReLUOpName = "BN2Relu";
|
||||
constexpr auto kBNGrad1OpName = "BNGrad1";
|
||||
constexpr auto kBNGrad2OpName = "BNGrad2";
|
||||
constexpr auto kBNGrad3OpName = "BNGrad3";
|
||||
constexpr auto kBNInferGradOpName = "BNInferGrad";
|
||||
constexpr auto kBNInferOpName = "BNInfer";
|
||||
constexpr auto kBNTrainingReduceGradOpName = "BNTrainingReduceGrad";
|
||||
constexpr auto kBNTrainingReduceOpName = "BNTrainingReduce";
|
||||
constexpr auto kBNTrainingUpdateGradOpName = "BNTrainingUpdateGrad";
|
||||
constexpr auto kBNTrainingUpdateOpName = "BNTrainingUpdate";
|
||||
constexpr auto kBNTrainingUpdateV2OpName = "BNTrainingUpdateV2";
|
||||
constexpr auto kBNTrainingUpdateV3OpName = "BNTrainingUpdateV3";
|
||||
constexpr auto kBpropCutOpName = "bprop_cut";
|
||||
constexpr auto kBroadcastOpName = "Broadcast";
|
||||
constexpr auto kBroadcastToOpName = "BroadcastTo";
|
||||
constexpr auto kFusedAddReluV2Name = "FusedAddReluV2";
|
||||
constexpr auto kFusedAddReluGradV2Name = "FusedAddReluGradV2";
|
||||
constexpr auto kDropoutOpName = "Dropout";
|
||||
constexpr auto kDropoutGradOpName = "DropoutGrad";
|
||||
constexpr auto kDropoutGenMaskOpName = "DropoutGenMask";
|
||||
constexpr auto kDropoutGenMaskV3OpName = "DropoutGenMaskV3";
|
||||
constexpr auto kCacheSwapTableOpName = "CacheSwapTable";
|
||||
constexpr auto kCallOpName = "call";
|
||||
constexpr auto kCastOpName = "Cast";
|
||||
constexpr auto kCentralizationOpName = "Centralization";
|
||||
constexpr auto kClearZeroOpName = "ClearZero";
|
||||
constexpr auto kClipByNormNoDivSumOpName = "ClipByNormNoDivSum";
|
||||
constexpr auto kClipByValueOpName = "ClipByValue";
|
||||
constexpr auto kCoalesceOpName = "Coalesce";
|
||||
constexpr auto kCombineMomentumOpName = "CombineMomentum";
|
||||
constexpr auto kCombineMomentumWeightOpName = "CombineMomentumWeight";
|
||||
constexpr auto kComputeAccidentalHitsOpName = "ComputeAccidentalHits";
|
||||
constexpr auto kConcatOpName = "Concat";
|
||||
constexpr auto kConfusionMulGradOpName = "ConfusionMulGrad";
|
||||
constexpr auto kConfusionSoftmaxGradOpName = "ConfusionSoftmaxGrad";
|
||||
constexpr auto kConfusionTransposeDOpName = "ConfusionTransposeD";
|
||||
constexpr auto kConv2DBackpropFilterOpName = "Conv2DBackpropFilter";
|
||||
constexpr auto kConv2DBackpropInputOpName = "Conv2DBackpropInput";
|
||||
constexpr auto kConv2DOpName = "Conv2D";
|
||||
constexpr auto kConv2DTransposeOpName = "Conv2DTranspose";
|
||||
constexpr auto kConv3DBackpropFilterOpName = "Conv3DBackpropFilter";
|
||||
constexpr auto kConv3DBackpropInputOpName = "Conv3DBackpropInput";
|
||||
constexpr auto kConv3DOpName = "Conv3D";
|
||||
constexpr auto kConv3DTransposeOpName = "Conv3DTranspose";
|
||||
constexpr auto kConvBN1OpName = "ConvBN1";
|
||||
constexpr auto kCOO2CSROpName = "COO2CSR";
|
||||
constexpr auto kCSR2COOOpName = "CSR2COO";
|
||||
constexpr auto kCSRDivOpName = "CSRDiv";
|
||||
constexpr auto kCSRGatherOpName = "CSRGather";
|
||||
constexpr auto kCSRMMOpName = "CSRMM";
|
||||
constexpr auto kCSRMulOpName = "CSRMul";
|
||||
constexpr auto kCSRMVOpName = "CSRMV";
|
||||
constexpr auto kCSRReduceSumOpName = "CSRReduceSum";
|
||||
constexpr auto kCSRSparseMatrixToSparseTensorOpName = "CSRSparseMatrixToSparseTensor";
|
||||
constexpr auto kCTCGreedyDecoderOpName = "CTCGreedyDecoder";
|
||||
constexpr auto kCumprodOpName = "Cumprod";
|
||||
constexpr auto kCumProdOpName = "CumProd";
|
||||
constexpr auto kCumsumOpName = "Cumsum";
|
||||
constexpr auto kCumSumOpName = "CumSum";
|
||||
constexpr auto kDeadNodeName = "DeadNode";
|
||||
constexpr auto kDenseToDenseSetOperation = "DenseToDenseSetOperation";
|
||||
constexpr auto kDepthwiseConv2dNativeBackpropFilterOpName = "DepthwiseConv2dNativeBackpropFilter";
|
||||
constexpr auto kDepthwiseConv2dNativeBackpropInputOpName = "DepthwiseConv2dNativeBackpropInput";
|
||||
constexpr auto kDepthwiseConv2dNativeOpName = "DepthwiseConv2dNative";
|
||||
constexpr auto kDivOpName = "Div";
|
||||
constexpr auto kDropoutDoMaskOpName = "DropoutDoMask";
|
||||
constexpr auto kDropoutDoMaskV3OpName = "DropoutDoMaskV3";
|
||||
constexpr auto kSoftmaxV2WithDropoutDoMaskV3OpName = "SoftmaxV2WithDropoutDoMaskV3";
|
||||
constexpr auto kGammaOpName = "Gamma";
|
||||
constexpr auto kPoissonOpName = "Poisson";
|
||||
constexpr auto kStandardLaplaceOpName = "StandardLaplace";
|
||||
constexpr auto kStandardNormalOpName = "StandardNormal";
|
||||
constexpr auto kUniformIntOpName = "UniformInt";
|
||||
constexpr auto kUniformRealOpName = "UniformReal";
|
||||
constexpr auto kSubAndFilterOpName = "SubAndFilter";
|
||||
constexpr auto kPadAndShiftOpName = "PadAndShift";
|
||||
constexpr auto kSparseSoftmaxCrossEntropyWithLogitsOpName = "SparseSoftmaxCrossEntropyWithLogits";
|
||||
constexpr auto kOneHotOpName = "OneHot";
|
||||
constexpr auto kSigmoidOpName = "Sigmoid";
|
||||
constexpr auto kSoftmaxCrossEntropyWithLogitsOpName = "SoftmaxCrossEntropyWithLogits";
|
||||
constexpr auto kUniformCandidateSamplerOpName = "UniformCandidateSampler";
|
||||
constexpr auto kLogSoftmaxGradOpName = "LogSoftmaxGrad";
|
||||
constexpr auto kLayerNormGradOpName = "LayerNormGrad";
|
||||
constexpr auto kMinimumGradOpName = "MinimumGrad";
|
||||
constexpr auto kMaximumGradOpName = "MaximumGrad";
|
||||
constexpr auto kFusedDbnDwOpName = "FusedDbnDw";
|
||||
constexpr auto kNPUAllocFloatStatusOpName = "NPUAllocFloatStatus";
|
||||
constexpr auto kNPUGetFloatStatusOpName = "NPUGetFloatStatus";
|
||||
constexpr auto kNPUClearFloatStatusOpName = "NPUClearFloatStatus";
|
||||
constexpr auto kAssignOpName = "Assign";
|
||||
constexpr auto kScatterAddOpName = "ScatterAdd";
|
||||
constexpr auto kScatterUpdateOpName = "ScatterUpdate";
|
||||
constexpr auto kDropoutGenMaskOpName = "DropoutGenMask";
|
||||
constexpr auto kDropoutGenMaskV3OpName = "DropoutGenMaskV3";
|
||||
constexpr auto kDropoutGradOpName = "DropoutGrad";
|
||||
constexpr auto kDropoutOpName = "Dropout";
|
||||
constexpr auto kDynamicAtomicAddrCleanOpName = "DynamicAtomicAddrClean";
|
||||
constexpr auto kDynamicGRUV2OpName = "DynamicGRUV2";
|
||||
constexpr auto kDynamicRNNOpName = "DynamicRNN";
|
||||
constexpr auto kDynamicStitchOpName = "DynamicStitch";
|
||||
constexpr auto kEmbeddingLookupCommGradOpName = "EmbeddingLookupCommGrad";
|
||||
constexpr auto kEmbeddingLookupOpName = "EmbeddingLookup";
|
||||
constexpr auto kEmbeddingLookupProxyOpName = "EmbeddingLookupProxy";
|
||||
constexpr auto kEndGraph = "EndGraph";
|
||||
constexpr auto kEndOfSequence = "EndOfSequence";
|
||||
constexpr auto kEnvironCreateOpName = "EnvironCreate";
|
||||
constexpr auto kEnvironSetOpName = "EnvironSet";
|
||||
constexpr auto kEnvironGetOpName = "EnvironGet";
|
||||
constexpr auto kEnvironDestroyAllOpName = "EnvironDestroyAll";
|
||||
constexpr auto kEnvironGetOpName = "EnvironGet";
|
||||
constexpr auto kEnvironSetOpName = "EnvironSet";
|
||||
constexpr auto kEqualOpName = "Equal";
|
||||
constexpr auto kErfOpName = "Erf";
|
||||
constexpr auto kExpandDimsOpName = "ExpandDims";
|
||||
constexpr auto kExpOpName = "Exp";
|
||||
constexpr auto kExtractGlimpse = "ExtractGlimpse";
|
||||
constexpr auto kExtractImagePatchesOpName = "ExtractImagePatches";
|
||||
constexpr auto kEyeOpName = "Eye";
|
||||
constexpr auto kFive2FourOpName = "Five2Four";
|
||||
constexpr auto kFlattenGradOpName = "FlattenGrad";
|
||||
constexpr auto kFour2FiveOpName = "Four2Five";
|
||||
constexpr auto kFractionalAvgPoolGradOpName = "FractionalAvgPoolGrad";
|
||||
constexpr auto kFusedAdaFactorName = "FusedAdaFactor";
|
||||
constexpr auto kFusedAdaFactorWithGlobalNormName = "FusedAdaFactorWithGlobalNorm";
|
||||
constexpr auto kFusedAdamName = "FusedAdam";
|
||||
constexpr auto kFusedAdamWeightDecayName = "FusedAdamWeightDecay";
|
||||
constexpr auto kFusedAddReluGradV2Name = "FusedAddReluGradV2";
|
||||
constexpr auto kFusedAddReluV2Name = "FusedAddReluV2";
|
||||
constexpr auto kFusedBN1OpName = "FusedBN1";
|
||||
constexpr auto kFusedBN2OpName = "FusedBN2";
|
||||
constexpr auto kFusedBN3OpName = "FusedBN3";
|
||||
constexpr auto kFusedCastAdamWeightDecayName = "FusedCastAdamWeightDecay";
|
||||
constexpr auto kFusedDbnDwOpName = "FusedDbnDw";
|
||||
constexpr auto kFusedMatMulBiasAddName = "FusedMatMulBiasAdd";
|
||||
constexpr auto kFusedMulAddNOpName = "FusedMulAddN";
|
||||
constexpr auto kFusedMulAddOpName = "FusedMulAdd";
|
||||
constexpr auto kFusedMulApplyMomentumOpName = "FusedMulApplyMomentum";
|
||||
constexpr auto kFusedPullWeightOpName = "FusedPullWeight";
|
||||
constexpr auto kFusedPushWeightOpName = "FusedPushWeight";
|
||||
constexpr auto kFusedScaleApplyMomentum = "FusedScaleApplyMomentum";
|
||||
constexpr auto kFusedSparseAdamName = "FusedSparseAdam";
|
||||
constexpr auto kFusedSparseFtrlName = "FusedSparseFtrl";
|
||||
constexpr auto kFusedSparseLazyAdamName = "FusedSparseLazyAdam";
|
||||
constexpr auto kFusedSparseProximalAdagradName = "FusedSparseProximalAdagrad";
|
||||
constexpr auto kFusedWeightApplyMomentum = "FusedWeightApplyMomentum";
|
||||
constexpr auto kFusedWeightScaleApplyMomentum = "FusedWeightScaleApplyMomentum";
|
||||
constexpr auto kFusionOpConv2DBackpropInputAddNReluGradV2Name = "FusionOp_Conv2DBackpropInput_AddN_ReluGradV2";
|
||||
constexpr auto kFusionOpConv2DBackpropInputReluGradV2Name = "FusionOp_Conv2DBackpropInput_ReluGradV2";
|
||||
constexpr auto kGammaOpName = "Gamma";
|
||||
constexpr auto kGatherDGradV2OpName = "GatherDGradV2";
|
||||
constexpr auto kGatherDOpName = "GatherD";
|
||||
constexpr auto kGatherOpName = "Gather";
|
||||
constexpr auto kGatherV2OpName = "Gather";
|
||||
constexpr auto kGetNextOpName = "GetNext";
|
||||
constexpr auto kGreaterEqualOpName = "GreaterEqual";
|
||||
constexpr auto kGreaterOpName = "Greater";
|
||||
constexpr auto kGRUV2HiddenGradCellOpName = "GRUV2HiddenGradCell";
|
||||
constexpr auto kGRUV2HiddenGradOpName = "GRUV2HiddenGrad";
|
||||
constexpr auto kHcomSendOpName = "Send";
|
||||
constexpr auto kHostAllGatherOpName = "HostAllGather";
|
||||
constexpr auto kHostReduceScatterOpName = "HostReduceScatter";
|
||||
constexpr auto kInitDatasetQueueOpName = "InitDataSetQueue";
|
||||
constexpr auto kInplaceAddOpName = "InplaceAdd";
|
||||
constexpr auto kInplaceSubOpName = "InplaceSub";
|
||||
constexpr auto kInstanceNorm = "InstanceNorm";
|
||||
constexpr auto kKLDivLossOpName = "KLDivLoss";
|
||||
constexpr auto kLabelGotoOpName = "LabelGoto";
|
||||
constexpr auto kLabelSetOpName = "LabelSet";
|
||||
constexpr auto kLabelSwitchOpName = "LabelSwitch";
|
||||
constexpr auto kLambNextMVOpName = "LambNextMV";
|
||||
constexpr auto kLambNextMVWithDecayOpName = "LambNextMVWithDecay";
|
||||
constexpr auto kLambNextMVWithDecayV1OpName = "LambNextMVWithDecayV1";
|
||||
constexpr auto kLambNextRightOpName = "LambNextRight";
|
||||
constexpr auto kLambUpdateWithLROpName = "LambUpdateWithLR";
|
||||
constexpr auto kLambUpdateWithLrV2OpName = "LambUpdateWithLrV2";
|
||||
constexpr auto kLARSUpdateName = "LARSUpdate";
|
||||
constexpr auto kLarsV2OpName = "LarsV2";
|
||||
constexpr auto kLarsV2UpdateOpName = "LarsV2Update";
|
||||
constexpr auto kLayerNormBetaGammaBackpropOpName = "LayerNormBetaGammaBackprop";
|
||||
constexpr auto kLayerNormBetaGammaBackpropV2OpName = "LayerNormBetaGammaBackpropV2";
|
||||
constexpr auto kLayerNormGradOpName = "LayerNormGrad";
|
||||
constexpr auto kLayerNormXBackpropOpName = "LayerNormXBackprop";
|
||||
constexpr auto kLayerNormXBackpropV2OpName = "LayerNormXBackpropV2";
|
||||
constexpr auto kLessEqualOpName = "LessEqual";
|
||||
constexpr auto kLessOpName = "Less";
|
||||
constexpr auto kLinSpaceOpName = "LinSpace";
|
||||
constexpr auto kListDiffOpName = "ListDiff";
|
||||
constexpr auto kLogOpName = "Log";
|
||||
constexpr auto kLogSoftmaxGradOpName = "LogSoftmaxGrad";
|
||||
constexpr auto kLSTMGradOpName = "LSTMGrad";
|
||||
constexpr auto kLSTMInputGradOpName = "LSTMInputGrad";
|
||||
constexpr auto kLSTMOpName = "LSTM";
|
||||
constexpr auto kLuUnpackOpName = "LuUnpack";
|
||||
constexpr auto kMaskedSelectOpName = "MaskedSelect";
|
||||
constexpr auto kMatMulOpName = "MatMul";
|
||||
constexpr auto kMatMulV2OpName = "MatMulV2";
|
||||
constexpr auto kMaximumGradOpName = "MaximumGrad";
|
||||
constexpr auto kMaximumOpName = "Maximum";
|
||||
constexpr auto kMaxPool3DGradGradOpName = "MaxPool3DGradGrad";
|
||||
constexpr auto kMaxPool3DGradOpName = "MaxPool3DGrad";
|
||||
constexpr auto kMaxPool3DOpName = "MaxPool3D";
|
||||
constexpr auto kMaxPoolGradOpName = "MaxPoolGrad";
|
||||
constexpr auto kMaxPoolGradWithArgmaxOpName = "MaxPoolGradWithArgmax";
|
||||
constexpr auto kMaxPoolOpName = "MaxPool";
|
||||
constexpr auto kMaxPoolWithArgmaxOpName = "MaxPoolWithArgmax";
|
||||
constexpr auto kMeanGradOpName = "MeanGrad";
|
||||
constexpr auto kMemCpyAsyncOpName = "memcpy_async";
|
||||
constexpr auto kMinimumGradOpName = "MinimumGrad";
|
||||
constexpr auto kMinimumOpName = "Minimum";
|
||||
constexpr auto kMomentumOpName = "Momentum";
|
||||
constexpr auto kMulOpName = "Mul";
|
||||
constexpr auto kMuxReceiveOpName = "MuxReceive";
|
||||
constexpr auto kMuxSendOpName = "MuxSend";
|
||||
constexpr auto kNegOpName = "Neg";
|
||||
constexpr auto kNMSWithMaskOpName = "NMSWithMask";
|
||||
constexpr auto kNonDeterministicInts = "NonDeterministicInts";
|
||||
constexpr auto kResizeBicubicOpName = "ResizeBicubic";
|
||||
constexpr auto kUpdateStateOpName = "UpdateState";
|
||||
constexpr auto kTruncatedNormal = "TruncatedNormal";
|
||||
constexpr auto kNonMaxSuppressionV3OpName = "NonMaxSuppressionV3";
|
||||
constexpr auto kNonZeroOpName = "NonZero";
|
||||
constexpr auto kNPUAllocFloatStatusOpName = "NPUAllocFloatStatus";
|
||||
constexpr auto kNPUClearFloatStatusOpName = "NPUClearFloatStatus";
|
||||
constexpr auto kNPUGetFloatStatusOpName = "NPUGetFloatStatus";
|
||||
constexpr auto kOneHotOpName = "OneHot";
|
||||
constexpr auto kPadAndShiftOpName = "PadAndShift";
|
||||
constexpr auto kPaddingOpName = "Padding";
|
||||
constexpr auto kPadOpName = "Pad";
|
||||
constexpr auto kParallelResizeBilinearGradOpName = "ParallelResizeBilinearGrad";
|
||||
constexpr auto kPartialOpName = "partial";
|
||||
constexpr auto kPoissonOpName = "Poisson";
|
||||
constexpr auto kPolyNodeName = "PolyNode";
|
||||
constexpr auto kPoolingOpName = "Pooling";
|
||||
constexpr auto kPowOpName = "Pow";
|
||||
constexpr auto kPReluOpName = "PReLU";
|
||||
constexpr auto kPriorityReplayBufferCreate = "PriorityReplayBufferCreate";
|
||||
constexpr auto kPriorityReplayBufferDestroy = "PriorityReplayBufferDestroy";
|
||||
constexpr auto kPriorityReplayBufferPush = "PriorityReplayBufferPush";
|
||||
constexpr auto kPriorityReplayBufferSample = "PriorityReplayBufferSample";
|
||||
constexpr auto kPriorityReplayBufferUpdate = "PriorityReplayBufferUpdate";
|
||||
constexpr auto kPriorityReplayBufferDestroy = "PriorityReplayBufferDestroy";
|
||||
constexpr auto kPullOpName = "Pull";
|
||||
constexpr auto kPullWeightOpName = "PullWeight";
|
||||
constexpr auto kPushOpName = "Push";
|
||||
constexpr auto kPushWeightOpName = "PushWeight";
|
||||
constexpr auto kRandomShuffle = "RandomShuffle";
|
||||
constexpr auto kRealDivOpName = "RealDiv";
|
||||
constexpr auto kReceiveOpName = "Receive";
|
||||
constexpr auto kReciprocalOpName = "Reciprocal";
|
||||
constexpr auto kRecvOpName = "StreamRecv";
|
||||
constexpr auto kReduceAllOpName = "ReduceAll";
|
||||
constexpr auto kReduceAnyOpName = "ReduceAny";
|
||||
constexpr auto kReduceMaxOpName = "ReduceMax";
|
||||
constexpr auto kReduceMeanOpName = "ReduceMean";
|
||||
constexpr auto kReduceMinOpName = "ReduceMin";
|
||||
constexpr auto kReduceProdOpName = "ReduceProd";
|
||||
constexpr auto kReduceScatterOpName = "ReduceScatter";
|
||||
constexpr auto kReduceSumOpName = "ReduceSum";
|
||||
constexpr auto kReluGradOpName = "ReluGrad";
|
||||
constexpr auto kReluGradV2OpName = "ReluGradV2";
|
||||
constexpr auto kReluOpName = "ReLU";
|
||||
constexpr auto kReluV2OpName = "ReLUV2";
|
||||
constexpr auto kRenormOpName = "Renorm";
|
||||
constexpr auto kReservoirReplayBufferCreate = "ReservoirReplayBufferCreate";
|
||||
constexpr auto kReservoirReplayBufferDestroy = "ReservoirReplayBufferDestroy";
|
||||
constexpr auto kReservoirReplayBufferPush = "ReservoirReplayBufferPush";
|
||||
constexpr auto kReservoirReplayBufferSample = "ReservoirReplayBufferSample";
|
||||
constexpr auto kReservoirReplayBufferDestroy = "ReservoirReplayBufferDestroy";
|
||||
constexpr auto kDenseToDenseSetOperation = "DenseToDenseSetOperation";
|
||||
constexpr auto kReshapeOpName = "Reshape";
|
||||
constexpr auto kResizeAreaOpName = "ResizeArea";
|
||||
constexpr auto kNonZeroOpName = "NonZero";
|
||||
constexpr auto kExtractGlimpse = "ExtractGlimpse";
|
||||
constexpr auto kConv3DTransposeOpName = "Conv3DTranspose";
|
||||
constexpr auto kParallelResizeBilinearGradOpName = "ParallelResizeBilinearGrad";
|
||||
constexpr auto kArgminV2OpName = "ArgminV2";
|
||||
constexpr auto kCentralizationOpName = "Centralization";
|
||||
constexpr auto kGatherOpName = "Gather";
|
||||
constexpr auto kGatherDOpName = "GatherD";
|
||||
constexpr auto kEmbeddingLookupCommGradOpName = "EmbeddingLookupCommGrad";
|
||||
constexpr auto kResizeBicubicOpName = "ResizeBicubic";
|
||||
constexpr auto kResizeBilinearV2OpName = "kResizeBilinearV2";
|
||||
constexpr auto kResizeNearestNeighborGradOpName = "ResizeNearestNeighborGrad";
|
||||
constexpr auto kResizeNearestNeighborV2GradOpName = "ResizeNearestNeighborV2Grad";
|
||||
constexpr auto kResizeNearestNeighborV2OpName = "ResizeNearestNeighborV2";
|
||||
constexpr auto kReturnOpName = "Return";
|
||||
constexpr auto kRpcRecvOpName = "RpcRecv";
|
||||
constexpr auto kRpcSendOpName = "RpcSend";
|
||||
constexpr auto kRsqrtGradOpName = "RsqrtGrad";
|
||||
constexpr auto kRsqrtOpName = "Rsqrt";
|
||||
constexpr auto kScatterAddOpName = "ScatterAdd";
|
||||
constexpr auto kScatterNdOpName = "ScatterNd";
|
||||
constexpr auto kScatterNdUpdateOpName = "ScatterNdUpdate";
|
||||
constexpr auto kScatterUpdateOpName = "ScatterUpdate";
|
||||
constexpr auto kSegmentMaxOpName = "SegmentMax";
|
||||
constexpr auto kSegmentMeanOpName = "SegmentMean";
|
||||
constexpr auto kSegmentMinOpName = "SegmentMin";
|
||||
constexpr auto kSegmentProdOpName = "SegmentProd";
|
||||
constexpr auto kSegmentSumOpName = "SegmentSum";
|
||||
constexpr auto kSelectOpName = "Select";
|
||||
constexpr auto kSendOpName = "StreamSend";
|
||||
constexpr auto kSGDName = "SGD";
|
||||
constexpr auto kSigmoidOpName = "Sigmoid";
|
||||
constexpr auto kSimpleMeanGradOpName = "SimpleMeanGrad";
|
||||
constexpr auto kSliceGradOpName = "SliceGrad";
|
||||
constexpr auto kSliceOpName = "Slice";
|
||||
constexpr auto kSoftmaxCrossEntropyWithLogitsOpName = "SoftmaxCrossEntropyWithLogits";
|
||||
constexpr auto kSoftmaxGradExtOpName = "SoftmaxGradExt";
|
||||
constexpr auto kSoftmaxV2WithDropoutDoMaskV3OpName = "SoftmaxV2WithDropoutDoMaskV3";
|
||||
constexpr auto kSortOpName = "Sort";
|
||||
constexpr auto kSpaceToBatchOpName = "SpaceToBatch";
|
||||
constexpr auto kSpaceToDepthOpName = "SpaceToDepth";
|
||||
constexpr auto kSparseApplyAdadeltaOpName = "SparseApplyAdadelta";
|
||||
constexpr auto kSparseApplyAdagradOpName = "SparseApplyAdagrad";
|
||||
constexpr auto kSparseApplyAdagradV2OpName = "SparseApplyAdagradV2";
|
||||
constexpr auto kSparseApplyFtrlName = "SparseApplyFtrl";
|
||||
constexpr auto kSparseApplyFtrlOpName = "SparseApplyFtrl";
|
||||
constexpr auto kSparseApplyFtrlV2Name = "SparseApplyFtrlV2";
|
||||
constexpr auto kSparseApplyFtrlV2OpName = "SparseApplyFtrlV2";
|
||||
constexpr auto kSparseApplyProximalAdagradOpName = "SparseApplyProximalAdagrad";
|
||||
constexpr auto kSparseApplyRMSPropOpName = "SparseApplyRMSProp";
|
||||
constexpr auto kSparseGatherV2OpName = "SparseGatherV2";
|
||||
constexpr auto kSparseSoftmaxCrossEntropyWithLogitsOpName = "SparseSoftmaxCrossEntropyWithLogits";
|
||||
constexpr auto kSparseSparseMinimumOpName = "SparseSparseMinimum";
|
||||
constexpr auto kSplitOpName = "Split";
|
||||
constexpr auto kSplitVOpName = "SplitV";
|
||||
constexpr auto kSqrtOpName = "Sqrt";
|
||||
constexpr auto kSquareOpName = "Square";
|
||||
constexpr auto kSquareSumAllOpName = "SquareSumAll";
|
||||
constexpr auto kSquareSumV1OpName = "SquareSumV1";
|
||||
constexpr auto kSquareSumV2OpName = "SquareSumV2";
|
||||
constexpr auto kStackDestroyOpName = "StackDestroy";
|
||||
constexpr auto kStackInitOpName = "StackInit";
|
||||
constexpr auto kStackOpName = "Stack";
|
||||
constexpr auto kStackPopOpName = "StackPop";
|
||||
constexpr auto kStackPushOpName = "StackPush";
|
||||
constexpr auto kStandardLaplaceOpName = "StandardLaplace";
|
||||
constexpr auto kStandardNormalOpName = "StandardNormal";
|
||||
constexpr auto kStreamActiveOpName = "StreamActive";
|
||||
constexpr auto kStreamSwitchOpName = "StreamSwitch";
|
||||
constexpr auto kStridedReadOpName = "StridedRead";
|
||||
constexpr auto kStridedSliceAssignOpName = "StridedSliceAssign";
|
||||
constexpr auto kStridedSliceGradOpName = "StridedSliceGrad";
|
||||
constexpr auto kStridedSliceOpName = "StridedSlice";
|
||||
constexpr auto kStridedWriteOpName = "StridedWrite";
|
||||
constexpr auto kSubAndFilterOpName = "SubAndFilter";
|
||||
constexpr auto kSubOpName = "Sub";
|
||||
constexpr auto kSubscalarOpName = "Subscalar";
|
||||
constexpr auto kUnsortedSegmentSumOpName = "UnsortedSegmentSum";
|
||||
constexpr auto kCumSumOpName = "CumSum";
|
||||
constexpr auto kCumProdOpName = "CumProd";
|
||||
constexpr auto kSwitchOpName = "Switch";
|
||||
constexpr auto kTensorAddOpName = "Add";
|
||||
constexpr auto kTensorCopySlicesOpName = "TensorCopySlices";
|
||||
constexpr auto kTensorMoveOpName = "TensorMove";
|
||||
constexpr auto kTensorScatterUpdateOpName = "TensorScatterUpdate";
|
||||
constexpr auto kTileOpName = "Tile";
|
||||
constexpr auto kTopKOpName = "TopK";
|
||||
constexpr auto kTransDataOpName = "TransData";
|
||||
constexpr auto kTransDataRNNOpName = "TransDataRNN";
|
||||
constexpr auto kTransposeNODOpName = "TransposeNOD";
|
||||
constexpr auto kTransposeOpName = "Transpose";
|
||||
constexpr auto kTruncatedNormal = "TruncatedNormal";
|
||||
constexpr auto kUniformCandidateSamplerOpName = "UniformCandidateSampler";
|
||||
constexpr auto kUniformIntOpName = "UniformInt";
|
||||
constexpr auto kUniformRealOpName = "UniformReal";
|
||||
constexpr auto kUniqueConsecutiveOpName = "UniqueConsecutive";
|
||||
constexpr auto kUniqueOpName = "Unique";
|
||||
constexpr auto kUnsortedSegmentMaxOpName = "UnsortedSegmentMax";
|
||||
constexpr auto kCSRReduceSumOpName = "CSRReduceSum";
|
||||
constexpr auto kCSRMVOpName = "CSRMV";
|
||||
constexpr auto kCSRMMOpName = "CSRMM";
|
||||
constexpr auto kCSRMulOpName = "CSRMul";
|
||||
constexpr auto kCSRDivOpName = "CSRDiv";
|
||||
constexpr auto kCSRGatherOpName = "CSRGather";
|
||||
constexpr auto kCSR2COOOpName = "CSR2COO";
|
||||
constexpr auto kCOO2CSROpName = "COO2CSR";
|
||||
constexpr auto kRandomShuffle = "RandomShuffle";
|
||||
constexpr auto kUnsortedSegmentMinOpName = "UnsortedSegmentMin";
|
||||
constexpr auto kUnsortedSegmentProdOpName = "UnsortedSegmentProd";
|
||||
constexpr auto kUnsortedSegmentSumOpName = "UnsortedSegmentSum";
|
||||
constexpr auto kUpdateCacheOpName = "UpdateCache";
|
||||
constexpr auto kUpdateStateOpName = "UpdateState";
|
||||
|
||||
// Communication world group
|
||||
constexpr auto kNcclWorldGroup = "nccl_world_group";
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <vector>
|
||||
#include "pipeline/pynative/pynative_cache.h"
|
||||
#include "backend/common/optimizer/helper.h"
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
#include "pybind_api/ir/primitive_py.h"
|
||||
#include "utils/ms_context.h"
|
||||
#include "ir/cell.h"
|
||||
|
@ -476,12 +476,12 @@ bool DataConvert::NeedConvertConstInputToAttr(const FrontendOpRunInfoPtr &op_run
|
|||
return !input_to_attr_ptr->empty();
|
||||
}
|
||||
|
||||
// Ascend const input to attr move to AscendConvertConstInputToAttr
|
||||
// Ascend const input to attr move to AscendVmOpAdapter
|
||||
if (device_target == kAscendDevice) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto reg_info = opt::ConvertOpInfoRegister::GetInstance().GetConvertOpInfo(
|
||||
auto reg_info = opt::OpAdaptationInfoRegister::GetInstance().GetOpAdaptationInfo(
|
||||
op_run_info->base_op_run_info.op_name, device_target, PyNativeAlgo::Common::IsDynamicShape(op_run_info));
|
||||
if (reg_info == nullptr) {
|
||||
return false;
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
#include "plugin/device/ascend/optimizer/mindir/bn_grad_unify_mindir.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/all_to_all_unify_mindir.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/neighbor_exchange_v2_unify_mindir.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_convert_const_input_to_attr.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_vm_op_adapter.h"
|
||||
#include "backend/common/pass/adjust_depend_for_parallel_optimizer_recompute_all_gather.h"
|
||||
#include "backend/common/pass/gradients_allreduce_depend_last_send.h"
|
||||
#include "backend/common/pass/optimize_gradients_allreduce_overlap.h"
|
||||
|
@ -685,7 +685,7 @@ void AscendUnifyMindIR(const std::shared_ptr<session::KernelGraph> &kernel_graph
|
|||
unify_mindir_pm->AddPass(std::make_shared<opt::NeighborExchangeV2UnifyMindIR>());
|
||||
unify_mindir_pm->AddPass(std::make_shared<opt::NeighborExchangeV2GradUnifyMindIR>());
|
||||
unify_mindir_pm->AddPass(std::make_shared<opt::AllToAllUnifyMindIR>());
|
||||
unify_mindir_pm->AddPass(std::make_shared<opt::AscendConvertConstInputToAttr>());
|
||||
unify_mindir_pm->AddPass(std::make_shared<opt::AscendVmOpAdapter>());
|
||||
|
||||
optimizer->AddPassManager(unify_mindir_pm);
|
||||
(void)optimizer->Optimize(kernel_graph);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_convert_const_input_to_attr.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_vm_op_adapter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
@ -23,25 +23,25 @@
|
|||
#include "include/common/utils/utils.h"
|
||||
#include "include/common/utils/anfalgo.h"
|
||||
#include "plugin/device/ascend/optimizer/ascend_helper.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/reg_ascend_const_input_to_attr.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/reg_ascend_vm_op_adaptation_info.h"
|
||||
#include "plugin/device/ascend/kernel/tbe/tbe_dynamic_shape_util.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
const AnfNodePtr AscendConvertConstInputToAttr::Process(const FuncGraphPtr &, const AnfNodePtr &node,
|
||||
const EquivPtr &) const {
|
||||
const AnfNodePtr AscendVmOpAdapter::Process(const FuncGraphPtr &, const AnfNodePtr &node, const EquivPtr &) const {
|
||||
if (node == nullptr || !AnfUtils::IsRealCNodeKernel(node)) {
|
||||
return nullptr;
|
||||
}
|
||||
auto op_name = common::AnfAlgo::GetCNodeName(node);
|
||||
auto is_dynamic = common::AnfAlgo::IsDynamicShape(node);
|
||||
auto convert_op_info = ConvertOpInfoRegister::GetInstance().GetConvertOpInfo(op_name, kAscendDevice, is_dynamic);
|
||||
if (convert_op_info == nullptr) {
|
||||
auto op_adaptation_info =
|
||||
OpAdaptationInfoRegister::GetInstance().GetOpAdaptationInfo(op_name, kAscendDevice, is_dynamic);
|
||||
if (op_adaptation_info == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto origin_op = node->cast<CNodePtr>();
|
||||
MS_EXCEPTION_IF_NULL(origin_op);
|
||||
auto ret_node = ConvertToTargetOp(origin_op, convert_op_info);
|
||||
auto ret_node = ConvertToTargetOp(origin_op, op_adaptation_info);
|
||||
if ((ret_node != nullptr) && (ret_node != origin_op)) {
|
||||
MS_LOG(INFO) << "Replace op " << origin_op->fullname_with_scope() << " debug string:" << origin_op->DebugString()
|
||||
<< " with " << ret_node->fullname_with_scope() << " debug string:" << ret_node->DebugString()
|
||||
|
@ -50,11 +50,50 @@ const AnfNodePtr AscendConvertConstInputToAttr::Process(const FuncGraphPtr &, co
|
|||
return ret_node;
|
||||
}
|
||||
|
||||
CNodePtr AscendConvertConstInputToAttr::ConvertToTargetOp(const CNodePtr &origin_op,
|
||||
ConvertOpInfo *convert_op_info) const {
|
||||
CNodePtr AscendVmOpAdapter::ConvertToTargetOp(const CNodePtr &origin_op, OpAdaptationInfo *op_adaptation_info) const {
|
||||
MS_EXCEPTION_IF_NULL(origin_op);
|
||||
MS_EXCEPTION_IF_NULL(convert_op_info);
|
||||
auto pre_check_func = convert_op_info->GetPreCheckFunc();
|
||||
MS_EXCEPTION_IF_NULL(op_adaptation_info);
|
||||
auto origin_op_name = op_adaptation_info->GetOriginOpName();
|
||||
auto target_op_name = op_adaptation_info->GetTargetOpName();
|
||||
auto pre_check_func = op_adaptation_info->GetPreCheckFunc();
|
||||
auto need_tbe_check = op_adaptation_info->NeedTBECheck();
|
||||
auto input_to_attr_map = op_adaptation_info->GetInputAttrInfoMap();
|
||||
auto attr_name_map = op_adaptation_info->GetAttrNameInfoMap();
|
||||
// Rename the attrs
|
||||
if (!attr_name_map.empty()) {
|
||||
auto origin_primitive = GetCNodePrimitive(origin_op);
|
||||
MS_EXCEPTION_IF_NULL(origin_primitive);
|
||||
for (auto iter : attr_name_map) {
|
||||
if (origin_primitive->HasAttr(iter.first)) {
|
||||
auto value = origin_primitive->GetAttr(iter.first);
|
||||
origin_primitive->set_attr(iter.second, value);
|
||||
origin_primitive->EraseAttr(iter.first);
|
||||
MS_LOG(INFO) << "Rename attr " << iter.first << " to " << iter.second << " for op "
|
||||
<< origin_op->fullname_with_scope();
|
||||
} else {
|
||||
MS_LOG(ERROR) << "Node " << origin_op->fullname_with_scope() << " has no attr " << iter.first;
|
||||
return origin_op;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No need to check or const input to attr
|
||||
if ((!pre_check_func) && (!need_tbe_check) && (input_to_attr_map.empty())) {
|
||||
// Rename the op type
|
||||
if (target_op_name != origin_op_name) {
|
||||
auto origin_primitive = GetCNodePrimitive(origin_op);
|
||||
MS_EXCEPTION_IF_NULL(origin_primitive);
|
||||
origin_primitive->set_name(target_op_name);
|
||||
// reset full scope name
|
||||
origin_op->set_fullname_with_scope("");
|
||||
MS_LOG(INFO) << "Rename op type from " << origin_op << " to " << target_op_name << " for op "
|
||||
<< origin_op->fullname_with_scope();
|
||||
return origin_op;
|
||||
} else {
|
||||
return origin_op;
|
||||
}
|
||||
}
|
||||
|
||||
// check through op custom pre-check function
|
||||
if (pre_check_func != nullptr) {
|
||||
auto ret = pre_check_func(origin_op);
|
||||
|
@ -67,8 +106,7 @@ CNodePtr AscendConvertConstInputToAttr::ConvertToTargetOp(const CNodePtr &origin
|
|||
// check supported if the op need
|
||||
auto graph = origin_op->func_graph();
|
||||
auto kernel_graph = graph->cast<KernelGraphPtr>();
|
||||
auto is_need_check = convert_op_info->GetNeedCheckFlag();
|
||||
if (is_need_check) {
|
||||
if (need_tbe_check) {
|
||||
auto is_dynamic = common::AnfAlgo::IsDynamicShape(origin_op);
|
||||
// when cnode is a dynamic shape node, if origin op supported, use origin op
|
||||
if (is_dynamic) {
|
||||
|
@ -79,7 +117,7 @@ CNodePtr AscendConvertConstInputToAttr::ConvertToTargetOp(const CNodePtr &origin
|
|||
}
|
||||
}
|
||||
|
||||
auto target_op = CreateTargetOp(origin_op, convert_op_info);
|
||||
auto target_op = CreateTargetOp(origin_op, op_adaptation_info);
|
||||
if (target_op == nullptr) {
|
||||
MS_LOG(DEBUG) << "Create target op failed for node " << origin_op->fullname_with_scope();
|
||||
return origin_op;
|
||||
|
@ -95,7 +133,7 @@ CNodePtr AscendConvertConstInputToAttr::ConvertToTargetOp(const CNodePtr &origin
|
|||
}
|
||||
return target_op;
|
||||
} else {
|
||||
auto target_op = CreateTargetOp(origin_op, convert_op_info);
|
||||
auto target_op = CreateTargetOp(origin_op, op_adaptation_info);
|
||||
if (target_op == nullptr) {
|
||||
MS_LOG(DEBUG) << "Create target op failed for node " << origin_op->fullname_with_scope();
|
||||
return origin_op;
|
||||
|
@ -192,12 +230,11 @@ ValuePtr CreateValueFromTensor(const tensor::TensorPtr &tensor) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
CNodePtr AscendConvertConstInputToAttr::CreateTargetOp(const CNodePtr &origin_op,
|
||||
ConvertOpInfo *convert_op_info) const {
|
||||
CNodePtr AscendVmOpAdapter::CreateTargetOp(const CNodePtr &origin_op, OpAdaptationInfo *op_adaptation_info) const {
|
||||
MS_EXCEPTION_IF_NULL(origin_op);
|
||||
MS_EXCEPTION_IF_NULL(convert_op_info);
|
||||
auto target_op_name = convert_op_info->GetTargetOpName();
|
||||
auto input_attr_info_map = convert_op_info->GetInputAttrInfoMap();
|
||||
MS_EXCEPTION_IF_NULL(op_adaptation_info);
|
||||
auto target_op_name = op_adaptation_info->GetTargetOpName();
|
||||
auto input_attr_info_map = op_adaptation_info->GetInputAttrInfoMap();
|
||||
|
||||
auto origin_primitive = GetCNodePrimitive(origin_op);
|
||||
MS_EXCEPTION_IF_NULL(origin_primitive);
|
||||
|
@ -250,11 +287,11 @@ CNodePtr AscendConvertConstInputToAttr::CreateTargetOp(const CNodePtr &origin_op
|
|||
return target_op;
|
||||
}
|
||||
|
||||
bool AscendConvertConstInputToAttr::ConvertInputToAttr(const CNodePtr &origin_op, const string &target_op_name,
|
||||
const std::vector<std::string> &input_names_vec, size_t i,
|
||||
const std::shared_ptr<AnfNode> &input_node,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const std::shared_ptr<Primitive> &target_primitive) const {
|
||||
bool AscendVmOpAdapter::ConvertInputToAttr(const CNodePtr &origin_op, const string &target_op_name,
|
||||
const std::vector<std::string> &input_names_vec, size_t i,
|
||||
const std::shared_ptr<AnfNode> &input_node,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const std::shared_ptr<Primitive> &target_primitive) const {
|
||||
auto value_node = input_node->cast<ValueNodePtr>();
|
||||
MS_EXCEPTION_IF_NULL(value_node);
|
||||
MS_LOG(DEBUG) << "start erase input[" << i
|
||||
|
@ -282,9 +319,9 @@ bool AscendConvertConstInputToAttr::ConvertInputToAttr(const CNodePtr &origin_op
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string AscendConvertConstInputToAttr::GetAttrName(const string &target_op_name,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const string &input_name) const {
|
||||
std::string AscendVmOpAdapter::GetAttrName(const string &target_op_name,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const string &input_name) const {
|
||||
auto attr_name = iter->second.GetAttrName();
|
||||
if (attr_name.empty()) {
|
||||
MS_LOG(INFO) << "Attr name is empty for op " << target_op_name << ", use input name " << input_name << " instead.";
|
||||
|
@ -295,9 +332,9 @@ std::string AscendConvertConstInputToAttr::GetAttrName(const string &target_op_n
|
|||
return attr_name;
|
||||
}
|
||||
|
||||
ValuePtr AscendConvertConstInputToAttr::UpdateAttrValue(const CNodePtr &origin_op,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const ValuePtr &value, const string &attr_name) const {
|
||||
ValuePtr AscendVmOpAdapter::UpdateAttrValue(const CNodePtr &origin_op,
|
||||
const std::map<size_t, InputAttrInfo>::iterator &iter,
|
||||
const ValuePtr &value, const string &attr_name) const {
|
||||
ValuePtr ret = value;
|
||||
auto attr_dtype = iter->second.GetAttrDataType();
|
||||
if (attr_dtype.empty()) {
|
||||
|
@ -321,8 +358,7 @@ ValuePtr AscendConvertConstInputToAttr::UpdateAttrValue(const CNodePtr &origin_o
|
|||
return ret;
|
||||
}
|
||||
|
||||
ValuePtr AscendConvertConstInputToAttr::UpdateAttrValueByDtype(const ValuePtr &value,
|
||||
const std::string &attr_data_type) const {
|
||||
ValuePtr AscendVmOpAdapter::UpdateAttrValueByDtype(const ValuePtr &value, const std::string &attr_data_type) const {
|
||||
static std::set<std::string> kListDataType = {"listInt", "listStr", "listBool", "listFloat"};
|
||||
auto iter = kListDataType.find(attr_data_type);
|
||||
ValuePtr ret = value;
|
|
@ -24,21 +24,20 @@
|
|||
#include "utils/hash_set.h"
|
||||
#include "ir/anf.h"
|
||||
#include "backend/common/optimizer/optimizer.h"
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace opt {
|
||||
class AscendConvertConstInputToAttr : public PatternProcessPass {
|
||||
class AscendVmOpAdapter : public PatternProcessPass {
|
||||
public:
|
||||
explicit AscendConvertConstInputToAttr(bool multigraph = true)
|
||||
: PatternProcessPass("ascend_convert_const_input_to_attr", multigraph) {}
|
||||
~AscendConvertConstInputToAttr() override = default;
|
||||
explicit AscendVmOpAdapter(bool multigraph = true) : PatternProcessPass("ascend_vm_op_adapter", multigraph) {}
|
||||
~AscendVmOpAdapter() override = default;
|
||||
|
||||
const AnfNodePtr Process(const FuncGraphPtr &, const AnfNodePtr &node, const EquivPtr &) const override;
|
||||
|
||||
private:
|
||||
CNodePtr ConvertToTargetOp(const CNodePtr &origin_op, mindspore::opt::ConvertOpInfo *convert_op_info) const;
|
||||
CNodePtr CreateTargetOp(const CNodePtr &origin_op, ConvertOpInfo *convert_op_info) const;
|
||||
CNodePtr ConvertToTargetOp(const CNodePtr &origin_op, mindspore::opt::OpAdaptationInfo *op_adaptation_info) const;
|
||||
CNodePtr CreateTargetOp(const CNodePtr &origin_op, OpAdaptationInfo *op_adaptation_info) const;
|
||||
bool ConvertInputToAttr(const CNodePtr &origin_op, const string &target_op_name,
|
||||
const std::vector<std::string> &input_names_vec, size_t i,
|
||||
const std::shared_ptr<AnfNode> &input_node,
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef MINDSPORE_CCSRC_PLUGIN_DEVICE_ASCEND_OPTIMIZER_MINDIR_REG_ASCEND_CONST_INPUT_TO_ATTR_H_
|
||||
#define MINDSPORE_CCSRC_PLUGIN_DEVICE_ASCEND_OPTIMIZER_MINDIR_REG_ASCEND_CONST_INPUT_TO_ATTR_H_
|
||||
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
#define RER_ASCEND_STATIC_CONST_TO_ATTR(op_name, ...) RER_CONST_TO_ATTR_LIST(op_name, kAscendDevice, false, __VA_ARGS__)
|
||||
|
@ -98,12 +98,11 @@ RER_ASCEND_STATIC_CONST_TO_ATTR(kUnsortedSegmentProdOpName, 2);
|
|||
RER_ASCEND_STATIC_CONST_TO_ATTR(kUnsortedSegmentSumOpName, 2);
|
||||
|
||||
// =============================== new reg interface =================================================
|
||||
#define REG_ASCEND_CONST_TO_ATTR(origin_op_name, target_op_name) \
|
||||
REG_CONST_TO_ATTR(origin_op_name, target_op_name, kAscendDevice, false)
|
||||
#define REG_ASCEND_VM_OP_ADAPTATION_INFO(origin_op_name) REG_OP_ADAPTATION_INFO(origin_op_name, kAscendDevice, true)
|
||||
|
||||
// RTS OP
|
||||
REG_ASCEND_CONST_TO_ATTR(kTensorCopySlicesOpName, kTensorCopySlicesOpName)
|
||||
.SetNeedCheckSupported(false)
|
||||
REG_ASCEND_VM_OP_ADAPTATION_INFO(kTensorCopySlicesOpName)
|
||||
.SetTargetOpName(kTensorCopySlicesOpName)
|
||||
.SetInputAttrInfo(2, "begin", "listInt")
|
||||
.SetInputAttrInfo(3, "end", "listInt")
|
||||
.SetInputAttrInfo(4, "strides", "listInt");
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef MINDSPORE_CCSRC_PLUGIN_DEVICE_CPU_OPTIMIZER_REG_CPU_CONST_INPUT_TO_ATTR_H_
|
||||
#define MINDSPORE_CCSRC_PLUGIN_DEVICE_CPU_OPTIMIZER_REG_CPU_CONST_INPUT_TO_ATTR_H_
|
||||
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
#define RER_CPU_STATIC_CONST_TO_ATTR(op_name, ...) RER_CONST_TO_ATTR_LIST(op_name, kCPUDevice, false, __VA_ARGS__)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef MINDSPORE_CCSRC_PLUGIN_GPU_OPTIMIZER_REG_GPU_CONST_INPUT_TO_ATTR_H_
|
||||
#define MINDSPORE_CCSRC_PLUGIN_GPU_OPTIMIZER_REG_GPU_CONST_INPUT_TO_ATTR_H_
|
||||
|
||||
#include "backend/common/optimizer/const_input_to_attr_factory.h"
|
||||
#include "backend/common/optimizer/op_adaptation_info_factory.h"
|
||||
|
||||
namespace mindspore::opt {
|
||||
#define RER_GPU_STATIC_CONST_TO_ATTR(op_name, ...) RER_CONST_TO_ATTR_LIST(op_name, kGPUDevice, false, __VA_ARGS__)
|
||||
|
|
|
@ -45,6 +45,10 @@ class MS_CORE_API Named : public Value {
|
|||
///
|
||||
/// \return The name of object.
|
||||
const std::string &name() const { return name_; }
|
||||
/// \brief Setting name of object.
|
||||
///
|
||||
/// \no return.
|
||||
void set_name(const std::string &name) { name_ = name; }
|
||||
/// \brief Check whether two Named objects are the same.
|
||||
///
|
||||
/// \param[in] other The other Named to be compared with.
|
||||
|
@ -66,8 +70,8 @@ class MS_CORE_API Named : public Value {
|
|||
/// \brief Get hash id for named.
|
||||
///
|
||||
/// \return The restored hash id of Named.
|
||||
std::size_t Hash() const { return hash_id_; }
|
||||
std::size_t hash() const override { return hash_id_; }
|
||||
std::size_t Hash() const { return std::hash<std::string>{}(name_); }
|
||||
std::size_t hash() const override { return std::hash<std::string>{}(name_); }
|
||||
/// \brief Overloads operator << for Named.
|
||||
///
|
||||
/// \param os The output stream.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "common/backend_common_test.h"
|
||||
#include "common/py_func_graph_fetcher.h"
|
||||
#include "backend/common/optimizer/optimizer.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_convert_const_input_to_attr.h"
|
||||
#include "plugin/device/ascend/optimizer/mindir/ascend_vm_op_adapter.h"
|
||||
#include "plugin/device/ascend/optimizer/ir_fusion/confusion_softmax_grad_rule.h"
|
||||
#include "include/common/debug/anf_ir_dump.h"
|
||||
|
||||
|
@ -44,7 +44,7 @@ TEST_F(TestHWOptimizeConfusionSoftmaxGradRule, test_confusion_softmax_grad_rule)
|
|||
|
||||
auto optimizer = std::make_shared<opt::GraphOptimizer>();
|
||||
auto pm = std::make_shared<opt::PassManager>();
|
||||
pm->AddPass(std::make_shared<opt::AscendConvertConstInputToAttr>());
|
||||
pm->AddPass(std::make_shared<opt::AscendVmOpAdapter>());
|
||||
pm->AddPass(std::make_shared<opt::ConfusionSoftmaxGradRule>());
|
||||
optimizer->AddPassManager(pm);
|
||||
FuncGraphPtr new_graph = optimizer->Optimize(fg);
|
||||
|
|
Loading…
Reference in New Issue