Class TensorDescriptor
An opaque structure holding the description of a generic n-D dataset.
Inheritance
Implements
Inherited Members
Namespace: ManagedCuda.CudaDNN
Assembly: CudaDNN.dll
Syntax
public class TensorDescriptor : IDisposable
Constructors
| Improve this Doc View SourceTensorDescriptor()
Declaration
public TensorDescriptor()
Properties
| Improve this Doc View SourceDesc
Returns the inner handle.
Declaration
public cudnnTensorDescriptor Desc { get; }
Property Value
Type | Description |
---|---|
cudnnTensorDescriptor |
Methods
| Improve this Doc View SourceDispose()
Dispose
Declaration
public void Dispose()
Dispose(Boolean)
For IDisposable
Declaration
protected virtual void Dispose(bool fDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fDisposing |
Finalize()
For dispose
Declaration
protected void Finalize()
GetTensor4dDescriptor(ref cudnnDataType, ref Int32, ref Int32, ref Int32, ref Int32, ref Int32, ref Int32, ref Int32, ref Int32)
This function queries the parameters of the previouly initialized Tensor4D descriptor object.
Declaration
public void GetTensor4dDescriptor(ref cudnnDataType dataType, ref int n, ref int c, ref int h, ref int w, ref int nStride, ref int cStride, ref int hStride, ref int wStride)
Parameters
Type | Name | Description |
---|---|---|
cudnnDataType | dataType | Data type. |
System.Int32 | n | Number of images. |
System.Int32 | c | Number of feature maps per image. |
System.Int32 | h | Height of each feature map. |
System.Int32 | w | Width of each feature map. |
System.Int32 | nStride | Stride between two consecutive images. |
System.Int32 | cStride | Stride between two consecutive feature maps. |
System.Int32 | hStride | Stride between two consecutive rows. |
System.Int32 | wStride | Stride between two consecutive columns. |
GetTensorNdDescriptor(Int32, ref cudnnDataType, ref Int32, Int32[], Int32[])
This function retrieves values stored in a previously initialized Tensor descriptor object.
Declaration
public void GetTensorNdDescriptor(int nbDimsRequested, ref cudnnDataType dataType, ref int nbDims, int[] dimA, int[] strideA)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nbDimsRequested | Number of dimensions to extract from a given tensor descriptor. It is also the minimum size of the arrays dimA and strideA. If this number is greater than the resulting nbDims[0], only nbDims[0] dimensions will be returned. |
cudnnDataType | dataType | Data type. |
System.Int32 | nbDims | Actual number of dimensions of the tensor will be returned in nbDims[0]. |
System.Int32[] | dimA | Array of dimension of at least nbDimsRequested that will be filled with the dimensions from the provided tensor descriptor. |
System.Int32[] | strideA | Array of dimension of at least nbDimsRequested that will be filled with the strides from the provided tensor descriptor. |
GetTensorSizeInBytes()
This function returns the size of the tensor in memory in respect to the given descriptor. This function can be used to know the amount of GPU memory to be allocated to hold that tensor.
Declaration
public SizeT GetTensorSizeInBytes()
Returns
Type | Description |
---|---|
SizeT | Size in bytes needed to hold the tensor in GPU memory. |
SetTensor4dDescriptor(cudnnTensorFormat, cudnnDataType, Int32, Int32, Int32, Int32)
This function initializes a previously created generic Tensor descriptor object into a 4D tensor. The strides of the four dimensions are inferred from the format parameter and set in such a way that the data is contiguous in memory with no padding between dimensions.
Declaration
public void SetTensor4dDescriptor(cudnnTensorFormat format, cudnnDataType dataType, int n, int c, int h, int w)
Parameters
Type | Name | Description |
---|---|---|
cudnnTensorFormat | format | Type of format. |
cudnnDataType | dataType | Data type. |
System.Int32 | n | Number of images. |
System.Int32 | c | Number of feature maps per image. |
System.Int32 | h | Height of each feature map. |
System.Int32 | w | Width of each feature map. |
SetTensor4dDescriptorEx(cudnnDataType, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)
This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but with the strides explicitly passed as parameters. This can be used to lay out the 4D tensor in any order or simply to define gaps between dimensions.
Declaration
public void SetTensor4dDescriptorEx(cudnnDataType dataType, int n, int c, int h, int w, int nStride, int cStride, int hStride, int wStride)
Parameters
Type | Name | Description |
---|---|---|
cudnnDataType | dataType | Data type. |
System.Int32 | n | Number of images. |
System.Int32 | c | Number of feature maps per image. |
System.Int32 | h | Height of each feature map. |
System.Int32 | w | Width of each feature map. |
System.Int32 | nStride | Stride between two consecutive images. |
System.Int32 | cStride | Stride between two consecutive feature maps. |
System.Int32 | hStride | Stride between two consecutive rows. |
System.Int32 | wStride | Stride between two consecutive columns. |
SetTensorNdDescriptor(cudnnDataType, Int32, Int32[], Int32[])
This function initializes a previously created generic Tensor descriptor object.
Declaration
public void SetTensorNdDescriptor(cudnnDataType dataType, int nbDims, int[] dimA, int[] strideA)
Parameters
Type | Name | Description |
---|---|---|
cudnnDataType | dataType | Data type. |
System.Int32 | nbDims | Dimension of the tensor. |
System.Int32[] | dimA | Array of dimension nbDims that contain the size of the tensor for every dimension. |
System.Int32[] | strideA | Array of dimension nbDims that contain the stride of the tensor for every dimension. |
SetTensorNdDescriptorEx(cudnnTensorDescriptor, cudnnTensorFormat, cudnnDataType, Int32, Int32[])
This function initializes a previously created generic Tensor descriptor object.
Declaration
public void SetTensorNdDescriptorEx(cudnnTensorDescriptor tensorDesc, cudnnTensorFormat format, cudnnDataType dataType, int nbDims, int[] dimA)
Parameters
Type | Name | Description |
---|---|---|
cudnnTensorDescriptor | tensorDesc | Handle to a previously created tensor descriptor. |
cudnnTensorFormat | format | |
cudnnDataType | dataType | Data type. |
System.Int32 | nbDims | Dimension of the tensor. |
System.Int32[] | dimA | Array of dimension nbDims that contain the size of the tensor for every dimension. |