已关闭
[Bug-Report|缺陷反馈]: TensorFlow Mean output shape loses dimensions after a zero-sized dimension #594
KaranocaVe创建于  28 天前关闭于  14 天前
KaranocaVe
KaranocaVe
28 天前 创建

[Bug-Report|缺陷反馈]: TensorFlow Mean output shape loses dimensions after a zero-sized dimension

Problem

TensorFlow Mean output descriptor translation drops dimensions after a zero-sized dimension. For a serialized output shape [0, 3], TensorFlowUtil::TransTensorDescriptor returns [0]. A normal [2, 3] shape is preserved.

The corruption is caused by a special case for Mean that replaces the descriptor shape with a one-dimensional shape when it encounters any zero dimension, then stops scanning dimensions. The source comment says the Mean and FusedBatchNormGrad workarounds address inaccurate TensorFlow inference for ResNet50; this case does not verify a full ResNet50 model.

Reproduction

The parser unit test UtestTensorflowParser.tensorflow_MeanPreservesEmptyOutputShape_test passes serialized TensorFlow output descriptors for [0, 3] and [2, 3] through TransTensorDescriptor and compares the resulting dimensions.

At source commit abaf3791a9ed60b5f871baf5eaade7b58fbbecd9, the empty-shape case fails with actual dimensions [0]; the ordinary shape control passes. After removing the Mean rewrite, both cases pass.

Fix

Remove the Mean zero-dimension shape rewrite. Keep the FusedBatchNormGrad adjustment unchanged. The change updates descriptor translation, adds a parser regression test, and documents the serialized-shape behavior.

Validation

The parser regression test reproduces the shape collapse before the change and passes after it. The [0, 3] empty shape and [2, 3] control are both preserved. The ut_parser target builds successfully. The target repository's applicable pre-commit hooks, clang-format, and git diff --check pass.

These test and build results were recorded against the original source commit and have not been rerun locally against the current develop base. GitCode Actions reports ci-pipeline-passed for the current head of PR !5216. The historical ResNet50 workaround was not validated with a full model, so compatibility with that scenario remains unverified.

关联 PR: https://gitcode.com/cann/ge/merge_requests/5216

likedislike
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
Sspring_yb成员
28 天前 将 ClarkXie 设为负责人
KaranocaVeKaranocaVe
28 天前 关联了pull request:fix: preserve empty dimensions in TensorFlow Mean output shapes
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
ClarkXie
ClarkXie成员
28 天前 评论:

感谢您的反馈,我们会尽快检视并合入您的修复!

likedislike
KaranocaVeKaranocaVe
28 天前 修改了issue 的描述
ClarkXie
ClarkXie成员
14 天前 评论:

代码已完成检视并发出,预计今晚合入develop

likedislike
ClarkXieClarkXie成员
14 天前 issue状态由 进行中 改变为 已完成
ClarkXieClarkXie成员
14 天前 关闭了 issue
KaranocaVe
KaranocaVe
4 天前 评论:

@ClarkXie 您好,这个 Issue 对应的修复已经合入:https://gitcode.com/cann/ge/merge_requests/5216

开发者计划反馈,Issue 需要有 Accepted 标签才能计入积分,仅关闭或标记 resolved 还不够。目前这条 Issue 尚未标记 Accepted,麻烦您结合问题和已合入的修复复核一下;确认符合受理条件后,帮忙补上 Accepted 标签。

感谢您的支持!

likedislike