| Files | Last commit | Last update |
|---|---|---|
math仓英文合入 Co-authored-by: y60124828<yanglou1@h-partners.com> # message auto-generated for no-merge-commit merge: !6772 merge master into master math仓英文合入 Created-by: yanglu-1 Commit-by: y60124828 Merged-by: cann-robot Description: ## 描述 math仓master分支英文合入 ## 关联的Issue 关联issue:[4170](https://gitcode.com/cann/ops-math/issues/4170) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6772 | 13 days ago | |
aclnnClampMax等资料问题 Co-authored-by: ranczhw<ranchenzhi@huawei.com> # message auto-generated for no-merge-commit merge: !5533 merge master into master aclnnClampMax等资料问题 Created-by: IceBearPolar Commit-by: ranczhw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 修复 math 仓 aclnn 资料扫描问题 12 条,并同步对应调用示例。 - aclnnClampMax / aclnnInplaceClampMax 示例回读类型与张量 dtype 不一致(文档 INT8、conversion example INT32),存在越界读/结果误读 - aclnnTril 功能说明示例将 tril 误写为 triu - aclnnCalculateMatmulWeightSizeV2 示例 shape 标点不规范 - aclnnTransMatmulWeight 将 0x3C00 误注释为 int16 的 1,实际为 FP16 的 1.0 - aclnnFlatten 将 self 最大维度写成不能超过 2,与维度列 2-8 及错误码矛盾 - aclnnFlatten 示例未说明 outHostData 仅为占位初值,且缺少预期结果校验 - aclnnDiag 功能说明用 input 指代输入,与参数名 self 不一致 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/3111 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 门禁通过 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> aclnnClampMax.md、aclnnInplaceClampMax.md、aclnnTril.md、aclnnCalculateMatmulWeightSizeV2.md、aclnnTransMatmulWeight.md、aclnnFlatten.md、aclnnDiag.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5533 | 1 month ago | |
优化多个文件中的代码风格 Co-authored-by: yuantao<taoyuan18@huawei.com> Co-authored-by: init__zhb__<zhanghaobo6@huawei.com> # message auto-generated for no-merge-commit merge: !1295 merge clean into master 优化多个文件中的代码风格 Created-by: yuantao_ Commit-by: init__zhb__;yuantao Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 多个文件中的代码风格可以进行改进: | 文件路径 | 代码片段 | 问题描述 | 行号 | | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------- | --- | | conversion/concat_d/op_api/concat_d.cpp | if (tail_dim * type_size[promoteType] % 32 != 0) { | 避免魔法数字 (32) | 54 | | conversion/depth_to_space/examples/test_geir_depth_to_space.cpp | add1.update_output_desc_##outputName(outputName##outputIndex##_desc); | 宏定义无需分号 | 68 | | conversion/depth_to_space/examples/test_geir_depth_to_space.cpp | inputs.push_back(placeholder##intputIndex); | 宏定义无需分号 | 60 | | conversion/depth_to_space/examples/test_geir_depth_to_space.cpp | char *endptr; | 使用std::string替代char* | 202 | | conversion/strided_slice_grad/examples/test_geir_strided_slice_grad.cpp | pData[i] = value + (i % 3) * 0.4f; // 让数据更有意义 | 避免魔法数字 (3) | 126 | | conversion/strided_slice_grad/examples/test_geir_strided_slice_grad.cpp | return 2; | 避免魔法数字 (2) | 109 | | conversion/strided_slice_grad/examples/test_geir_strided_slice_grad.cpp | return 4; | 避免魔法数字 (4) | 107 | | conversion/concat_d/op_api/concat_d.cpp | if (inputs->Size() > 512 \|\| inputs->Size() < 33) { | 避免魔法数字 (512) | 45 | | conversion/concat_d/op_api/concat_d.cpp | catMaxInputSize = 512; | 避免魔法数字 (512) | 92 | | conversion/depth_to_space/examples/test_geir_depth_to_space.cpp | FILE *fp; | 变量应在使用时声明初始化 | 153 | | conversion/depth_to_space/examples/test_geir_depth_to_space.cpp | add1.set_attr_##attrName(attrValue); | 宏定义无需分号 | 63 | | random/dsa_random_uniform/op_host/op_api/aclnn_multinomial.cpp | auto randomUniform = GetRandomUniformNoReplaceMent(selfContiguous, randomParams, uniqueExecutor.get()); | 数组参数应传递长度 (randomParams) | 377 | | conversion/squeezev2/op_host/squeezev2_infershape.cpp | return SqueezeWithAxes(x_shape, squeeze_dims, y_shape); | 数组参数应传递长度 (squeeze_dims) | 114 | | conversion/concat_dv2/op_host/concat_dv2_tiling.cpp | tiling.set_endTensorIdx(endTensorIdx); | 数组参数应传递长度 (endTensorIdx) | 143 | | conversion/squeezev3/op_host/squeezev3_infershape.cpp | return SqueezeWithAxes(x_shape, squeeze_dims, y_shape); | 数组参数应传递长度 (squeeze_dims) | 117 | | conversion/concat_dv2/op_host/concat_dv2_tiling.cpp | tiling.set_endTensorOffset(endTensorOffset); | 数组参数应传递长度 (endTensorOffset) | 144 | | conversion/squeezev2/op_host/squeezev2_infershape.cpp | if (!IsAxesRangeValid(squeeze_dims, static_cast<int64_t>(x_shape->GetDimNum()), axes)) { | 数组参数应传递长度 (squeeze_dims) | 108 | | random/sim_thread_exponential/op_kernel/sim_thread_exponential.h | AscendC::And(..., mask, len / SHIFT_LEFT_32, { 1, 1, 1, 8, | 数组参数应传递长度 (mask) | 567 | | random/dsa_gen_bit_mask/examples/test_dropout_gen_mask.cpp | std::vector<float> outHostData(8, 0); | 避免魔法数字 (8) | 89 | | conversion/diag_v2/examples/test_geir_diag_v2.cpp | char *endptr; | 使用std::string替代char* | 220 | | random/dsa_gen_bit_mask/examples/test_dropout_gen_mask.cpp | std::vector<uint8_t> maskOutHostData(16, 0); | 避免魔法数字 (16) | 90 | | conversion/diag_v2/examples/test_geir_diag_v2.cpp | FILE *fp; | 变量应在使用时声明初始化 | 177 | | conversion/diag_v2/examples/test_geir_diag_v2.cpp | add1.set_attr_##attrName(attrValue); | 宏定义无需分号 | 63 | | conversion/diag_v2/examples/test_geir_diag_v2.cpp | inputs.push_back(placeholder##intputIndex); | 宏定义无需分号 | 60 | | conversion/diag_v2/examples/test_geir_diag_v2.cpp | add1.update_output_desc_##outputName(outputName##outputIndex##_desc); | 宏定义无需分号 | 92 | | conversion/unfold_grad/op_kernel/unfold_grad_final_axe_big_size.h | _(空行)_ | 代码块末尾不应有空行 | 56 | | random/dsa_gen_bit_mask/examples/test_aclnn_dropout_gen_mask_v2_tensor.cpp | std::vector<uint8_t> outHostData(16, 0); | 避免魔法数字 (16) | 93 | | random/dsa_gen_bit_mask/examples/test_dropout.cpp | std::vector<uint8_t> maskOutHostData(16, 0); | 避免魔法数字 (16) | 90 | | random/dsa_gen_bit_mask/examples/test_dropout.cpp | std::vector<float> outHostData(8, 0); | 避免魔法数字 (8) | 89 | | conversion/concat_dv2/op_host/concat_dv2_def.cpp | 0 | 代码块末尾不应有空行 | 45 | | conversion/concat_d/op_api/aclnn_cat.cpp | catMaxInputs = 512; | 避免魔法数字 (512) | 337 | | conversion/clip_by_value_v2/examples/test_aclnn_clamp_max.cpp | std::vector<int8_t> outHostData(8, 0); | 避免魔法数字 (8) | 80 | | random/dsa_gen_bit_mask/examples/test_dropout_gen_mask_v2.cpp | std::vector<uint8_t> outHostData(16, 0); | 避免魔法数字 (16) | 86 | | conversion/broadcast_to/examples/test_geir_broadcast_to.cpp | inputs.push_back(placeholder##intputIndex); | 宏定义无需分号 | 89 | | random/dsa_gen_bit_mask/examples/test_aclnn_bernoulli.cpp | std::vector<float> outHostData(16, 0); | 避免魔法数字 (16) | 89 | | conversion/confusion_transpose_d/examples/test_aclnn_confusion_transpose.cpp | std::vector<float> outHostData(8, 1); | 避免魔法数字 (8) | 116 | | conversion/clip_by_value_v2/examples/test_aclnn_clamp_max_tensor.cpp | std::vector<double> outHostData(8, 0); | 避免魔法数字 (8) | 82 | ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:清理代码,优化代码风格。 See merge request: cann/ops-math!1295 | 8 months ago | |
fix(conversion): 算子 host 侧错误码标准化整改(infershape/tiling/op_api) Co-authored-by: IceBearPolar<xuxuepeng4@huawei.com> # message auto-generated for no-merge-commit merge: !6611 merge err_code into master fix(conversion): 算子 host 侧错误码标准化整改(infershape/tiling/op_api) Created-by: IceBearPolar Commit-by: IceBearPolar Merged-by: cann-robot Description: ## 描述 对 conversion 类算子 host 侧代码进行错误码标准化整改,统一错误日志与错误上报行为: 1. **错误日志规范化**:将 infershape / tiling 中泛化的 OP_LOGE 与 OP_CHECK_NULL_WITH_CONTEXT 替换为标准错误宏(OP_LOGE_WITH_INVALID_INPUT、OP_LOGE_FOR_INVALID_TENSORNUM、OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON、OP_LOGE_FOR_INVALID_VALUE_WITH_REASON、OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON 等),使日志明确指出算子名、无效输入/属性名、实际值与原因,便于用户定位问题。 2. **错误上报补齐**:对执行失败场景补充 REPORT_PREDEFINED_ERR_MSG 标准错误上报(infershape 失败上报 EZ1014,tiling 失败上报 EZ1008),内部辅助日志改用 OP_LOGE_WITHOUT_REPORT,避免同一错误重复上报。 3. **健壮性修复**: - diag_flat / diag_v2 infershape 中属性 diagonal 指针原未判空直接解引用,存在空指针风险,补充判空保护; - flatten op_api 中 ADD_TO_LAUNCHER_LIST_AICORE 失败场景区分 ACLNN_ERR_PARAM_NULLPTR 与其他错误码分别记录日志。 涉及算子:concat_v2、diag、diag_flat、diag_v2、flatten、slice、slice_last_dim、slice_with_axes(op_host 下 infershape / tiling / op_api 文件)。 ## 关联的Issue 不涉及(错误码标准化专项整改) ## 测试 已在A2 补齐独立ut 177例  ## 文档更新 不涉及 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6611 | 18 days ago | |
init | 1 year ago | |
整改st目录下的atk用例统一目录格式 Co-authored-by: yue-ma<mayue54@huawei.com> # message auto-generated for no-merge-commit merge: !2579 merge master into master 整改st目录下的atk用例统一目录格式 Created-by: yue-ma Commit-by: yue-ma Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 整改st目录下的atk用例统一目录格式 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/1538 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:st用例目录整改 See merge request: cann/ops-math!2579 | 5 months ago | |
增加A2 A3新算子支持 Co-authored-by: slx2008<shaolixin@huawei.com> # message auto-generated for no-merge-commit merge: !448 merge master into master 增加A2 A3新算子支持 Created-by: songkai111 Commit-by: slx2008 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!448 | 10 months ago | |
产品名变更 Co-authored-by: gitcode-chenjiao<chenjiao31@huawei.com> # message auto-generated for no-merge-commit merge: !5912 merge master into master 产品名变更 Created-by: gitcode-chenjiao Commit-by: gitcode-chenjiao Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> AI处理器对应的产品型号名称更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#3258](https://gitcode.com/cann/ops-math/issues/3258) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ok ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> *.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5912 | 1 month ago | |
docs: add English translations for markdown files Co-authored-by: jenny_xiang<jenny.xiang@huawei.com> # message auto-generated for no-merge-commit merge: !7113 merge docs/add-english-translations into master docs: add English translations for markdown files Created-by: jenny_xiang Commit-by: jenny_xiang Merged-by: cann-robot Description: ## 描述 新增仓库Markdown文档英文译稿(第二批,共409个文件):第一批(已合入)之外的其余全部译稿,覆盖conversion、examples、ge、math、random各类算子README译稿,以及CHANGELOG_en.md、.gitcode PR模板英文版等。 本批内全部仓内链接均指向master已有文件(含第一批已合入的21+2篇译稿),合入后本仓432篇英文文档全部就位,链接完整生效。 本批同时包含4篇基于最新源文档的增量更新(math/ada_cast、math/prod_force_se_a、math/sinkhorn、math/xlogy,对应上游近期文档变更)。 ## 关联的Issue 无 ## 测试 文档类变更,无需算子测试;已通过链接有效性校验(本批全部相对链接仅指向master已有文件,无指向本PR外未提交文件的链接),并完成逐篇翻译规范自查与语义校对(含支持状态表、限定词、术语、数值符号核对)。 ## 文档更新 新增409个英文译稿文件(*_en.md / .en-US.md),不修改任何现有文件。 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!7113 | 6 days ago |
Flatten
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | √ |
| Atlas inference products | √ |
| Atlas training products | √ |
Function Description
- Operator function: flattens the input Tensor into a 2D Tensor based on the given axis.
- Computation formula:
- If the shape of the input self is (d₀, d₁, ..., dₙ), the shape of the output out is (d₀×d₁×...×dₐₓᵢₛ₋₁, dₐₓᵢₛ×dₐₓᵢₛ₊₁×...×dₙ)
- If axis is 0, the shape of the output out is (1, d₀×d₁×...×dₙ)
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| self | Input tensor | Input tensor. Non-contiguous Tensors are supported, 2D to 8D. | INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BOOL, BFLOAT16, FLOAT, FLOAT16 | ND |
| axis | Input attribute | Reference axis for the flatten computation. The value range is [-self.dim(), self.dim()-1]. Currently only axis = 1 is supported. | INT64 | - |
| out | Output tensor | Output 2D tensor. Non-contiguous Tensors are supported. | INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, BOOL, BFLOAT16, FLOAT, FLOAT16 | ND |
Constraint Description
- The number of dimensions of the input tensor cannot be greater than 8.
- axis must be within the valid dimension range.
- The input and output must have the same data type.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn API | test_aclnn_flatten | Invokes the Flatten operator through the aclnnFlatten API. |