Backends/SiaNet.Backend.TensorSharp/TensorDimensionHelpers.cs
/// <summary>
/// Gets the size of the storage.
/// </summary>
/// <param name="sizes">The sizes.</param>
/// <param name="strides">The strides.</param>
/// <returns>System.Int64.</returns>
Gets the size of the storage.
Gets the size of the storage .
public static long GetStorageSize(long[] sizes, long[] strides)
        {
            long offset = 0;
            for (int i = 0; i < sizes.Length; ++i)
            {
                offset += (sizes[i] - 1) * strides[i];
            }
            return offset + 1; 
        }
public static long GetStorageSize ( long [ ] sizes , long [ ] strides ) { long offset = 0 ; for ( int i = 0 ; i < sizes . Length ; ++ i ) { offset += ( sizes [ i ] - 1 ) * strides [ i ] ; } return offset + 1 ; }
Gets the size of the storage.
Gets the size of the storage .
// +1 to count last element, which is at *index* equal to offset
None
sizes
long[]
None
strides
long[]
None