Skip to content

Commit e05a443

Browse files
committed
UnmanagedStorage: Fixed slicing of broadcasted array.
1 parent 925cf50 commit e05a443

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NumSharp.Core/Backends/Unmanaged/UnmanagedStorage.Slicing.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ private UnmanagedStorage GetViewInternal(params Slice[] slices)
9696
if (!_shape.IsRecursive && slices.All(s => Equals(Slice.All, s)))
9797
return Alias();
9898

99+
//handle broadcasted shape
100+
if (_shape.IsBroadcasted)
101+
return Clone().Alias(_shape.Slice(slices));
102+
99103
return Alias(_shape.Slice(slices));
100104
}
101105

0 commit comments

Comments
 (0)