diff --git a/atvc/examples/reduce_max/README.md b/atvc/examples/reduce_max/README.md index 49ff5939d981ad883ffac6b29cf4c069ec8e7171..ce00ce599cbc7eabcb2a610df39943e56b535bf9 100644 --- a/atvc/examples/reduce_max/README.md +++ b/atvc/examples/reduce_max/README.md @@ -2,21 +2,19 @@ ## 概述 -本样例介绍了利用ATVC实现ReduceMax单算子并完成功能验证 +样例概述:本样例介绍了利用ATVC实现ReduceMax单算子并完成功能验证 +- 算子功能:对输入tensor的指定轴进行规约求最大值并输出结果 +- 使用的ATVC模板:Reduce +- 调用方式:Kernel直调 ## 样例支持产品型号: -- Atlas A2训练系列产品 +- Atlas A2训练系列产品/Atlas 800I A2推理产品/A200I A2 Box 异构组件 -## 目录结构 - -| 文件名 | 描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [reduce_max.cpp](./reduce_max.cpp) | ReduceMax算子代码实现以及调用样例 | ## 算子描述 -ReduceMax是对输入tensor的指定轴进行规约累加的计算并输出结果的Reduce类算子。 +ReduceMax是对输入tensor的指定轴进行规约求最大值并输出结果的Reduce类算子。 ReduceMax算子规格: @@ -25,17 +23,25 @@ ReduceMax算子规格: 算子输入 nameshapedata typeformat -x8 * 2048floatND +x8 * 2048float/int32_tND 算子输出 -y1 * 2048floatND +y1 * 2048float/int32_tND 核函数名ReduceCustom +## 目录结构 + +| 文件名 | 描述 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [reduce_max.cpp](./reduce_max.cpp) | ReduceMax算子代码实现以及调用样例 | + + ## 算子运行 在ascendc-api-adv代码仓目录下执行: ```bash cd ./atvc/examples -bash run_examples.sh reduce_max \ No newline at end of file +bash run_examples.sh reduce_max +``` diff --git a/atvc/examples/reduce_min/README.md b/atvc/examples/reduce_min/README.md index dd8a24248f1ed6a69523ad83e0848e22f7c41822..6454252460446cedd57f70f8cf03d06c010d53a1 100644 --- a/atvc/examples/reduce_min/README.md +++ b/atvc/examples/reduce_min/README.md @@ -2,21 +2,19 @@ ## 概述 -本样例介绍了利用ATVC实现ReduceMin单算子并完成功能验证 +样例概述:本样例介绍了利用ATVC实现ReduceMin单算子并完成功能验证 +- 算子功能:对输入tensor的指定轴进行规约求最小值并输出结果 +- 使用的ATVC模板:Reduce +- 调用方式:Kernel直调 ## 样例支持产品型号: -- Atlas A2训练系列产品 +- Atlas A2训练系列产品/Atlas 800I A2推理产品/A200I A2 Box 异构组件 -## 目录结构 - -| 文件名 | 描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [reduce_min.cpp](./reduce_min.cpp) | ReduceMin算子代码实现以及调用样例 | ## 算子描述 -ReduceMin是对输入tensor的指定轴进行规约累加的计算并输出结果的Reduce类算子。 +ReduceMin是对输入tensor的指定轴进行规约求最小值并输出结果的Reduce类算子。 ReduceMin算子规格: @@ -25,17 +23,25 @@ ReduceMin算子规格: 算子输入 nameshapedata typeformat -x8 * 2048floatND +x8 * 2048float/int32_tND 算子输出 -y1 * 2048floatND +y1 * 2048float/int32_tND 核函数名ReduceCustom +## 目录结构 + +| 文件名 | 描述 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [reduce_min.cpp](./reduce_min.cpp) | ReduceMin算子代码实现以及调用样例 | + + ## 算子运行 在ascendc-api-adv代码仓目录下执行: ```bash cd ./atvc/examples -bash run_examples.sh reduce_min \ No newline at end of file +bash run_examples.sh reduce_min +``` diff --git a/atvc/include/reduce/reduce_max.h b/atvc/include/reduce/reduce_max.h index 886266d1cae27addca9d5721540a30795a203e6f..f9320cbd79f625af85de7d4e34705b60a925c302 100644 --- a/atvc/include/reduce/reduce_max.h +++ b/atvc/include/reduce/reduce_max.h @@ -250,8 +250,6 @@ public: // are set to -∞ or 0 to ensure that the accumulated result is not affected if(AscendC::IsSameType::value){ return INT32_MIN; - }else if(AscendC::IsSameType::value){ - return 0; }else{ return -1.0f / 0.0f; } diff --git a/atvc/include/reduce/reduce_min.h b/atvc/include/reduce/reduce_min.h index af2481faddc6aca35934d99c9adf816ab1fca331..cd387a695b886fadce081f157381916b6c733647 100644 --- a/atvc/include/reduce/reduce_min.h +++ b/atvc/include/reduce/reduce_min.h @@ -250,8 +250,6 @@ public: // are set to +∞ or 0 to ensure that the accumulated result is not affected if(AscendC::IsSameType::value){ return INT32_MAX; - }else if(AscendC::IsSameType::value){ - return (uint32_t)INT32_MAX - (uint32_t)INT32_MIN; }else{ return 1.0f / 0.0f; }