Closed
[Bug-Report|缺陷反馈]: TensorFlow Mean output shape loses dimensions after a zero-sized dimension #594
KaranocaVeAdd on  Sep 28Closed at  25 days ago
KaranocaVe
KaranocaVe
Sep 28 Create

[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
Sep 28 Modify description of issue
Sspring_ybCollaborators
Sep 28 Assign ClarkXie as responsible person
KaranocaVeKaranocaVe
Sep 28 Associated pull request
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
ClarkXie
ClarkXieCollaborators
Sep 28 Comments:

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

likedislike
KaranocaVeKaranocaVe
Sep 28 Modify description of issue
ClarkXie
ClarkXieCollaborators
25 days ago Comments:

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

likedislike
ClarkXieClarkXieCollaborators
25 days ago changed custom state from 进行中 to 已完成
ClarkXieClarkXieCollaborators
25 days ago Close issue
KaranocaVe
KaranocaVe
15 days ago Comments:

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

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

感谢您的支持!

likedislike