| Files | Last commit | Last update |
|---|---|---|
迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Co-authored-by: Dazhou_Cao<caodazhou@huawei.com> Co-authored-by: gcw_2mqml1vq<guoguanghai@huawei.com> # message auto-generated for no-merge-commit merge: !6237 merge merge-pr-5595-5610-5757 into master 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Created-by: gcw_2mqml1vq Commit-by: gcw_2mqml1vq;Dazhou_Cao Merged-by: cann-robot Description: ## 描述 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6237 | 25 days 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 | |
迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Co-authored-by: Dazhou_Cao<caodazhou@huawei.com> Co-authored-by: gcw_2mqml1vq<guoguanghai@huawei.com> # message auto-generated for no-merge-commit merge: !6237 merge merge-pr-5595-5610-5757 into master 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Created-by: gcw_2mqml1vq Commit-by: gcw_2mqml1vq;Dazhou_Cao Merged-by: cann-robot Description: ## 描述 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6237 | 25 days ago | |
【错误码整改】chunk_cat、split_d、squeeze、unfold_grad算子错误码整改 Co-authored-by: t00935269<tangkaidi1@huawei.com> # message auto-generated for no-merge-commit merge: !6636 merge master into master 【错误码整改】chunk_cat、split_d、squeeze、unfold_grad算子错误码整改 Created-by: tangkaidi Commit-by: t00935269 Merged-by: cann-robot Description: ## 描述 chunk_cat、split_d、squeeze、unfold_grad的host侧错误码进行整改,将输入缺失、属性值及 Shape/Dtype 非法等场景改为对应的正式错误码,并避免外层重复上报覆盖底层错误,以及部分错误码错误使用的情况。 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue [Experience Request|体验需求]: 【错误码整改】chunk_cat、split_d、squeeze、unfold_grad算子错误码整改 [#3857](https://gitcode.com/cann/ops-math/issues/3857) <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 共计63个错误码整改点,每个修改点各对应1个独立的测试UT,共63个全部PASS,同时库上已有UT用例共32个,不受影响仍然全部PASS。 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 不涉及 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6636 | 23 days ago | |
迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Co-authored-by: Dazhou_Cao<caodazhou@huawei.com> Co-authored-by: gcw_2mqml1vq<guoguanghai@huawei.com> # message auto-generated for no-merge-commit merge: !6237 merge merge-pr-5595-5610-5757 into master 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Created-by: gcw_2mqml1vq Commit-by: gcw_2mqml1vq;Dazhou_Cao Merged-by: cann-robot Description: ## 描述 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6237 | 25 days 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 | |
迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Co-authored-by: Dazhou_Cao<caodazhou@huawei.com> Co-authored-by: gcw_2mqml1vq<guoguanghai@huawei.com> # message auto-generated for no-merge-commit merge: !6237 merge merge-pr-5595-5610-5757 into master 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 Created-by: gcw_2mqml1vq Commit-by: gcw_2mqml1vq;Dazhou_Cao Merged-by: cann-robot Description: ## 描述 迁移gelocal算子squeeze、unsqueeze、squeezev3、unsqueezev3及NoOp、ControlTrigger、PhonyConcat、PhonySplit、TransShape、FlattenV2、ExpandDims算子 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6237 | 25 days 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 | 10 days ago |
Squeeze
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
API function: removes dimensions whose size is 1 from a tensor. Example:
If axis is empty, all dimensions whose size is 1 are removed:
>>> x = tf.constant([[[1], [2]], [[3], [4]]]) # shape (2, 2, 1)
>>> tf.squeeze(x).shape
(2, 2)
If axis is specified, only the specified dimensions whose size is 1 are removed:
>>> x = tf.constant([[[1], [2]], [[3], [4]]]) # shape (2, 2, 1)
>>> tf.squeeze(x, [2]).shape
(2, 2)
>>> tf.squeeze(x, [0]).shape
(2, 1)
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input tensor to be squeezed | BOOL, FLOAT16, FLOAT, INT4, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, DOUBLE, COMPLEX64 | ND, FRACTAL_NZ |
| axis | Optional attribute |
|
LIST_INT64 | - |
| y | Output | Squeezed output tensor, whose data type is the same as that of the input x | BOOL, FLOAT16, FLOAT, INT4, INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, DOUBLE, COMPLEX64 | ND, FRACTAL_NZ |
Constraint Description
- If axis is specified, the size of the dimension corresponding to axis must be 1. Otherwise, the operator fails to execute.
- If the input has a dynamic shape (containing -1) and axis is empty, whether the -1 dimension is 1 cannot be determined, and the output shape is set to -2.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| Graph-mode invocation | test_geir_squeeze | Invokes the Squeeze operator by building a graph through the operator IR. |