| @@ -1,5 +1,5 @@ | |||||
| /** | /** | ||||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||||
| * Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved. | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -311,7 +311,7 @@ domi::Status AclGrphParseUtil::ParseAclOutputNodes(const string &out_nodes) cons | |||||
| return PARAM_INVALID; | return PARAM_INVALID; | ||||
| } | } | ||||
| auto iter = ge::GetParserContext().out_nodes_map.find(key_value_v[0]); | |||||
| const auto iter = ge::GetParserContext().out_nodes_map.find(key_value_v[0]); | |||||
| int32_t index = stoi(StringUtils::Trim(key_value_v[1])); | int32_t index = stoi(StringUtils::Trim(key_value_v[1])); | ||||
| GELOGD("Get output info: node[%s] and index[%d]", key_value_v[0].c_str(), index); | GELOGD("Get output info: node[%s] and index[%d]", key_value_v[0].c_str(), index); | ||||
| if (iter != ge::GetParserContext().out_nodes_map.end()) { | if (iter != ge::GetParserContext().out_nodes_map.end()) { | ||||
| @@ -522,7 +522,7 @@ domi::Status AclGrphParseUtil::GetDefaultOutInfo(ge::ComputeGraphPtr &compute_gr | |||||
| } | } | ||||
| domi::Status AclGrphParseUtil::SetOutputNodeInfo(ge::Graph &graph, | domi::Status AclGrphParseUtil::SetOutputNodeInfo(ge::Graph &graph, | ||||
| const std::map<AscendString, AscendString> &parser_params) { | |||||
| const std::map<AscendString, AscendString> &parser_params) const { | |||||
| (void)parser_params; | (void)parser_params; | ||||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | ||||
| GE_CHECK_NOTNULL(compute_graph); | GE_CHECK_NOTNULL(compute_graph); | ||||
| @@ -600,7 +600,7 @@ domi::Status AclGrphParseUtil::CheckOptions(const std::map<AscendString, AscendS | |||||
| } | } | ||||
| domi::Status AclGrphParseUtil::ParseParamsBeforeGraph(const std::map<AscendString, AscendString> &parser_params, | domi::Status AclGrphParseUtil::ParseParamsBeforeGraph(const std::map<AscendString, AscendString> &parser_params, | ||||
| string &graph_name) { | |||||
| string &graph_name) const { | |||||
| GELOGI("Parse graph user options start."); | GELOGI("Parse graph user options start."); | ||||
| ge::GetParserContext().input_nodes_format_map.clear(); | ge::GetParserContext().input_nodes_format_map.clear(); | ||||
| ge::GetParserContext().output_formats.clear(); | ge::GetParserContext().output_formats.clear(); | ||||
| @@ -918,12 +918,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromMem(const cha | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| /// | |||||
| /// @brief get the Original Type of FrameworkOp | /// @brief get the Original Type of FrameworkOp | ||||
| /// @param [in] node | /// @param [in] node | ||||
| /// @param [out] type | /// @param [out] type | ||||
| /// @return Status | /// @return Status | ||||
| /// | |||||
| Status GetOriginalType(const ge::NodePtr &node, string &type) { | Status GetOriginalType(const ge::NodePtr &node, string &type) { | ||||
| GE_CHECK_NOTNULL(node); | GE_CHECK_NOTNULL(node); | ||||
| type = node->GetType(); | type = node->GetType(); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /** | /** | ||||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||||
| * Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved. | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -26,7 +26,6 @@ | |||||
| #include <vector> | #include <vector> | ||||
| #include "framework/omg/parser/parser_types.h" | #include "framework/omg/parser/parser_types.h" | ||||
| #include "graph/ascend_string.h" | |||||
| #include "graph/utils/graph_utils.h" | #include "graph/utils/graph_utils.h" | ||||
| #include "register/register_error_codes.h" | #include "register/register_error_codes.h" | ||||
| @@ -41,9 +40,9 @@ class AclGrphParseUtil { | |||||
| static domi::Status LoadOpsProtoLib(); | static domi::Status LoadOpsProtoLib(); | ||||
| static void SaveCustomCaffeProtoPath(); | static void SaveCustomCaffeProtoPath(); | ||||
| domi::Status AclParserInitialize(const std::map<std::string, std::string> &options); | domi::Status AclParserInitialize(const std::map<std::string, std::string> &options); | ||||
| domi::Status SetOutputNodeInfo(ge::Graph &graph, const std::map<AscendString, AscendString> &parser_params); | |||||
| domi::Status SetOutputNodeInfo(ge::Graph &graph, const std::map<AscendString, AscendString> &parser_params) const; | |||||
| domi::Status ParseParamsBeforeGraph(const std::map<AscendString, AscendString> &parser_params, | domi::Status ParseParamsBeforeGraph(const std::map<AscendString, AscendString> &parser_params, | ||||
| std::string &graph_name); | |||||
| std::string &graph_name) const; | |||||
| domi::Status ParseParamsAfterGraph(ge::Graph &graph, const std::map<AscendString, | domi::Status ParseParamsAfterGraph(ge::Graph &graph, const std::map<AscendString, | ||||
| AscendString> &parser_params) const; | AscendString> &parser_params) const; | ||||
| @@ -66,31 +65,23 @@ class AclGrphParseUtil { | |||||
| }; | }; | ||||
| namespace parser { | namespace parser { | ||||
| /// | |||||
| /// @ingroup: domi_common | /// @ingroup: domi_common | ||||
| /// @brief: get length of file | /// @brief: get length of file | ||||
| /// @param [in] input_file: path of file | /// @param [in] input_file: path of file | ||||
| /// @return long: File length. If the file length fails to be obtained, the value -1 is returned. | /// @return long: File length. If the file length fails to be obtained, the value -1 is returned. | ||||
| /// | |||||
| extern long GetFileLength(const std::string &input_file); | extern long GetFileLength(const std::string &input_file); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Absolute path for obtaining files. | /// @brief Absolute path for obtaining files. | ||||
| /// @param [in] path of input file | /// @param [in] path of input file | ||||
| /// @param [out] Absolute path of a file. If the absolute path cannot be obtained, an empty string is returned | /// @param [out] Absolute path of a file. If the absolute path cannot be obtained, an empty string is returned | ||||
| /// | |||||
| std::string RealPath(const char *path); | std::string RealPath(const char *path); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Obtains the absolute time (timestamp) of the current system. | /// @brief Obtains the absolute time (timestamp) of the current system. | ||||
| /// @return Timestamp, in microseconds (US) | /// @return Timestamp, in microseconds (US) | ||||
| /// | |||||
| /// | |||||
| uint64_t GetCurrentTimestamp(); | uint64_t GetCurrentTimestamp(); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Reads all data from a binary file. | /// @brief Reads all data from a binary file. | ||||
| /// @param [in] file_name path of file | /// @param [in] file_name path of file | ||||
| @@ -98,20 +89,16 @@ uint64_t GetCurrentTimestamp(); | |||||
| /// @param [out] length Output memory size | /// @param [out] length Output memory size | ||||
| /// @return false fail | /// @return false fail | ||||
| /// @return true success | /// @return true success | ||||
| /// | |||||
| bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length); | bool ReadBytesFromBinaryFile(const char *file_name, char **buffer, int &length); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief proto file in bianary format | /// @brief proto file in bianary format | ||||
| /// @param [in] file path of proto file | /// @param [in] file path of proto file | ||||
| /// @param [out] proto memory for storing the proto file | /// @param [out] proto memory for storing the proto file | ||||
| /// @return true success | /// @return true success | ||||
| /// @return false fail | /// @return false fail | ||||
| /// | |||||
| bool ReadProtoFromBinaryFile(const char *file, Message *proto); | bool ReadProtoFromBinaryFile(const char *file, Message *proto); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Reads the proto structure from an array. | /// @brief Reads the proto structure from an array. | ||||
| /// @param [in] data proto data to be read | /// @param [in] data proto data to be read | ||||
| @@ -119,42 +106,33 @@ bool ReadProtoFromBinaryFile(const char *file, Message *proto); | |||||
| /// @param [out] proto Memory for storing the proto file | /// @param [out] proto Memory for storing the proto file | ||||
| /// @return true success | /// @return true success | ||||
| /// @return false fail | /// @return false fail | ||||
| /// | |||||
| bool ReadProtoFromArray(const void *data, int size, Message *proto); | bool ReadProtoFromArray(const void *data, int size, Message *proto); | ||||
| /// | |||||
| /// @ingroup domi_proto | /// @ingroup domi_proto | ||||
| /// @brief Reads the proto file in the text format. | /// @brief Reads the proto file in the text format. | ||||
| /// @param [in] file path of proto file | /// @param [in] file path of proto file | ||||
| /// @param [out] message Memory for storing the proto file | /// @param [out] message Memory for storing the proto file | ||||
| /// @return true success | /// @return true success | ||||
| /// @return false fail | /// @return false fail | ||||
| /// | |||||
| bool ReadProtoFromText(const char *file, google::protobuf::Message *message); | bool ReadProtoFromText(const char *file, google::protobuf::Message *message); | ||||
| bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *message); | bool ReadProtoFromMem(const char *data, int size, google::protobuf::Message *message); | ||||
| /// | |||||
| /// @brief get the Original Type of FrameworkOp | /// @brief get the Original Type of FrameworkOp | ||||
| /// @param [in] node | /// @param [in] node | ||||
| /// @param [out] type | /// @param [out] type | ||||
| /// @return Status | /// @return Status | ||||
| /// | |||||
| domi::Status GetOriginalType(const ge::NodePtr &node, string &type); | domi::Status GetOriginalType(const ge::NodePtr &node, string &type); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Check whether the file path meets the whitelist verification requirements. | /// @brief Check whether the file path meets the whitelist verification requirements. | ||||
| /// @param [in] filePath file path | /// @param [in] filePath file path | ||||
| /// @param [out] result | /// @param [out] result | ||||
| /// | |||||
| bool ValidateStr(const std::string &filePath, const std::string &mode); | bool ValidateStr(const std::string &filePath, const std::string &mode); | ||||
| /// | |||||
| /// @ingroup domi_common | /// @ingroup domi_common | ||||
| /// @brief Obtains the current time string. | /// @brief Obtains the current time string. | ||||
| /// @return Time character string in the format: %Y%m%d%H%M%S, eg: 20171011083555 | /// @return Time character string in the format: %Y%m%d%H%M%S, eg: 20171011083555 | ||||
| /// | |||||
| std::string CurrentTimeInStr(); | std::string CurrentTimeInStr(); | ||||
| template <typename T, typename... Args> | template <typename T, typename... Args> | ||||
| @@ -150,7 +150,7 @@ static double Fp16ToDouble(const uint16_t &fp_val) { | |||||
| /// @return Return uint8 value of fp16_t object | /// @return Return uint8 value of fp16_t object | ||||
| static uint8_t GetUint8ValByMan(uint8_t s_ret, const uint64_t &long_int_m, const uint16_t &shift_out) { | static uint8_t GetUint8ValByMan(uint8_t s_ret, const uint64_t &long_int_m, const uint16_t &shift_out) { | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| auto m_ret = static_cast<uint8_t>((long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen8Max); | |||||
| auto m_ret = static_cast<uint8_t>((long_int_m >> (kFp16ManLen + shift_out)) & kBitLen8Max); | |||||
| need_round = need_round && ((s_ret == 0 && m_ret < kInt8Max) || (s_ret == 1 && m_ret <= kInt8Max)); | need_round = need_round && ((s_ret == 0 && m_ret < kInt8Max) || (s_ret == 1 && m_ret <= kInt8Max)); | ||||
| if (need_round) { | if (need_round) { | ||||
| m_ret++; | m_ret++; | ||||
| @@ -258,7 +258,7 @@ static uint8_t Fp16ToUInt8(const uint16_t &fp_val) { | |||||
| } | } | ||||
| if (overflow_flag == 0U) { | if (overflow_flag == 0U) { | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| m_ret = static_cast<uint8_t>((long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen8Max); | |||||
| m_ret = static_cast<uint8_t>((long_int_m >> (kFp16ManLen + shift_out)) & kBitLen8Max); | |||||
| if (need_round && m_ret != kBitLen8Max) { | if (need_round && m_ret != kBitLen8Max) { | ||||
| m_ret++; | m_ret++; | ||||
| } | } | ||||
| @@ -280,7 +280,7 @@ static uint8_t Fp16ToUInt8(const uint16_t &fp_val) { | |||||
| /// @return Return uint16 value of fp16_t object | /// @return Return uint16 value of fp16_t object | ||||
| static uint16_t GetUint16ValByMan(uint16_t s_ret, const uint64_t &long_int_m, const uint16_t &shift_out) { | static uint16_t GetUint16ValByMan(uint16_t s_ret, const uint64_t &long_int_m, const uint16_t &shift_out) { | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| auto m_ret = static_cast<uint16_t>((long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen16Max); | |||||
| auto m_ret = static_cast<uint16_t>((long_int_m >> (kFp16ManLen + shift_out)) & kBitLen16Max); | |||||
| if (need_round && m_ret < kInt16Max) { | if (need_round && m_ret < kInt16Max) { | ||||
| m_ret++; | m_ret++; | ||||
| } | } | ||||
| @@ -378,7 +378,7 @@ static uint16_t Fp16ToUInt16(const uint16_t &fp_val) { | |||||
| } | } | ||||
| } | } | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| m_ret = static_cast<uint16_t>((long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen16Max); | |||||
| m_ret = static_cast<uint16_t>((long_int_m >> (kFp16ManLen + shift_out)) & kBitLen16Max); | |||||
| if (need_round && m_ret != kBitLen16Max) { | if (need_round && m_ret != kBitLen16Max) { | ||||
| m_ret++; | m_ret++; | ||||
| } | } | ||||
| @@ -419,7 +419,7 @@ static int32_t Fp16ToInt32(const uint16_t &fp_val) { | |||||
| } | } | ||||
| } | } | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| auto m_ret = static_cast<uint32_t>((long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen32Max); | |||||
| auto m_ret = static_cast<uint32_t>((long_int_m >> (kFp16ManLen + shift_out)) & kBitLen32Max); | |||||
| if (need_round && m_ret < kInt32Max) { | if (need_round && m_ret < kInt32Max) { | ||||
| m_ret++; | m_ret++; | ||||
| } | } | ||||
| @@ -468,7 +468,7 @@ static uint32_t Fp16ToUInt32(const uint16_t &fp_val) { | |||||
| } | } | ||||
| } | } | ||||
| bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | bool need_round = IsRoundOne(long_int_m, shift_out + kFp16ManLen); | ||||
| m_ret = static_cast<uint32_t>(long_int_m >> static_cast<uint64_t>(kFp16ManLen + shift_out)) & kBitLen32Max; | |||||
| m_ret = static_cast<uint32_t>(long_int_m >> (kFp16ManLen + shift_out)) & kBitLen32Max; | |||||
| if (need_round && m_ret != kBitLen32Max) { | if (need_round && m_ret != kBitLen32Max) { | ||||
| m_ret++; | m_ret++; | ||||
| } | } | ||||
| @@ -562,10 +562,10 @@ static uint16_t Fp16Add(uint16_t v_1, uint16_t v_2) { | |||||
| int16_t e_ret = std::max(e_a, e_b); | int16_t e_ret = std::max(e_a, e_b); | ||||
| int16_t e_tmp = std::abs(e_a - e_b); | int16_t e_tmp = std::abs(e_a - e_b); | ||||
| if (e_a > e_b) { | if (e_a > e_b) { | ||||
| m_trunc = (m_b << static_cast<uint32_t>(static_cast<uint16_t>(kBitShift32) - static_cast<uint16_t>(e_tmp))); | |||||
| m_trunc = (m_b << (static_cast<uint16_t>(kBitShift32) - static_cast<uint16_t>(e_tmp))); | |||||
| m_b = RightShift(m_b, e_tmp); | m_b = RightShift(m_b, e_tmp); | ||||
| } else if (e_a < e_b) { | } else if (e_a < e_b) { | ||||
| m_trunc = (m_a << static_cast<uint32_t>(static_cast<uint16_t>(kBitShift32) - static_cast<uint16_t>(e_tmp))); | |||||
| m_trunc = (m_a << (static_cast<uint16_t>(kBitShift32) - static_cast<uint16_t>(e_tmp))); | |||||
| m_a = RightShift(m_a, e_tmp); | m_a = RightShift(m_a, e_tmp); | ||||
| } | } | ||||
| // calculate mantissav | // calculate mantissav | ||||
| @@ -959,7 +959,7 @@ static void SetValByUint16Val(const uint16_t &input_val, const uint16_t &sign, u | |||||
| for (int i = 1; i < e_tmp; i++) { | for (int i = 1; i < e_tmp; i++) { | ||||
| trunc_mask = (trunc_mask << 1) + 1; | trunc_mask = (trunc_mask << 1) + 1; | ||||
| } | } | ||||
| uint32_t m_trunc = (m_tmp & trunc_mask) << static_cast<uint32_t>(static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| uint32_t m_trunc = (m_tmp & trunc_mask) << (static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| for (int i = 0; i < e_tmp; i++) { | for (int i = 0; i < e_tmp; i++) { | ||||
| m_tmp = (m_tmp >> 1); | m_tmp = (m_tmp >> 1); | ||||
| e_ret = e_ret + 1; | e_ret = e_ret + 1; | ||||
| @@ -978,7 +978,7 @@ static void SetValByUint16Val(const uint16_t &input_val, const uint16_t &sign, u | |||||
| } | } | ||||
| } else { | } else { | ||||
| e_ret = static_cast<int16_t>(kFp16ExpBias); | e_ret = static_cast<int16_t>(kFp16ExpBias); | ||||
| m_tmp = m_tmp << static_cast<uint16_t>(kManBitLength - len); | |||||
| m_tmp = m_tmp << (kManBitLength - len); | |||||
| e_ret = e_ret + (len - 1); | e_ret = e_ret + (len - 1); | ||||
| } | } | ||||
| auto m_ret = static_cast<uint16_t>(m_tmp); | auto m_ret = static_cast<uint16_t>(m_tmp); | ||||
| @@ -1018,7 +1018,7 @@ fp16_t &fp16_t::operator=(const uint16_t &ui_val) { | |||||
| for (int i = 1; i < e_tmp; i++) { | for (int i = 1; i < e_tmp; i++) { | ||||
| trunc_mask = (trunc_mask << 1) + 1; | trunc_mask = (trunc_mask << 1) + 1; | ||||
| } | } | ||||
| m_trunc = (m_ret & trunc_mask) << static_cast<uint32_t>(static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| m_trunc = (m_ret & trunc_mask) << (static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| for (int i = 0; i < e_tmp; i++) { | for (int i = 0; i < e_tmp; i++) { | ||||
| m_ret = (m_ret >> 1); | m_ret = (m_ret >> 1); | ||||
| e_ret = e_ret + 1; | e_ret = e_ret + 1; | ||||
| @@ -1040,7 +1040,7 @@ fp16_t &fp16_t::operator=(const uint16_t &ui_val) { | |||||
| } | } | ||||
| } else { | } else { | ||||
| e_ret = static_cast<int16_t>(kFp16ExpBias); | e_ret = static_cast<int16_t>(kFp16ExpBias); | ||||
| m_ret = m_ret << static_cast<uint16_t>(static_cast<uint16_t>(kDim11) - len); | |||||
| m_ret = m_ret << (static_cast<uint16_t>(kDim11) - len); | |||||
| e_ret = e_ret + (len - 1); | e_ret = e_ret + (len - 1); | ||||
| } | } | ||||
| val = FP16_CONSTRUCTOR(0u, static_cast<uint16_t>(e_ret), m_ret); | val = FP16_CONSTRUCTOR(0u, static_cast<uint16_t>(e_ret), m_ret); | ||||
| @@ -1062,7 +1062,7 @@ static void SetValByUint32Val(const uint32_t &input_val, const uint16_t &sign, u | |||||
| for (int i = 1; i < e_tmp; i++) { | for (int i = 1; i < e_tmp; i++) { | ||||
| trunc_mask = (trunc_mask << 1) + 1; | trunc_mask = (trunc_mask << 1) + 1; | ||||
| } | } | ||||
| m_trunc = (m_tmp & trunc_mask) << static_cast<uint32_t>(static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| m_trunc = (m_tmp & trunc_mask) << (static_cast<uint16_t>(kBitShift32) - e_tmp); | |||||
| for (int i = 0; i < e_tmp; i++) { | for (int i = 0; i < e_tmp; i++) { | ||||
| m_tmp = (m_tmp >> 1); | m_tmp = (m_tmp >> 1); | ||||
| e_ret = e_ret + 1; | e_ret = e_ret + 1; | ||||
| @@ -1085,7 +1085,7 @@ static void SetValByUint32Val(const uint32_t &input_val, const uint16_t &sign, u | |||||
| } | } | ||||
| } else { | } else { | ||||
| e_ret = static_cast<int16_t>(kFp16ExpBias); | e_ret = static_cast<int16_t>(kFp16ExpBias); | ||||
| m_tmp = m_tmp << static_cast<uint32_t>(static_cast<uint16_t>(kDim11) - len); | |||||
| m_tmp = m_tmp << (static_cast<uint16_t>(kDim11) - len); | |||||
| e_ret = e_ret + (len - 1); | e_ret = e_ret + (len - 1); | ||||
| } | } | ||||
| auto m_ret = static_cast<uint16_t>(m_tmp); | auto m_ret = static_cast<uint16_t>(m_tmp); | ||||
| @@ -1147,7 +1147,7 @@ fp16_t &fp16_t::operator=(const uint32_t &ui_val) { | |||||
| } | } | ||||
| } else { | } else { | ||||
| e_ret = static_cast<int16_t>(kFp16ExpBias); | e_ret = static_cast<int16_t>(kFp16ExpBias); | ||||
| m_tmp = m_tmp << static_cast<uint32_t>((static_cast<uint16_t>(kDim11) - len)); | |||||
| m_tmp = m_tmp << (static_cast<uint16_t>(kDim11) - len); | |||||
| e_ret = e_ret + (len - 1); | e_ret = e_ret + (len - 1); | ||||
| } | } | ||||
| auto m_ret = static_cast<uint16_t>(m_tmp); | auto m_ret = static_cast<uint16_t>(m_tmp); | ||||