Skip to content

Commit edbc89c

Browse files
committed
NDArray: added missing GetData(int[])
1 parent f8a6539 commit edbc89c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/NumSharp.Core/Backends/NDArray.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,13 @@ public NDArray[] GetNDArrays(int axis = 0)
496496
/// <returns>reference to internal storage as System.Array</returns>
497497
public IArraySlice GetData() => Storage.GetData();
498498

499+
/// <summary>
500+
/// Gets a NDArray at given <paramref name="indices"/>.
501+
/// </summary>
502+
/// <param name="indices">The coordinates to the wanted value</param>
503+
/// <remarks>Does not copy, returns a memory slice - this is similar to this[int[]]</remarks>
504+
public NDArray GetData(params int[] indices) => new NDArray(Storage.GetData(indices)) {tensorEngine = this.tensorEngine};
505+
499506
/// <summary>
500507
/// Retrieves value of type <see cref="bool"/>.
501508
/// </summary>

0 commit comments

Comments
 (0)