forked from SciSharp/NumSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNdArray.DStack.cs
More file actions
27 lines (25 loc) · 1.37 KB
/
NdArray.DStack.cs
File metadata and controls
27 lines (25 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
namespace NumSharp
{
public partial class NDArray
{
/// <summary>
/// Stack arrays in sequence depth wise (along third axis).
/// This is equivalent to concatenation along the third axis after 2-D arrays of shape(M, N) have been reshaped to(M, N,1) and 1-D arrays of shape(N,) have been reshaped to(1, N,1).
/// Rebuilds arrays divided by dsplit.
/// This function makes most sense for arrays with up to 3 dimensions.For instance, for pixel-data with a height(first axis), width(second axis), and r/g/b channels(third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.
/// </summary>
/// <param name="tup">The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.</param>
/// <returns>The array formed by stacking the given arrays, will be at least 3-D.</returns>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.dstack.html</remarks>
public NDArray dstack(params NDArray[] tup)
{
if (tup == null)
throw new ArgumentNullException(nameof(tup));
NDArray[] list = new NDArray[1 + tup.Length];
list[0] = this;
tup.CopyTo(list, 1);
return np.dstack(list);
}
}
}