Backends/SiaNet.Backend.Torch/FileOperations.cs
/// <summary>
///   Write floats to the file from the given float array.
/// </summary>
/// <param name="data">An array containing data to be written to the file.</param>
/// <param name="n">The number of floats to write. Pass -1 (default) to write the whole array.</param>
/// <returns>The number of floats written.</returns>
Write floats to the file from the given float array.
Write floats to the file from the given float array .
public long WriteFloats(float[] data, int n = -1)
        {
            if (n < -1)
                throw new ArgumentOutOfRangeException("n cannot be less than -1");
            n = (n == -1) ? data.Length : Math.Min(n, data.Length);
            unsafe
            {
                fixed (float *dest = data)
                {
                    var writtenItems = THFile_writeFloatRaw(this.handle, (IntPtr)dest, n);
                    return writtenItems;
                }
            }
        }
public long WriteFloats ( float [ ] data , int n = - 1 ) { if ( n < - 1 ) throw new ArgumentOutOfRangeException ( " " ) ; n = ( n == - 1 ) ? data . Length : Math . Min ( n , data . Length ) ; unsafe { fixed ( float * dest = data ) { var writtenItems = THFile_writeFloatRaw ( this . handle , ( IntPtr ) dest , n ) ; return writtenItems ; } } }
Write floats to the file from the given float array.
Write floats to the file from the given float array .
The number of floats written.
The number of floats written .
data
float[]
An array containing data to be written to the file.
An array containing data to be written to the file .
n
int
The number of floats to write. Pass -1 (default) to write the whole array.
The number of floats to write . Pass - 1 ( default ) to write the whole array .