Backends/SiaNet.Backend.TensorSharp/Cuda/CudaStorage.cs
/// <summary>
/// Sets the element as float.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="value">The value.</param>
/// <exception cref="NotSupportedException">Element type " + ElementType + " not supported</exception>
Sets the element as float.
Sets the element as float .
public override void SetElementAsFloat(long index, float value)
        {
            var ptr = DevicePtrAtElement(index);
            if (ElementType == DType.Float32) { context.CopyToDevice(ptr, (float)value); }
            else if (ElementType == DType.Float64) { context.CopyToDevice(ptr, (double)value); }
            else if (ElementType == DType.Int32) { context.CopyToDevice(ptr, (int)value); }
            else if (ElementType == DType.UInt8) { context.CopyToDevice(ptr, (byte)value); }
            else
                throw new NotSupportedException("Element type " + ElementType + " not supported");
        }
public override void SetElementAsFloat ( long index , float value ) { var ptr = DevicePtrAtElement ( index ) ; if ( ElementType == DType . Float32 ) { context . CopyToDevice ( ptr , ( float ) value ) ; } else if ( ElementType == DType . Float64 ) { context . CopyToDevice ( ptr , ( double ) value ) ; } else if ( ElementType == DType . Int32 ) { context . CopyToDevice ( ptr , ( int ) value ) ; } else if ( ElementType == DType . UInt8 ) { context . CopyToDevice ( ptr , ( byte ) value ) ; } else throw new NotSupportedException ( " " + ElementType + " " ) ; }
Sets the element as float.
Sets the element as float .
Element type " + ElementType + " not supported
Element type " + ElementType + " not supported
index
long
None
value
float
None