已合并
fix range infershape of double type #1484
AlfengYuan创建于 3月4日
fix range infershape of double type #1484
已合并
共 2 个文件变更+15-1
| @@ -15,6 +15,8 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | + | ||
| 19 | + | ||
| 18 | 20 | ||
| 19 | using namespace ge; | 21 | using namespace ge; |
| 20 | namespace ops { | 22 | namespace ops { |
| @@ -25,8 +27,18 @@ static ge::graphStatus InferDataType4Range(gert::InferDataTypeContext* context) | |||
| 25 | DataType startDataType = context->GetInputDataType(0); | 27 | DataType startDataType = context->GetInputDataType(0); |
| 26 | DataType limitDataType = context->GetInputDataType(1); | 28 | DataType limitDataType = context->GetInputDataType(1); |
| 27 | DataType deltaDataType = context->GetInputDataType(2); | 29 | DataType deltaDataType = context->GetInputDataType(2); |
| 30 | + fe::PlatformInfo platform_info; | ||
| 31 | + fe::OptionalInfo optional_info; | ||
| 32 | + OP_CHECK_IF( | ||
| 33 | + (fe::PlatformInfoManager::Instance().GetPlatformInfoWithOutSocVersion(platform_info, optional_info) != | ||
| 34 | + ge::GRAPH_SUCCESS), OP_LOGE(context->GetNodeName(), "Cannot get platform info!"), return ge::GRAPH_FAILED); | ||
| 35 | + OP_LOGD(context->GetNodeName(), "soc version is %s", platform_info.str_info.short_soc_version.c_str()); | ||
| 28 | if ((startDataType == limitDataType) && (limitDataType == deltaDataType)) { | 36 | if ((startDataType == limitDataType) && (limitDataType == deltaDataType)) { |
| 29 | - context->SetOutputDataType(0, startDataType); | 37 | + if (startDataType == ge::DT_DOUBLE && platform_info.str_info.short_soc_version == "Ascend950") { |
| 38 | + context->SetOutputDataType(0, ge::DT_FLOAT); | ||
| 39 | + } else { | ||
| 40 | + context->SetOutputDataType(0, startDataType); | ||
| 41 | + } | ||
| 30 | } else { | 42 | } else { |
| 31 | context->SetOutputDataType(0, ge::DT_FLOAT); | 43 | context->SetOutputDataType(0, ge::DT_FLOAT); |
| 32 | } | 44 | } |
| @@ -42,6 +42,8 @@ namespace ge { | |||
| 42 | * The auto inferred type of output is the same as input when the types of start/limit/delta are the same, | 42 | * The auto inferred type of output is the same as input when the types of start/limit/delta are the same, |
| 43 | * otherwise the auto inferred type of output is float32. \n | 43 | * otherwise the auto inferred type of output is float32. \n |
| 44 | * The double type of y is not supported in Ascend950 AI Processor. \n | 44 | * The double type of y is not supported in Ascend950 AI Processor. \n |
| 45 | +* If the input parameters start, limit, delta are all of type double, | ||
| 46 | +* the output parameters y is only supported as float32 in Ascend950 AI Processor. \n | ||
| 45 | * | 47 | * |
| 46 | * @par Attributes: | 48 | * @par Attributes: |
| 47 | * is_closed: An optional attribute of type bool, inducating upper limit is closed or not. | 49 | * is_closed: An optional attribute of type bool, inducating upper limit is closed or not. |