Backends/SiaNet.Backend.TensorSharp/NDArray.cs
/// <summary>
/// Return a new tensor where **all** singleton dimensions have been removed
/// </summary>
/// <returns>Tensor.</returns>
Return a new tensor where **all** singleton dimensions have been removed
Return a new tensor where ** all ** singleton dimensions have been removed
public NDArray Squeeze()
        {
            var newSizeStrides = shape.Zip(strides, Tuple.Create)
                .Where(x => x.Item1 != 1)
                .ToArray();
            var newSizes = newSizeStrides.Select(x => x.Item1).ToArray();
            var newStrides = newSizeStrides.Select(x => x.Item2).ToArray();
            return new NDArray(newSizes, newStrides, storage, storageOffset);
        }
public NDArray Squeeze ( ) { var newSizeStrides = shape . Zip ( strides , Tuple . Create ) . Where ( x => x . Item1 != 1 ) . ToArray ( ) ; var newSizes = newSizeStrides . Select ( x => x . Item1 ) . ToArray ( ) ; var newStrides = newSizeStrides . Select ( x => x . Item2 ) . ToArray ( ) ; return new NDArray ( newSizes , newStrides , storage , storageOffset ) ; }
Return a new tensor where **all** singleton dimensions have been removed
Return a new tensor where ** all ** singleton dimensions have been removed
None