Backends/SiaNet.Backend.TensorSharp/Cuda/KernelOps/CopyOps.cs
/// <summary>
/// Copies the gpu convert types.
/// </summary>
/// <param name="result">The result.</param>
/// <param name="src">The source.</param>
/// <param name="totalElements">The total elements.</param>
Copies the gpu convert types.
Copies the gpu convert types .
private void CopyGpuConvertTypes(NDArray result, NDArray src, long totalElements)
        {
            using (var srcCopy = new NDArray(cpuAllocator, src.ElementType, src.Shape))
            using (var srcConverted = new NDArray(cpuAllocator, result.ElementType, src.Shape))
            {
                CopyGpuToCpu(srcCopy, src, totalElements);
                Ops.Copy(srcConverted, srcCopy); 
                CopyCpuToGpu(result, srcConverted, totalElements);
            }
        }
private void CopyGpuConvertTypes ( NDArray result , NDArray src , long totalElements ) { using ( var srcCopy = new NDArray ( cpuAllocator , src . ElementType , src . Shape ) ) using ( var srcConverted = new NDArray ( cpuAllocator , result . ElementType , src . Shape ) ) { CopyGpuToCpu ( srcCopy , src , totalElements ) ; Ops . Copy ( srcConverted , srcCopy ) ; CopyCpuToGpu ( result , srcConverted , totalElements ) ; } }
Copies the gpu convert types.
Copies the gpu convert types .
// Type conversions are currently done via CPU // Do type conversion on CPU
result
NDArray
None
src
NDArray
None
totalElements
long
The total elements.
The total elements .