Library/ManagedCuda/CudaDNN/CudaDNNContext.cs
/// <summary>
/// This function copies the scaled data from one tensor to another tensor with a different
/// layout. Those descriptors need to have the same dimensions but not necessarily the
/// same strides. The input and output tensors must not overlap in any way (i.e., tensors
/// cannot be transformed in place). This function can be used to convert a tensor with an
/// unsupported format to a supported one.
/// </summary>
/// <param name="alpha">Pointer to scaling factors (in host memory) used to blend the source
/// value with prior value in the destination tensor as follows: dstValue =
/// alpha[0]*srcValue + beta[0]*priorDstValue. Please refer to this section for
/// additional details.</param>
/// <param name="xDesc">Handle to a previously initialized tensor descriptor.</param>
/// <param name="x">Pointer to data of the tensor described by the srcDesc descriptor.</param>
/// <param name="beta">Pointer to scaling factors (in host memory) used to blend the source
/// value with prior value in the destination tensor as follows: dstValue =
/// alpha[0]*srcValue + beta[0]*priorDstValue. Please refer to this section for
/// additional details.</param>
/// <param name="yDesc">Handle to a previously initialized tensor descriptor.</param>
/// <param name="y">Pointer to data of the tensor described by the destDesc descriptor.</param>
This function copies the scaled data from one tensor to another tensor with a different
layout. Those descriptors need to have the same dimensions but not necessarily the
same strides. The input and output tensors must not overlap in any way . This function can be used to convert a tensor with an
unsupported format to a supported one.
This function copies the scaled data from one tensor to another tensor with a different layout . Those descriptors need to have the same dimensions but not necessarily the same strides . The input and output tensors must not overlap in any way . This function can be used to convert a tensor with an unsupported format to a supported one .
public void TransformTensor(float alpha,
                                            TensorDescriptor xDesc,
                                            CudaDeviceVariable<float> x,
                                            float beta,
                                            TensorDescriptor yDesc,
                                            CudaDeviceVariable<float> y
                                        )
        {
            res = CudaDNNNativeMethods.cudnnTransformTensor(_handle, ref alpha, xDesc.Desc, x.DevicePointer, ref beta, yDesc.Desc, y.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnTransformTensor", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
        }
public void TransformTensor ( float alpha , TensorDescriptor xDesc , CudaDeviceVariable < float > x , float beta , TensorDescriptor yDesc , CudaDeviceVariable < float > y ) { res = CudaDNNNativeMethods . cudnnTransformTensor ( _handle , ref alpha , xDesc . Desc , x . DevicePointer , ref beta , yDesc . Desc , y . DevicePointer ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; }
This function copies the scaled data from one tensor to another tensor with a different
layout.
This function copies the scaled data from one tensor to another tensor with a different layout .
alpha
float
Pointer to scaling factors (in host memory) used to blend the source
value with prior value in the destination tensor as follows: dstValue
alpha[0]*srcValue + beta[0]*priorDstValue. Please refer to this section for
additional details.
Pointer to scaling factors ( in host memory ) used to blend the source value with prior value in the destination tensor as follows : dstValue alpha [ 0 ] * srcValue + beta [ 0 ] * priorDstValue . Please refer to this section for additional details .
xDesc
TensorDescriptor
Handle to a previously initialized tensor descriptor.
Handle to a previously initialized tensor descriptor .
x
CudaDeviceVariable<float>
Pointer to data of the tensor described by the srcDesc descriptor.
Pointer to data of the tensor described by the srcDesc descriptor .
beta
float
Pointer to scaling factors (in host memory) used to blend the source
value with prior value in the destination tensor as follows: dstValue
alpha[0]*srcValue + beta[0]*priorDstValue. Please refer to this section for
additional details.
Pointer to scaling factors ( in host memory ) used to blend the source value with prior value in the destination tensor as follows : dstValue alpha [ 0 ] * srcValue + beta [ 0 ] * priorDstValue . Please refer to this section for additional details .
yDesc
TensorDescriptor
Handle to a previously initialized tensor descriptor.
Handle to a previously initialized tensor descriptor .
y
CudaDeviceVariable<float>
Pointer to data of the tensor described by the destDesc descriptor.
Pointer to data of the tensor described by the destDesc descriptor .