Backends/SiaNet.Backend.TensorSharp/NDArray.cs
/// <summary>
/// Note: this does not check whether indices are in range
/// </summary>
/// <param name="value">The value.</param>
/// <param name="indices">The indices.</param>
/// <exception cref="ArgumentException">
/// Number of indices must equal number of tensor dimensions
/// or
/// Index " + i + " with value " + indices[i] + " is out of range
/// </exception>
this does not check whether indices are in range
this does not check whether indices are in range
public void SetElementAsFloat(float value, params long[] indices)
        {
            if (indices.Length != DimensionCount) throw new ArgumentException("Number of indices must equal number of tensor dimensions");
            for (int i = 0; i < indices.Length; ++i)
            {
                if (indices[i] < 0 || indices[i] >= Shape[i])
                    throw new ArgumentException("Index " + i + " with value " + indices[i] + " is out of range");
            }
            long offset = 0;
            for (int i = 0; i < indices.Length; ++i)
            {
                offset += indices[i] * strides[i];
            }
            storage.SetElementAsFloat(storageOffset + offset, value);
        }
public void SetElementAsFloat ( float value , params long [ ] indices ) { if ( indices . Length != DimensionCount ) throw new ArgumentException ( " " ) ; for ( int i = 0 ; i < indices . Length ; ++ i ) { if ( indices [ i ] < 0 || indices [ i ] >= Shape [ i ] ) throw new ArgumentException ( " " + i + " " + indices [ i ] + " " ) ; } long offset = 0 ; for ( int i = 0 ; i < indices . Length ; ++ i ) { offset += indices [ i ] * strides [ i ] ; } storage . SetElementAsFloat ( storageOffset + offset , value ) ; }
Note: this does not check whether indices are in range
Note : this does not check whether indices are in range
Number of indices must equal number of tensor dimensions
or
Index " + i + " with value " + indices[i] + " is out of range
Number of indices must equal number of tensor dimensions or Index " + i + " with value " + indices [ i ] + " is out of range
value
float
None
indices
None