Skip to content

Commit 83b7c35

Browse files
committed
Broadcasting: Prevent throw NotSupportedException when shapes are already broadcasted but actually doen't require broadcasting.
1 parent 0214300 commit 83b7c35

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/NumSharp.Core/Backends/Default/ArrayManipulation/Default.Broadcasting.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ public static Shape[] Broadcast(params Shape[] shapes)
292292
/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
293293
public static (Shape LeftShape, Shape RightShape) Broadcast(Shape leftShape, Shape rightShape)
294294
{
295-
if (leftShape.IsBroadcasted || rightShape.IsBroadcasted)
296-
throw new NotSupportedException("Unable to broadcast already broadcasted shape."); //TODO!
297-
298295
if (leftShape._hashCode != 0 && leftShape._hashCode == rightShape._hashCode)
299296
return (leftShape, rightShape);
300297

298+
if (leftShape.IsBroadcasted || rightShape.IsBroadcasted)
299+
throw new NotSupportedException("Unable to broadcast already broadcasted shape."); //TODO! it would make sense to use shape.BroadcastInfo.Original.
300+
301301
Shape left, right, mit;
302302
int i, nd, k, j, tmp;
303303

0 commit comments

Comments
 (0)