| @@ -991,7 +991,7 @@ Status CaffeModelParser::AddTensorDescToOpDescByIr(ge::OpDescPtr &op_desc, const | |||||
| GELOGI("op [%s], type[%s], update output(%d) with name %s %s", | GELOGI("op [%s], type[%s], update output(%d) with name %s %s", | ||||
| op_desc->GetName().c_str(), op_desc->GetType().c_str(), | op_desc->GetName().c_str(), op_desc->GetType().c_str(), | ||||
| i, op_desc->GetOutputNameByIndex(i).c_str(), | i, op_desc->GetOutputNameByIndex(i).c_str(), | ||||
| ret == ge::GRAPH_SUCCESS ? "success" : "failed"); | |||||
| ret == ge::GRAPH_SUCCESS ? "success" : "not success"); | |||||
| } | } | ||||
| } | } | ||||
| return SUCCESS; | return SUCCESS; | ||||
| @@ -32,9 +32,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ConstantOperator &ConstantOpera | |||||
| } | } | ||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ConstantOperator &ConstantOperator::DType(ge::DataType t) { | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ConstantOperator &ConstantOperator::DType(ge::DataType t) { | ||||
| Attr(VAR_ATTR_DTYPE, (int64_t)t); | |||||
| Attr(VAR_ATTR_DTYPE, static_cast<int64_t>(t)); | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| ge::DataType ConstantOperator::GetDType() const { return (ge::DataType)GetIntAttr(VAR_ATTR_DTYPE); } | |||||
| ge::DataType ConstantOperator::GetDType() const { return static_cast<ge::DataType>(GetIntAttr(VAR_ATTR_DTYPE)); } | |||||
| } // namespace ge | } // namespace ge | ||||
| @@ -32,7 +32,7 @@ static void ConvertList(const std::pair<std::string, OpAttribute> &op_attr_pair, | |||||
| vector<int64_t> v_i; | vector<int64_t> v_i; | ||||
| for (int32_t i = 0; i < a_list.i_size(); i++) { | for (int32_t i = 0; i < a_list.i_size(); i++) { | ||||
| v_i.push_back((int64_t)a_list.i(i)); | |||||
| v_i.push_back(static_cast<int64_t>(a_list.i(i))); | |||||
| } | } | ||||
| if (v_i.size() > 0) { | if (v_i.size() > 0) { | ||||
| (void)ge::AttrUtils::SetListInt(op_def, op_attr_pair.first, v_i); | (void)ge::AttrUtils::SetListInt(op_def, op_attr_pair.first, v_i); | ||||
| @@ -56,7 +56,7 @@ static void ConvertList(const std::pair<std::string, OpAttribute> &op_attr_pair, | |||||
| } | } | ||||
| vector<int32_t> v_u; | vector<int32_t> v_u; | ||||
| for (int32_t i = 0; i < a_list.u_size(); i++) { | for (int32_t i = 0; i < a_list.u_size(); i++) { | ||||
| v_u.push_back((int32_t)a_list.u(i)); | |||||
| v_u.push_back(static_cast<int32_t>(a_list.u(i))); | |||||
| } | } | ||||
| if (v_u.size() > 0) { | if (v_u.size() > 0) { | ||||
| (void)ge::AttrUtils::SetListInt(op_def, op_attr_pair.first, v_u); | (void)ge::AttrUtils::SetListInt(op_def, op_attr_pair.first, v_u); | ||||
| @@ -23,7 +23,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY RefSwitchOperator::RefSwitchOpe | |||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY RefSwitchOperator::~RefSwitchOperator() {} | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY RefSwitchOperator::~RefSwitchOperator() {} | ||||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY RefSwitchOperator &RefSwitchOperator::T(ge::DataType t) { | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY RefSwitchOperator &RefSwitchOperator::T(ge::DataType t) { | ||||
| Attr("T", (int64_t)t); | |||||
| Attr("T", static_cast<int64_t>(t)); | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| } // namespace ge AUTO GEN PLEASE DO NOT MODIFY IT | } // namespace ge AUTO GEN PLEASE DO NOT MODIFY IT | ||||
| @@ -32,20 +32,20 @@ FMK_FUNC_HOST_VISIBILITY ShapeNOperator &ShapeNOperator::N(int64_t n) { | |||||
| FMK_FUNC_HOST_VISIBILITY int64_t ShapeNOperator::GetN() const { return GetIntAttr(SHAPEN_ATTR_N); } | FMK_FUNC_HOST_VISIBILITY int64_t ShapeNOperator::GetN() const { return GetIntAttr(SHAPEN_ATTR_N); } | ||||
| FMK_FUNC_HOST_VISIBILITY ShapeNOperator &ShapeNOperator::InType(ge::DataType t) { | FMK_FUNC_HOST_VISIBILITY ShapeNOperator &ShapeNOperator::InType(ge::DataType t) { | ||||
| Attr(SHAPEN_ATTR_IN_TYPE, (int64_t)t); | |||||
| Attr(SHAPEN_ATTR_IN_TYPE, static_cast<int64_t>(t)); | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| FMK_FUNC_HOST_VISIBILITY ge::DataType ShapeNOperator::GetInType() const { | FMK_FUNC_HOST_VISIBILITY ge::DataType ShapeNOperator::GetInType() const { | ||||
| return (ge::DataType)GetIntAttr(SHAPEN_ATTR_IN_TYPE); | |||||
| return static_cast<ge::DataType>(GetIntAttr(SHAPEN_ATTR_IN_TYPE)); | |||||
| } | } | ||||
| FMK_FUNC_HOST_VISIBILITY ShapeNOperator &ShapeNOperator::OutType(ge::DataType t) { | FMK_FUNC_HOST_VISIBILITY ShapeNOperator &ShapeNOperator::OutType(ge::DataType t) { | ||||
| Attr(SHAPEN_ATTR_OUT_TYPE, (int64_t)t); | |||||
| Attr(SHAPEN_ATTR_OUT_TYPE, static_cast<int64_t>(t)); | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| FMK_FUNC_HOST_VISIBILITY ge::DataType ShapeNOperator::GetOutType() const { | FMK_FUNC_HOST_VISIBILITY ge::DataType ShapeNOperator::GetOutType() const { | ||||
| return (ge::DataType)GetIntAttr(SHAPEN_ATTR_OUT_TYPE); | |||||
| return static_cast<ge::DataType>(GetIntAttr(SHAPEN_ATTR_OUT_TYPE)); | |||||
| } | } | ||||
| } // namespace ge | } // namespace ge | ||||
| @@ -17,6 +17,7 @@ | |||||
| #include "parser/common/parser_fp16_t.h" | #include "parser/common/parser_fp16_t.h" | ||||
| #include "external/register/register_types.h" | #include "external/register/register_types.h" | ||||
| #include "graph/def_types.h" | |||||
| namespace { | namespace { | ||||
| constexpr uint16_t kManBitLength = 11; | constexpr uint16_t kManBitLength = 11; | ||||
| @@ -104,7 +105,7 @@ static float Fp16ToFloat(const uint16_t &fp_val) { | |||||
| m_ret = m_ret << (kFp32ManLen - kFp16ManLen); | m_ret = m_ret << (kFp32ManLen - kFp16ManLen); | ||||
| } | } | ||||
| uint32_t f_val = FP32_CONSTRUCTOR(s_ret, e_ret, m_ret); | uint32_t f_val = FP32_CONSTRUCTOR(s_ret, e_ret, m_ret); | ||||
| auto p_ret_v = reinterpret_cast<float *>(&f_val); | |||||
| auto p_ret_v = ge::PtrToPtr<uint32_t, float>(&f_val); | |||||
| return *p_ret_v; | return *p_ret_v; | ||||
| } | } | ||||
| @@ -136,7 +137,7 @@ static double Fp16ToDouble(const uint16_t &fp_val) { | |||||
| m_ret = m_ret << (kFp64ManLen - kFp16ManLen); | m_ret = m_ret << (kFp64ManLen - kFp16ManLen); | ||||
| } | } | ||||
| uint64_t f_val = (s_ret << kFp64SignIndex) | (e_ret << kFp64ManLen) | (m_ret); | uint64_t f_val = (s_ret << kFp64SignIndex) | (e_ret << kFp64ManLen) | (m_ret); | ||||
| auto p_ret_v = reinterpret_cast<double *>(&f_val); | |||||
| auto p_ret_v = ge::PtrToPtr<uint64_t, double>(&f_val); | |||||
| return *p_ret_v; | return *p_ret_v; | ||||
| } | } | ||||
| @@ -178,7 +179,7 @@ static int8_t Fp16ToInt8(const uint16_t &fp_val) { | |||||
| if (FP16_IS_DENORM(fp_val)) { // Denormalized number | if (FP16_IS_DENORM(fp_val)) { // Denormalized number | ||||
| ret_v = 0; | ret_v = 0; | ||||
| ret = *(reinterpret_cast<uint8_t *>(&ret_v)); | |||||
| ret = *(ge::PtrToPtr<uint8_t, uint8_t>(&ret_v)); | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| @@ -853,7 +854,7 @@ fp16_t &fp16_t::operator=(const float &f_val) { | |||||
| uint16_t s_ret, m_ret; | uint16_t s_ret, m_ret; | ||||
| int16_t e_ret; | int16_t e_ret; | ||||
| uint32_t e_f, m_f; | uint32_t e_f, m_f; | ||||
| const uint32_t ui32_v = *(reinterpret_cast<const uint32_t *>(&f_val)); // 1:8:23bit sign:exp:man | |||||
| const uint32_t ui32_v = *(ge::PtrToPtr<const float, const uint32_t>(&f_val)); // 1:8:23bit sign:exp:man | |||||
| uint32_t m_len_delta; | uint32_t m_len_delta; | ||||
| s_ret = static_cast<uint16_t>((ui32_v & kFp32SignMask) >> kFp32SignIndex); // 4Byte->2Byte | s_ret = static_cast<uint16_t>((ui32_v & kFp32SignMask) >> kFp32SignIndex); // 4Byte->2Byte | ||||
| @@ -1161,7 +1162,7 @@ fp16_t &fp16_t::operator=(const double &d_val) { | |||||
| int16_t e_ret; | int16_t e_ret; | ||||
| uint64_t e_d; | uint64_t e_d; | ||||
| uint64_t m_d; | uint64_t m_d; | ||||
| uint64_t ui64_v = *(reinterpret_cast<const uint64_t *>(&d_val)); // 1:11:52bit sign:exp:man | |||||
| uint64_t ui64_v = *(ge::PtrToPtr<const double, const uint64_t>(&d_val)); // 1:11:52bit sign:exp:man | |||||
| uint32_t m_len_delta; | uint32_t m_len_delta; | ||||
| s_ret = static_cast<uint16_t>((ui64_v & kFp64SignMask) >> kFp64SignIndex); // 4Byte | s_ret = static_cast<uint16_t>((ui64_v & kFp64SignMask) >> kFp64SignIndex); // 4Byte | ||||
| @@ -250,7 +250,7 @@ Status PreChecker::CheckTypeSupported(OpId id, const string &type, const string | |||||
| Cause cause; | Cause cause; | ||||
| cause.code = ErrorCode::TYPE_UNSUPPORTED; | cause.code = ErrorCode::TYPE_UNSUPPORTED; | ||||
| cause.message = "The type is not supported."; | cause.message = "The type is not supported."; | ||||
| GELOGI("Check op[%s]'s type[%s] failed, it is not supported.", name.c_str(), type.c_str()); | |||||
| GELOGI("Check op[%s]'s type[%s], The type is not supported.", name.c_str(), type.c_str()); | |||||
| if (!is_tensorflow) { | if (!is_tensorflow) { | ||||
| ErrorManager::GetInstance().ATCReportErrMessage("E19010", {"opname", "optype"}, {name, type}); | ErrorManager::GetInstance().ATCReportErrMessage("E19010", {"opname", "optype"}, {name, type}); | ||||
| } | } | ||||
| @@ -97,7 +97,8 @@ bool OpRegistrationTbe::RegisterParser(const OpRegistrationData ®_data) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| OpParserRegisterar registerar __attribute__((unused)) = OpParserRegisterar( | OpParserRegisterar registerar __attribute__((unused)) = OpParserRegisterar( | ||||
| domi::TENSORFLOW, GetOmOptype(reg_data), [=]() -> std::shared_ptr<OpParser> { return tf_parser_adapter; }); | |||||
| domi::TENSORFLOW, GetOmOptype(reg_data), [tf_parser_adapter]() -> std::shared_ptr<OpParser> | |||||
| { return tf_parser_adapter; }); | |||||
| } | } | ||||
| if (reg_data.GetFusionParseParamFn() != nullptr || reg_data.GetFusionParseParamByOpFn() != nullptr) { | if (reg_data.GetFusionParseParamFn() != nullptr || reg_data.GetFusionParseParamByOpFn() != nullptr) { | ||||
| bool is_registed = factory->OpParserIsRegistered(GetOmOptype(reg_data), true); | bool is_registed = factory->OpParserIsRegistered(GetOmOptype(reg_data), true); | ||||
| @@ -115,7 +116,7 @@ bool OpRegistrationTbe::RegisterParser(const OpRegistrationData ®_data) { | |||||
| } | } | ||||
| OpParserRegisterar registerar __attribute__((unused)) = OpParserRegisterar( | OpParserRegisterar registerar __attribute__((unused)) = OpParserRegisterar( | ||||
| domi::TENSORFLOW, GetOmOptype(reg_data), | domi::TENSORFLOW, GetOmOptype(reg_data), | ||||
| [=]() -> std::shared_ptr<OpParser> { return tf_fusion_parser_adapter; }, true); | |||||
| [tf_fusion_parser_adapter]() -> std::shared_ptr<OpParser> { return tf_fusion_parser_adapter; }, true); | |||||
| } | } | ||||
| } else { | } else { | ||||
| std::shared_ptr<OpParserFactory> factory = OpParserFactory::Instance(reg_data.GetFrameworkType()); | std::shared_ptr<OpParserFactory> factory = OpParserFactory::Instance(reg_data.GetFrameworkType()); | ||||
| @@ -14,8 +14,8 @@ | |||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include <unordered_set> | |||||
| #include "if_subgraph_adapter.h" | #include "if_subgraph_adapter.h" | ||||
| #include <unordered_set> | |||||
| #include "subgraph_adapter_factory.h" | #include "subgraph_adapter_factory.h" | ||||
| #include "common/util.h" | #include "common/util.h" | ||||
| #include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
| @@ -320,8 +320,8 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| (void)ge::AttrUtils::SetInt(op, "T", (int32_t)dtype); | |||||
| (void)ge::AttrUtils::SetInt(op, "arg_index", (int32_t)index); | |||||
| (void)ge::AttrUtils::SetInt(op, "T", static_cast<int32_t>(dtype)); | |||||
| (void)ge::AttrUtils::SetInt(op, "arg_index", static_cast<int32_t>(index)); | |||||
| ge::NodePtr arg_node = graph->AddNode(op); | ge::NodePtr arg_node = graph->AddNode(op); | ||||
| GE_CHECK_NOTNULL(arg_node); | GE_CHECK_NOTNULL(arg_node); | ||||
| bool node_exists = false; | bool node_exists = false; | ||||
| @@ -388,7 +388,8 @@ Status ParserGraphOptimizer::RebuildOutputAnchors(vector<ge::OutDataAnchorPtr> & | |||||
| GE_CHK_BOOL_EXEC(fusion_op_desc->AddOutputDesc(src_out_desc) == ge::GRAPH_SUCCESS, return FAILED); | GE_CHK_BOOL_EXEC(fusion_op_desc->AddOutputDesc(src_out_desc) == ge::GRAPH_SUCCESS, return FAILED); | ||||
| ge::DataType data_type = src_out_desc.GetDataType(); | ge::DataType data_type = src_out_desc.GetDataType(); | ||||
| const std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||||
| const std::map<int32_t, int32_t>::const_iterator iter = | |||||
| GE_TENSORFLOW_DATA_TYPE_MAP.find(static_cast<int32_t>(data_type)); | |||||
| GE_IF_BOOL_EXEC( | GE_IF_BOOL_EXEC( | ||||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | ||||
| REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | ||||
| @@ -397,7 +398,7 @@ Status ParserGraphOptimizer::RebuildOutputAnchors(vector<ge::OutDataAnchorPtr> & | |||||
| return PARAM_INVALID); | return PARAM_INVALID); | ||||
| int32_t dtype = iter->second; | int32_t dtype = iter->second; | ||||
| output_list.push_back((int64_t)dtype); | |||||
| output_list.push_back(static_cast<int64_t>(dtype)); | |||||
| GELOGI("FUNCDEF: output_list push_back %d.", dtype); | GELOGI("FUNCDEF: output_list push_back %d.", dtype); | ||||
| } | } | ||||
| GE_IF_BOOL_EXEC(!output_list.empty(), (void)AttrUtils::SetListInt(fusion_op_desc, ge::T_OUT_DATATYPE, output_list)); | GE_IF_BOOL_EXEC(!output_list.empty(), (void)AttrUtils::SetListInt(fusion_op_desc, ge::T_OUT_DATATYPE, output_list)); | ||||
| @@ -424,7 +425,8 @@ Status ParserGraphOptimizer::RebuildInputAnchors(vector<ge::InDataAnchorPtr> &in | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| ge::DataType data_type = tensorDescPtr->GetDataType(); | ge::DataType data_type = tensorDescPtr->GetDataType(); | ||||
| const std::map<int32_t, int32_t>::const_iterator iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||||
| const std::map<int32_t, int32_t>::const_iterator iter = | |||||
| GE_TENSORFLOW_DATA_TYPE_MAP.find(static_cast<int32_t>(data_type)); | |||||
| GE_IF_BOOL_EXEC( | GE_IF_BOOL_EXEC( | ||||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | ||||
| REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | ||||
| @@ -433,7 +435,7 @@ Status ParserGraphOptimizer::RebuildInputAnchors(vector<ge::InDataAnchorPtr> &in | |||||
| return PARAM_INVALID); | return PARAM_INVALID); | ||||
| int32_t dtype = iter->second; | int32_t dtype = iter->second; | ||||
| input_list.push_back((int64_t)dtype); | |||||
| input_list.push_back(static_cast<int64_t>(dtype)); | |||||
| GELOGI("FUNCDEF: input_list push_back %d.", dtype); | GELOGI("FUNCDEF: input_list push_back %d.", dtype); | ||||
| } | } | ||||
| GE_IF_BOOL_EXEC(!input_list.empty(), (void)AttrUtils::SetListInt(fusion_op_desc, ge::T_IN_DATATYPE, input_list)); | GE_IF_BOOL_EXEC(!input_list.empty(), (void)AttrUtils::SetListInt(fusion_op_desc, ge::T_IN_DATATYPE, input_list)); | ||||