Backends/SiaNet.Backend.TensorSharp/NDArray.cs
/// <summary>
/// Return a new tensor where the given singleton dimension has been removed
/// </summary>
/// <param name="dimension">The dimension.</param>
/// <returns>Tensor.</returns>
/// <exception cref="InvalidOperationException">Squeeze requires 2 or more dimensions</exception>
/// <exception cref="ArgumentOutOfRangeException">dimension</exception>
Return a new tensor where the given singleton dimension has been removed
Return a new tensor where the given singleton dimension has been removed
public NDArray Squeeze(int dimension)
        {
            if (DimensionCount == 1) throw new InvalidOperationException("Squeeze requires 2 or more dimensions");
            if (dimension < 0 || dimension >= DimensionCount) throw new ArgumentOutOfRangeException("dimension");
            var newSizes = ArrayRemove(shape, dimension);
            var newStrides = ArrayRemove(strides, dimension);
            return new NDArray(newSizes, newStrides, storage, storageOffset);
        }
public NDArray Squeeze ( int dimension ) { if ( DimensionCount == 1 ) throw new InvalidOperationException ( " " ) ; if ( dimension < 0 || dimension >= DimensionCount ) throw new ArgumentOutOfRangeException ( " " ) ; var newSizes = ArrayRemove ( shape , dimension ) ; var newStrides = ArrayRemove ( strides , dimension ) ; return new NDArray ( newSizes , newStrides , storage , storageOffset ) ; }
Return a new tensor where the given singleton dimension has been removed
Return a new tensor where the given singleton dimension has been removed
None
Squeeze requires 2 or more dimensions
Squeeze requires 2 or more dimensions
None
dimension
int
None