Browse Source

!9332 fix get_broadcast_shape, support broadcasting dynamic shape

From: @TFbunny
Reviewed-by: @tom__chen,@robingrosman
Signed-off-by: @robingrosman
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
94cfd5a57f
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      mindspore/ops/_utils/utils.py

+ 2
- 0
mindspore/ops/_utils/utils.py View File

@@ -54,6 +54,8 @@ def get_broadcast_shape(x_shape, y_shape, prim_name):
broadcast_shape_back.append(x_shape[i])
elif x_shape[i] == y_shape[i]:
broadcast_shape_back.append(x_shape[i])
elif x_shape[i] == -1 or y_shape[i] == -1:
broadcast_shape_back.append(-1)
else:
raise ValueError(f"For '{prim_name}', the x_shape {x_shape} and y_shape {y_shape} can not broadcast.")



Loading…
Cancel
Save