cudnn

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cudnn provides low-level Go bindings for cuDNN (CUDA Deep Neural Network library).

cuDNN provides GPU-accelerated primitives for deep neural networks including convolution, pooling, softmax, batch normalization, activation, RNN, attention, and CTC loss operations.

The central type is Handle, which manages a cuDNN context. Most operations require tensor descriptors (TensorDescriptor) and other descriptors to describe the data layout. Create handles and descriptors with the Create* functions (e.g., Create, CreateTensorDescriptor) and clean up with the corresponding Destroy methods.

This package provides bindings generated from cudnn.h using github.com/ebitengine/purego for cgo-free dynamic loading of libcudnn. Functions returning a C status report errors wrapping cudnnStatus_t with descriptive messages from cudnnGetErrorString.

Activation

Backend API

Batch Normalization

CTC Loss

  • Handle.CTCLoss: returns the CTC costs and gradients, given the probabilities and labels.
  • Handle.CTCLossV1: returns the CTC costs and gradients, given the probabilities and labels.
  • Handle.CTCLossV8: returns the CTC costs and gradients, given the probabilities and labels.

Convolution

Lifecycle

Dropout

Version Queries

  • GetCudartVersion: The same version of a given cuDNN library can be compiled against different CUDA toolkit versions.
  • GetMaxDeviceVersion: returns the maximum SM version that the cuDNN library is aware of and supports natively.
  • GetVersion: returns the version number of the cuDNN library.

Stream Management

  • Handle.Stream: retrieves the user CUDA stream programmed in the cuDNN handle.
  • Handle.SetStream: sets the user’s CUDA stream in the cuDNN handle.

LRN

Normalization

Tensor Operations

  • Handle.OpTensor: implements the equation C = op(alpha1[0] * A, alpha2[0] * B) + beta[0] * C, given the tensors A, B, and C and the scaling factors alpha1, alpha2, and beta.
  • Handle.ReduceTensor: reduces tensor A by implementing the equation C = alpha * reduce op ( A ) + beta * C, given tensors A and C and scaling factors alpha and beta.

Pooling

  • Handle.PoolingBackward: computes the gradient of a pooling operation.
  • Handle.PoolingForward: computes pooling of input values (meaning, the maximum or average of several adjacent values) to produce an output with smaller height and/or width.

RNN

  • Handle.RNNBackwardData: computes exact, first-order derivatives of the RNN model with respect to its inputs: x, hx and for the LSTM cell type also cx.
  • Handle.RNNBackwardWeights: computes exact, first-order derivatives of the RNN model with respect to all trainable parameters: weights and biases.
  • Handle.RNNForward: This routine computes the forward response of the recurrent neural network described by rnnDesc with inputs in x, hx, cx, and weights/biases in the weightSpace buffer.
  • RNNDescriptor.Clip: Retrieves the current LSTM cell clipping parameters, and stores them in the arguments provided.
  • RNNDescriptor.SetClip: Sets the LSTM cell clipping mode.

Softmax

Other

Example

Example creates a cuDNN handle, queries the library version, and creates a tensor descriptor. It returns early when the cuDNN library is not available. It has no Output comment, so it is compiled but not run: what it prints depends on the host's cuDNN.

package main

import (
	"fmt"

	"github.com/tmc/lib/nvidia/cudnn"
)

func main() {
	h, err := cudnn.Create()
	if err != nil {
		fmt.Println("cuDNN unavailable:", err)
		return
	}
	defer h.Destroy()

	major, err := cudnn.GetProperty(cudnn.MajorVersion)
	if err != nil {
		fmt.Println("property:", err)
		return
	}
	fmt.Println("cuDNN major version:", major)

	desc, err := cudnn.CreateTensorDescriptor()
	if err != nil {
		fmt.Println("tensor descriptor:", err)
		return
	}
	defer desc.Destroy()
	fmt.Println("tensor descriptor ready")
}

Index

Examples

Constants

View Source
const (
	MaxSmMajorNumber      = 12
	MaxSmMinorNumber      = 1
	SevErrorEn            = (1 << SevError)
	SevWarningEn          = (1 << SevWarning)
	SevInfoEn             = (1 << SevInfo)
	DimMax                = 8
	LrnMinN               = 1    /* minimum allowed lrnN */
	LrnMaxN               = 16   /* maximum allowed lrnN */
	LrnMinK               = 1e-5 /* minimum allowed lrnK */
	LrnMinBeta            = 0.01 /* minimum allowed lrnBeta */
	BnMinEpsilon          = 0.0  /* Minimum epsilon allowed to be used in the Batch Normalization formula */
	RnnPaddedIoDisabled   = 0
	RnnPaddedIoEnabled    = (1 << 0)
	SeqdataDimCount       = 4        /* dimension count */
	AttnQuerymapAllToOne  = 0        /* multiple Q-s map to a single (K,V) set when beam size > 1 */
	AttnQuerymapOneToOne  = (1 << 0) /* multiple Q-s map to multiple (K,V) sets when beam size > 1 */
	AttnDisableProjBiases = 0        /* no biases in attention input and output projections */
	AttnEnableProjBiases  = (1 << 1) /* use biases in attention input and output projections */
	AttnWkindCount        = 8        /* Number of attention weight/bias tensors */
)

Public option flags and numeric limits from the selected cuDNN headers.

Variables

This section is empty.

Functions

func AdvVersionCheck

func AdvVersionCheck() error

AdvVersionCheck checks that the version of cuDNN's adv sub-library matches those of the sub-libraries it depends on.

Cross-library version checker.

Each sublibrary has a version checker that checks whether its own version matches that of its dependencies.

A nil error means the version check passed.

Errors:

Wraps cudnnAdvVersionCheck.

func Close

func Close() error

Close unloads the library and clears all bound function pointers.

The function pointers are package-level state, so Close must not be called concurrently with any other call into this package: doing so is a use-after-free. It is intended for test teardown, not for reclaiming a live library.

func CnnVersionCheck

func CnnVersionCheck() error

CnnVersionCheck checks that the version of cuDNN's cnn sub-library matches those of the sub-libraries it depends on.

Cross-library version checker.

Each sublibrary has a version checker that checks whether its own version matches that of its dependencies.

A nil error means the version check passed.

Errors:

Wraps cudnnCnnVersionCheck.

func GetCallback

func GetCallback(fptr unsafe.Pointer) (uint32, uintptr, error)

GetCallback queries the internal states of cuDNN error reporting functionality.

  • fptr: Output. Pointer to the address where the current internally stored callback function pointer will be stored. When the built-in default callback function is used, NULL will be outputted

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: If any of the input parameters are NULL.

Wraps cudnnGetCallback.

func GetCudartVersion

func GetCudartVersion() (uint, error)

GetCudartVersion returns the version of the CUDA toolkit the loaded cuDNN library was compiled against.

The same version of a given cuDNN library can be compiled against different CUDA toolkit versions.

This routine returns the CUDA toolkit version that the currently used cuDNN library has been compiled against.

Wraps cudnnGetCudartVersion. The error reports an unavailable library or symbol.

func GetLastErrorString

func GetLastErrorString(message *byte, maxSize uint) error

GetLastErrorString retrieves the last encountered cuDNN error message in the current thread to a NULL terminated (ASCIIZ) string.

Inside the cuDNN library, the messages are stored in thread local buffers. The error is cleared after the user calls this API to retrieve it.

  • message: Output. Pointer to a character buffer that can store the error message. As we do not manage the thread-safety of the pre-allocated output buffer “message” to avoid unnecessary overhead, we ask that the user ensure it is thread-safe themselves on their own need-basis
  • maxSize: Input. Maximum size that can be stored in the location pointed to by message. The output is strictly limited by the size limit maxSize, also counting the terminator character 0, which will be automatically appended to the message if there is space

Wraps cudnnGetLastErrorString. The error reports an unavailable library or symbol.

func GetMaxDeviceVersion

func GetMaxDeviceVersion() (uint, error)

GetMaxDeviceVersion returns the maximum SM version that the cuDNN library is aware of and supports natively.

Any SM version higher than this would be supported in forward compatibility mode. For more information about forward compatibility, refer to the cuDNN Developer Guide.

Wraps cudnnGetMaxDeviceVersion. The error reports an unavailable library or symbol.

func GetProperty

func GetProperty(type_ LibraryPropertyType) (int32, error)

GetProperty writes a specific part of the cuDNN library version number into the provided host storage.

  • type_: Input. Enumerant type that instructs the function to report the numerical value of the cuDNN major version, minor version, or the patch level depending on whether type is set to MAJOR_VERSION, MINOR_VERSION, or PATCH_LEVEL

A nil error means version information was stored successfully at the provided address.

Errors:

Wraps cudnnGetProperty.

func GetVersion

func GetVersion() (uint, error)

GetVersion returns the version number of the cuDNN library.

It returns the CUDNN_VERSION defined present in the cudnn.h header file. Starting with release R2, the routine can be used to identify dynamically the current cuDNN library used by the application. The defined CUDNN_VERSION can be used to have the same application linked against different cuDNN versions using conditional compilation statements.

Wraps cudnnGetVersion. The error reports an unavailable library or symbol.

func GraphVersionCheck

func GraphVersionCheck() error

GraphVersionCheck checks that the version of cuDNN's graph sub-library matches those of the sub-libraries it depends on.

Cross-library version checker.

Each sub-library has a version checker that checks whether its own version matches that of its dependencies.

A nil error means the version check passed.

Errors:

Wraps cudnnGraphVersionCheck.

func Has

func Has(symbol string) bool

Has reports whether the named C symbol resolved in the loaded library, loading it first if necessary. It returns false if the library failed to load. Use it to gate on capabilities before calling into them.

func HasActivationBackward

func HasActivationBackward() bool

HasActivationBackward reports whether cudnnActivationBackward resolved in the loaded library.

func HasActivationForward

func HasActivationForward() bool

HasActivationForward reports whether cudnnActivationForward resolved in the loaded library.

func HasAddTensor

func HasAddTensor() bool

HasAddTensor reports whether cudnnAddTensor resolved in the loaded library.

func HasAdvVersionCheck

func HasAdvVersionCheck() bool

HasAdvVersionCheck reports whether cudnnAdvVersionCheck resolved in the loaded library.

func HasBackendCreateDescriptor

func HasBackendCreateDescriptor() bool

HasBackendCreateDescriptor reports whether cudnnBackendCreateDescriptor resolved in the loaded library.

func HasBackendDestroyDescriptor

func HasBackendDestroyDescriptor() bool

HasBackendDestroyDescriptor reports whether cudnnBackendDestroyDescriptor resolved in the loaded library.

func HasBackendExecute

func HasBackendExecute() bool

HasBackendExecute reports whether cudnnBackendExecute resolved in the loaded library.

func HasBackendFinalize

func HasBackendFinalize() bool

HasBackendFinalize reports whether cudnnBackendFinalize resolved in the loaded library.

func HasBackendGetAttribute

func HasBackendGetAttribute() bool

HasBackendGetAttribute reports whether cudnnBackendGetAttribute resolved in the loaded library.

func HasBackendInitialize

func HasBackendInitialize() bool

HasBackendInitialize reports whether cudnnBackendInitialize resolved in the loaded library.

func HasBackendPopulateCudaGraph

func HasBackendPopulateCudaGraph() bool

HasBackendPopulateCudaGraph reports whether cudnnBackendPopulateCudaGraph resolved in the loaded library.

func HasBackendSetAttribute

func HasBackendSetAttribute() bool

HasBackendSetAttribute reports whether cudnnBackendSetAttribute resolved in the loaded library.

func HasBackendUpdateCudaGraph

func HasBackendUpdateCudaGraph() bool

HasBackendUpdateCudaGraph reports whether cudnnBackendUpdateCudaGraph resolved in the loaded library.

func HasBatchNormalizationBackward

func HasBatchNormalizationBackward() bool

HasBatchNormalizationBackward reports whether cudnnBatchNormalizationBackward resolved in the loaded library.

func HasBatchNormalizationBackwardEx

func HasBatchNormalizationBackwardEx() bool

HasBatchNormalizationBackwardEx reports whether cudnnBatchNormalizationBackwardEx resolved in the loaded library.

func HasBatchNormalizationForwardInference

func HasBatchNormalizationForwardInference() bool

HasBatchNormalizationForwardInference reports whether cudnnBatchNormalizationForwardInference resolved in the loaded library.

func HasBatchNormalizationForwardTraining

func HasBatchNormalizationForwardTraining() bool

HasBatchNormalizationForwardTraining reports whether cudnnBatchNormalizationForwardTraining resolved in the loaded library.

func HasBatchNormalizationForwardTrainingEx

func HasBatchNormalizationForwardTrainingEx() bool

HasBatchNormalizationForwardTrainingEx reports whether cudnnBatchNormalizationForwardTrainingEx resolved in the loaded library.

func HasBuildRNNDynamic

func HasBuildRNNDynamic() bool

HasBuildRNNDynamic reports whether cudnnBuildRNNDynamic resolved in the loaded library.

func HasCTCLoss

func HasCTCLoss() bool

HasCTCLoss reports whether cudnnCTCLoss resolved in the loaded library.

func HasCTCLossV1

func HasCTCLossV1() bool

HasCTCLossV1 reports whether cudnnCTCLoss resolved in the loaded library.

func HasCTCLossV8

func HasCTCLossV8() bool

HasCTCLossV8 reports whether cudnnCTCLoss_v8 resolved in the loaded library.

func HasCnnVersionCheck

func HasCnnVersionCheck() bool

HasCnnVersionCheck reports whether cudnnCnnVersionCheck resolved in the loaded library.

func HasConvolutionBackwardBias

func HasConvolutionBackwardBias() bool

HasConvolutionBackwardBias reports whether cudnnConvolutionBackwardBias resolved in the loaded library.

func HasConvolutionBackwardData

func HasConvolutionBackwardData() bool

HasConvolutionBackwardData reports whether cudnnConvolutionBackwardData resolved in the loaded library.

func HasConvolutionBackwardFilter

func HasConvolutionBackwardFilter() bool

HasConvolutionBackwardFilter reports whether cudnnConvolutionBackwardFilter resolved in the loaded library.

func HasConvolutionBiasActivationForward

func HasConvolutionBiasActivationForward() bool

HasConvolutionBiasActivationForward reports whether cudnnConvolutionBiasActivationForward resolved in the loaded library.

func HasConvolutionForward

func HasConvolutionForward() bool

HasConvolutionForward reports whether cudnnConvolutionForward resolved in the loaded library.

func HasCreate

func HasCreate() bool

HasCreate reports whether cudnnCreate resolved in the loaded library.

func HasCreateActivationDescriptor

func HasCreateActivationDescriptor() bool

HasCreateActivationDescriptor reports whether cudnnCreateActivationDescriptor resolved in the loaded library.

func HasCreateAttnDescriptor

func HasCreateAttnDescriptor() bool

HasCreateAttnDescriptor reports whether cudnnCreateAttnDescriptor resolved in the loaded library.

func HasCreateCTCLossDescriptor

func HasCreateCTCLossDescriptor() bool

HasCreateCTCLossDescriptor reports whether cudnnCreateCTCLossDescriptor resolved in the loaded library.

func HasCreateConvolutionDescriptor

func HasCreateConvolutionDescriptor() bool

HasCreateConvolutionDescriptor reports whether cudnnCreateConvolutionDescriptor resolved in the loaded library.

func HasCreateDropoutDescriptor

func HasCreateDropoutDescriptor() bool

HasCreateDropoutDescriptor reports whether cudnnCreateDropoutDescriptor resolved in the loaded library.

func HasCreateFilterDescriptor

func HasCreateFilterDescriptor() bool

HasCreateFilterDescriptor reports whether cudnnCreateFilterDescriptor resolved in the loaded library.

func HasCreateFusedOpsConstParamPack

func HasCreateFusedOpsConstParamPack() bool

HasCreateFusedOpsConstParamPack reports whether cudnnCreateFusedOpsConstParamPack resolved in the loaded library.

func HasCreateFusedOpsPlan

func HasCreateFusedOpsPlan() bool

HasCreateFusedOpsPlan reports whether cudnnCreateFusedOpsPlan resolved in the loaded library.

func HasCreateFusedOpsVariantParamPack

func HasCreateFusedOpsVariantParamPack() bool

HasCreateFusedOpsVariantParamPack reports whether cudnnCreateFusedOpsVariantParamPack resolved in the loaded library.

func HasCreateLRNDescriptor

func HasCreateLRNDescriptor() bool

HasCreateLRNDescriptor reports whether cudnnCreateLRNDescriptor resolved in the loaded library.

func HasCreateOpTensorDescriptor

func HasCreateOpTensorDescriptor() bool

HasCreateOpTensorDescriptor reports whether cudnnCreateOpTensorDescriptor resolved in the loaded library.

func HasCreatePoolingDescriptor

func HasCreatePoolingDescriptor() bool

HasCreatePoolingDescriptor reports whether cudnnCreatePoolingDescriptor resolved in the loaded library.

func HasCreateRNNDataDescriptor

func HasCreateRNNDataDescriptor() bool

HasCreateRNNDataDescriptor reports whether cudnnCreateRNNDataDescriptor resolved in the loaded library.

func HasCreateRNNDescriptor

func HasCreateRNNDescriptor() bool

HasCreateRNNDescriptor reports whether cudnnCreateRNNDescriptor resolved in the loaded library.

func HasCreateReduceTensorDescriptor

func HasCreateReduceTensorDescriptor() bool

HasCreateReduceTensorDescriptor reports whether cudnnCreateReduceTensorDescriptor resolved in the loaded library.

func HasCreateSeqDataDescriptor

func HasCreateSeqDataDescriptor() bool

HasCreateSeqDataDescriptor reports whether cudnnCreateSeqDataDescriptor resolved in the loaded library.

func HasCreateSpatialTransformerDescriptor

func HasCreateSpatialTransformerDescriptor() bool

HasCreateSpatialTransformerDescriptor reports whether cudnnCreateSpatialTransformerDescriptor resolved in the loaded library.

func HasCreateTensorDescriptor

func HasCreateTensorDescriptor() bool

HasCreateTensorDescriptor reports whether cudnnCreateTensorDescriptor resolved in the loaded library.

func HasCreateTensorTransformDescriptor

func HasCreateTensorTransformDescriptor() bool

HasCreateTensorTransformDescriptor reports whether cudnnCreateTensorTransformDescriptor resolved in the loaded library.

func HasDeriveBNTensorDescriptor

func HasDeriveBNTensorDescriptor() bool

HasDeriveBNTensorDescriptor reports whether cudnnDeriveBNTensorDescriptor resolved in the loaded library.

func HasDeriveNormTensorDescriptor

func HasDeriveNormTensorDescriptor() bool

HasDeriveNormTensorDescriptor reports whether cudnnDeriveNormTensorDescriptor resolved in the loaded library.

func HasDestroy

func HasDestroy() bool

HasDestroy reports whether cudnnDestroy resolved in the loaded library.

func HasDestroyActivationDescriptor

func HasDestroyActivationDescriptor() bool

HasDestroyActivationDescriptor reports whether cudnnDestroyActivationDescriptor resolved in the loaded library.

func HasDestroyAttnDescriptor

func HasDestroyAttnDescriptor() bool

HasDestroyAttnDescriptor reports whether cudnnDestroyAttnDescriptor resolved in the loaded library.

func HasDestroyCTCLossDescriptor

func HasDestroyCTCLossDescriptor() bool

HasDestroyCTCLossDescriptor reports whether cudnnDestroyCTCLossDescriptor resolved in the loaded library.

func HasDestroyConvolutionDescriptor

func HasDestroyConvolutionDescriptor() bool

HasDestroyConvolutionDescriptor reports whether cudnnDestroyConvolutionDescriptor resolved in the loaded library.

func HasDestroyDropoutDescriptor

func HasDestroyDropoutDescriptor() bool

HasDestroyDropoutDescriptor reports whether cudnnDestroyDropoutDescriptor resolved in the loaded library.

func HasDestroyFilterDescriptor

func HasDestroyFilterDescriptor() bool

HasDestroyFilterDescriptor reports whether cudnnDestroyFilterDescriptor resolved in the loaded library.

func HasDestroyFusedOpsConstParamPack

func HasDestroyFusedOpsConstParamPack() bool

HasDestroyFusedOpsConstParamPack reports whether cudnnDestroyFusedOpsConstParamPack resolved in the loaded library.

func HasDestroyFusedOpsPlan

func HasDestroyFusedOpsPlan() bool

HasDestroyFusedOpsPlan reports whether cudnnDestroyFusedOpsPlan resolved in the loaded library.

func HasDestroyFusedOpsVariantParamPack

func HasDestroyFusedOpsVariantParamPack() bool

HasDestroyFusedOpsVariantParamPack reports whether cudnnDestroyFusedOpsVariantParamPack resolved in the loaded library.

func HasDestroyLRNDescriptor

func HasDestroyLRNDescriptor() bool

HasDestroyLRNDescriptor reports whether cudnnDestroyLRNDescriptor resolved in the loaded library.

func HasDestroyOpTensorDescriptor

func HasDestroyOpTensorDescriptor() bool

HasDestroyOpTensorDescriptor reports whether cudnnDestroyOpTensorDescriptor resolved in the loaded library.

func HasDestroyPoolingDescriptor

func HasDestroyPoolingDescriptor() bool

HasDestroyPoolingDescriptor reports whether cudnnDestroyPoolingDescriptor resolved in the loaded library.

func HasDestroyRNNDataDescriptor

func HasDestroyRNNDataDescriptor() bool

HasDestroyRNNDataDescriptor reports whether cudnnDestroyRNNDataDescriptor resolved in the loaded library.

func HasDestroyRNNDescriptor

func HasDestroyRNNDescriptor() bool

HasDestroyRNNDescriptor reports whether cudnnDestroyRNNDescriptor resolved in the loaded library.

func HasDestroyReduceTensorDescriptor

func HasDestroyReduceTensorDescriptor() bool

HasDestroyReduceTensorDescriptor reports whether cudnnDestroyReduceTensorDescriptor resolved in the loaded library.

func HasDestroySeqDataDescriptor

func HasDestroySeqDataDescriptor() bool

HasDestroySeqDataDescriptor reports whether cudnnDestroySeqDataDescriptor resolved in the loaded library.

func HasDestroySpatialTransformerDescriptor

func HasDestroySpatialTransformerDescriptor() bool

HasDestroySpatialTransformerDescriptor reports whether cudnnDestroySpatialTransformerDescriptor resolved in the loaded library.

func HasDestroyTensorDescriptor

func HasDestroyTensorDescriptor() bool

HasDestroyTensorDescriptor reports whether cudnnDestroyTensorDescriptor resolved in the loaded library.

func HasDestroyTensorTransformDescriptor

func HasDestroyTensorTransformDescriptor() bool

HasDestroyTensorTransformDescriptor reports whether cudnnDestroyTensorTransformDescriptor resolved in the loaded library.

func HasDivisiveNormalizationBackward

func HasDivisiveNormalizationBackward() bool

HasDivisiveNormalizationBackward reports whether cudnnDivisiveNormalizationBackward resolved in the loaded library.

func HasDivisiveNormalizationForward

func HasDivisiveNormalizationForward() bool

HasDivisiveNormalizationForward reports whether cudnnDivisiveNormalizationForward resolved in the loaded library.

func HasDropoutBackward

func HasDropoutBackward() bool

HasDropoutBackward reports whether cudnnDropoutBackward resolved in the loaded library.

func HasDropoutForward

func HasDropoutForward() bool

HasDropoutForward reports whether cudnnDropoutForward resolved in the loaded library.

func HasDropoutGetReserveSpaceSize

func HasDropoutGetReserveSpaceSize() bool

HasDropoutGetReserveSpaceSize reports whether cudnnDropoutGetReserveSpaceSize resolved in the loaded library.

func HasDropoutGetStatesSize

func HasDropoutGetStatesSize() bool

HasDropoutGetStatesSize reports whether cudnnDropoutGetStatesSize resolved in the loaded library.

func HasFindConvolutionBackwardDataAlgorithm

func HasFindConvolutionBackwardDataAlgorithm() bool

HasFindConvolutionBackwardDataAlgorithm reports whether cudnnFindConvolutionBackwardDataAlgorithm resolved in the loaded library.

func HasFindConvolutionBackwardDataAlgorithmEx

func HasFindConvolutionBackwardDataAlgorithmEx() bool

HasFindConvolutionBackwardDataAlgorithmEx reports whether cudnnFindConvolutionBackwardDataAlgorithmEx resolved in the loaded library.

func HasFindConvolutionBackwardFilterAlgorithm

func HasFindConvolutionBackwardFilterAlgorithm() bool

HasFindConvolutionBackwardFilterAlgorithm reports whether cudnnFindConvolutionBackwardFilterAlgorithm resolved in the loaded library.

func HasFindConvolutionBackwardFilterAlgorithmEx

func HasFindConvolutionBackwardFilterAlgorithmEx() bool

HasFindConvolutionBackwardFilterAlgorithmEx reports whether cudnnFindConvolutionBackwardFilterAlgorithmEx resolved in the loaded library.

func HasFindConvolutionForwardAlgorithm

func HasFindConvolutionForwardAlgorithm() bool

HasFindConvolutionForwardAlgorithm reports whether cudnnFindConvolutionForwardAlgorithm resolved in the loaded library.

func HasFindConvolutionForwardAlgorithmEx

func HasFindConvolutionForwardAlgorithmEx() bool

HasFindConvolutionForwardAlgorithmEx reports whether cudnnFindConvolutionForwardAlgorithmEx resolved in the loaded library.

func HasFusedOpsExecute

func HasFusedOpsExecute() bool

HasFusedOpsExecute reports whether cudnnFusedOpsExecute resolved in the loaded library.

func HasGetActivationDescriptor

func HasGetActivationDescriptor() bool

HasGetActivationDescriptor reports whether cudnnGetActivationDescriptor resolved in the loaded library.

func HasGetActivationDescriptorSwishBeta

func HasGetActivationDescriptorSwishBeta() bool

HasGetActivationDescriptorSwishBeta reports whether cudnnGetActivationDescriptorSwishBeta resolved in the loaded library.

func HasGetAttnDescriptor

func HasGetAttnDescriptor() bool

HasGetAttnDescriptor reports whether cudnnGetAttnDescriptor resolved in the loaded library.

func HasGetBatchNormalizationBackwardExWorkspaceSize

func HasGetBatchNormalizationBackwardExWorkspaceSize() bool

HasGetBatchNormalizationBackwardExWorkspaceSize reports whether cudnnGetBatchNormalizationBackwardExWorkspaceSize resolved in the loaded library.

func HasGetBatchNormalizationForwardTrainingExWorkspaceSize

func HasGetBatchNormalizationForwardTrainingExWorkspaceSize() bool

HasGetBatchNormalizationForwardTrainingExWorkspaceSize reports whether cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize resolved in the loaded library.

func HasGetBatchNormalizationTrainingExReserveSpaceSize

func HasGetBatchNormalizationTrainingExReserveSpaceSize() bool

HasGetBatchNormalizationTrainingExReserveSpaceSize reports whether cudnnGetBatchNormalizationTrainingExReserveSpaceSize resolved in the loaded library.

func HasGetCTCLossDescriptor

func HasGetCTCLossDescriptor() bool

HasGetCTCLossDescriptor reports whether cudnnGetCTCLossDescriptor_v9 resolved in the loaded library.

func HasGetCTCLossDescriptorEx

func HasGetCTCLossDescriptorEx() bool

HasGetCTCLossDescriptorEx reports whether cudnnGetCTCLossDescriptorEx resolved in the loaded library.

func HasGetCTCLossWorkspaceSize

func HasGetCTCLossWorkspaceSize() bool

HasGetCTCLossWorkspaceSize reports whether cudnnGetCTCLossWorkspaceSize resolved in the loaded library.

func HasGetCTCLossWorkspaceSizeV1

func HasGetCTCLossWorkspaceSizeV1() bool

HasGetCTCLossWorkspaceSizeV1 reports whether cudnnGetCTCLossWorkspaceSize resolved in the loaded library.

func HasGetCTCLossWorkspaceSizeV8

func HasGetCTCLossWorkspaceSizeV8() bool

HasGetCTCLossWorkspaceSizeV8 reports whether cudnnGetCTCLossWorkspaceSize_v8 resolved in the loaded library.

func HasGetCallback

func HasGetCallback() bool

HasGetCallback reports whether cudnnGetCallback resolved in the loaded library.

func HasGetConvolution2dDescriptor

func HasGetConvolution2dDescriptor() bool

HasGetConvolution2dDescriptor reports whether cudnnGetConvolution2dDescriptor resolved in the loaded library.

func HasGetConvolution2dForwardOutputDim

func HasGetConvolution2dForwardOutputDim() bool

HasGetConvolution2dForwardOutputDim reports whether cudnnGetConvolution2dForwardOutputDim resolved in the loaded library.

func HasGetConvolutionBackwardDataAlgorithm

func HasGetConvolutionBackwardDataAlgorithm() bool

HasGetConvolutionBackwardDataAlgorithm reports whether cudnnGetConvolutionBackwardDataAlgorithm_v7 resolved in the loaded library.

func HasGetConvolutionBackwardDataAlgorithmMaxCount

func HasGetConvolutionBackwardDataAlgorithmMaxCount() bool

HasGetConvolutionBackwardDataAlgorithmMaxCount reports whether cudnnGetConvolutionBackwardDataAlgorithmMaxCount resolved in the loaded library.

func HasGetConvolutionBackwardDataWorkspaceSize

func HasGetConvolutionBackwardDataWorkspaceSize() bool

HasGetConvolutionBackwardDataWorkspaceSize reports whether cudnnGetConvolutionBackwardDataWorkspaceSize resolved in the loaded library.

func HasGetConvolutionBackwardFilterAlgorithm

func HasGetConvolutionBackwardFilterAlgorithm() bool

HasGetConvolutionBackwardFilterAlgorithm reports whether cudnnGetConvolutionBackwardFilterAlgorithm_v7 resolved in the loaded library.

func HasGetConvolutionBackwardFilterAlgorithmMaxCount

func HasGetConvolutionBackwardFilterAlgorithmMaxCount() bool

HasGetConvolutionBackwardFilterAlgorithmMaxCount reports whether cudnnGetConvolutionBackwardFilterAlgorithmMaxCount resolved in the loaded library.

func HasGetConvolutionBackwardFilterWorkspaceSize

func HasGetConvolutionBackwardFilterWorkspaceSize() bool

HasGetConvolutionBackwardFilterWorkspaceSize reports whether cudnnGetConvolutionBackwardFilterWorkspaceSize resolved in the loaded library.

func HasGetConvolutionForwardAlgorithm

func HasGetConvolutionForwardAlgorithm() bool

HasGetConvolutionForwardAlgorithm reports whether cudnnGetConvolutionForwardAlgorithm_v7 resolved in the loaded library.

func HasGetConvolutionForwardAlgorithmMaxCount

func HasGetConvolutionForwardAlgorithmMaxCount() bool

HasGetConvolutionForwardAlgorithmMaxCount reports whether cudnnGetConvolutionForwardAlgorithmMaxCount resolved in the loaded library.

func HasGetConvolutionForwardWorkspaceSize

func HasGetConvolutionForwardWorkspaceSize() bool

HasGetConvolutionForwardWorkspaceSize reports whether cudnnGetConvolutionForwardWorkspaceSize resolved in the loaded library.

func HasGetConvolutionGroupCount

func HasGetConvolutionGroupCount() bool

HasGetConvolutionGroupCount reports whether cudnnGetConvolutionGroupCount resolved in the loaded library.

func HasGetConvolutionMathType

func HasGetConvolutionMathType() bool

HasGetConvolutionMathType reports whether cudnnGetConvolutionMathType resolved in the loaded library.

func HasGetConvolutionNdDescriptor

func HasGetConvolutionNdDescriptor() bool

HasGetConvolutionNdDescriptor reports whether cudnnGetConvolutionNdDescriptor resolved in the loaded library.

func HasGetConvolutionNdForwardOutputDim

func HasGetConvolutionNdForwardOutputDim() bool

HasGetConvolutionNdForwardOutputDim reports whether cudnnGetConvolutionNdForwardOutputDim resolved in the loaded library.

func HasGetConvolutionReorderType

func HasGetConvolutionReorderType() bool

HasGetConvolutionReorderType reports whether cudnnGetConvolutionReorderType resolved in the loaded library.

func HasGetCudartVersion

func HasGetCudartVersion() bool

HasGetCudartVersion reports whether cudnnGetCudartVersion resolved in the loaded library.

func HasGetDropoutDescriptor

func HasGetDropoutDescriptor() bool

HasGetDropoutDescriptor reports whether cudnnGetDropoutDescriptor resolved in the loaded library.

func HasGetErrorString

func HasGetErrorString() bool

HasGetErrorString reports whether cudnnGetErrorString resolved in the loaded library.

func HasGetFilter4dDescriptor

func HasGetFilter4dDescriptor() bool

HasGetFilter4dDescriptor reports whether cudnnGetFilter4dDescriptor resolved in the loaded library.

func HasGetFilterNdDescriptor

func HasGetFilterNdDescriptor() bool

HasGetFilterNdDescriptor reports whether cudnnGetFilterNdDescriptor resolved in the loaded library.

func HasGetFilterSizeInBytes

func HasGetFilterSizeInBytes() bool

HasGetFilterSizeInBytes reports whether cudnnGetFilterSizeInBytes resolved in the loaded library.

func HasGetFoldedConvBackwardDataDescriptors

func HasGetFoldedConvBackwardDataDescriptors() bool

HasGetFoldedConvBackwardDataDescriptors reports whether cudnnGetFoldedConvBackwardDataDescriptors resolved in the loaded library.

func HasGetFusedOpsConstParamPackAttribute

func HasGetFusedOpsConstParamPackAttribute() bool

HasGetFusedOpsConstParamPackAttribute reports whether cudnnGetFusedOpsConstParamPackAttribute resolved in the loaded library.

func HasGetFusedOpsVariantParamPackAttribute

func HasGetFusedOpsVariantParamPackAttribute() bool

HasGetFusedOpsVariantParamPackAttribute reports whether cudnnGetFusedOpsVariantParamPackAttribute resolved in the loaded library.

func HasGetLRNDescriptor

func HasGetLRNDescriptor() bool

HasGetLRNDescriptor reports whether cudnnGetLRNDescriptor resolved in the loaded library.

func HasGetLastErrorString

func HasGetLastErrorString() bool

HasGetLastErrorString reports whether cudnnGetLastErrorString resolved in the loaded library.

func HasGetMaxDeviceVersion

func HasGetMaxDeviceVersion() bool

HasGetMaxDeviceVersion reports whether cudnnGetMaxDeviceVersion resolved in the loaded library.

func HasGetMultiHeadAttnBuffers

func HasGetMultiHeadAttnBuffers() bool

HasGetMultiHeadAttnBuffers reports whether cudnnGetMultiHeadAttnBuffers resolved in the loaded library.

func HasGetMultiHeadAttnWeights

func HasGetMultiHeadAttnWeights() bool

HasGetMultiHeadAttnWeights reports whether cudnnGetMultiHeadAttnWeights resolved in the loaded library.

func HasGetNormalizationBackwardWorkspaceSize

func HasGetNormalizationBackwardWorkspaceSize() bool

HasGetNormalizationBackwardWorkspaceSize reports whether cudnnGetNormalizationBackwardWorkspaceSize resolved in the loaded library.

func HasGetNormalizationForwardTrainingWorkspaceSize

func HasGetNormalizationForwardTrainingWorkspaceSize() bool

HasGetNormalizationForwardTrainingWorkspaceSize reports whether cudnnGetNormalizationForwardTrainingWorkspaceSize resolved in the loaded library.

func HasGetNormalizationTrainingReserveSpaceSize

func HasGetNormalizationTrainingReserveSpaceSize() bool

HasGetNormalizationTrainingReserveSpaceSize reports whether cudnnGetNormalizationTrainingReserveSpaceSize resolved in the loaded library.

func HasGetOpTensorDescriptor

func HasGetOpTensorDescriptor() bool

HasGetOpTensorDescriptor reports whether cudnnGetOpTensorDescriptor resolved in the loaded library.

func HasGetPooling2dDescriptor

func HasGetPooling2dDescriptor() bool

HasGetPooling2dDescriptor reports whether cudnnGetPooling2dDescriptor resolved in the loaded library.

func HasGetPooling2dForwardOutputDim

func HasGetPooling2dForwardOutputDim() bool

HasGetPooling2dForwardOutputDim reports whether cudnnGetPooling2dForwardOutputDim resolved in the loaded library.

func HasGetPoolingNdDescriptor

func HasGetPoolingNdDescriptor() bool

HasGetPoolingNdDescriptor reports whether cudnnGetPoolingNdDescriptor resolved in the loaded library.

func HasGetPoolingNdForwardOutputDim

func HasGetPoolingNdForwardOutputDim() bool

HasGetPoolingNdForwardOutputDim reports whether cudnnGetPoolingNdForwardOutputDim resolved in the loaded library.

func HasGetProperty

func HasGetProperty() bool

HasGetProperty reports whether cudnnGetProperty resolved in the loaded library.

func HasGetRNNDataDescriptor

func HasGetRNNDataDescriptor() bool

HasGetRNNDataDescriptor reports whether cudnnGetRNNDataDescriptor resolved in the loaded library.

func HasGetRNNDescriptor

func HasGetRNNDescriptor() bool

HasGetRNNDescriptor reports whether cudnnGetRNNDescriptor_v8 resolved in the loaded library.

func HasGetRNNTempSpaceSizes

func HasGetRNNTempSpaceSizes() bool

HasGetRNNTempSpaceSizes reports whether cudnnGetRNNTempSpaceSizes resolved in the loaded library.

func HasGetRNNWeightParams

func HasGetRNNWeightParams() bool

HasGetRNNWeightParams reports whether cudnnGetRNNWeightParams resolved in the loaded library.

func HasGetRNNWeightSpaceSize

func HasGetRNNWeightSpaceSize() bool

HasGetRNNWeightSpaceSize reports whether cudnnGetRNNWeightSpaceSize resolved in the loaded library.

func HasGetReduceTensorDescriptor

func HasGetReduceTensorDescriptor() bool

HasGetReduceTensorDescriptor reports whether cudnnGetReduceTensorDescriptor resolved in the loaded library.

func HasGetReductionIndicesSize

func HasGetReductionIndicesSize() bool

HasGetReductionIndicesSize reports whether cudnnGetReductionIndicesSize resolved in the loaded library.

func HasGetReductionWorkspaceSize

func HasGetReductionWorkspaceSize() bool

HasGetReductionWorkspaceSize reports whether cudnnGetReductionWorkspaceSize resolved in the loaded library.

func HasGetSeqDataDescriptor

func HasGetSeqDataDescriptor() bool

HasGetSeqDataDescriptor reports whether cudnnGetSeqDataDescriptor resolved in the loaded library.

func HasGetStream

func HasGetStream() bool

HasGetStream reports whether cudnnGetStream resolved in the loaded library.

func HasGetTensor4dDescriptor

func HasGetTensor4dDescriptor() bool

HasGetTensor4dDescriptor reports whether cudnnGetTensor4dDescriptor resolved in the loaded library.

func HasGetTensorNdDescriptor

func HasGetTensorNdDescriptor() bool

HasGetTensorNdDescriptor reports whether cudnnGetTensorNdDescriptor resolved in the loaded library.

func HasGetTensorSizeInBytes

func HasGetTensorSizeInBytes() bool

HasGetTensorSizeInBytes reports whether cudnnGetTensorSizeInBytes resolved in the loaded library.

func HasGetTensorTransformDescriptor

func HasGetTensorTransformDescriptor() bool

HasGetTensorTransformDescriptor reports whether cudnnGetTensorTransformDescriptor resolved in the loaded library.

func HasGetVersion

func HasGetVersion() bool

HasGetVersion reports whether cudnnGetVersion resolved in the loaded library.

func HasGraphVersionCheck

func HasGraphVersionCheck() bool

HasGraphVersionCheck reports whether cudnnGraphVersionCheck resolved in the loaded library.

func HasIm2Col

func HasIm2Col() bool

HasIm2Col reports whether cudnnIm2Col resolved in the loaded library.

func HasInitTransformDest

func HasInitTransformDest() bool

HasInitTransformDest reports whether cudnnInitTransformDest resolved in the loaded library.

func HasLRNCrossChannelBackward

func HasLRNCrossChannelBackward() bool

HasLRNCrossChannelBackward reports whether cudnnLRNCrossChannelBackward resolved in the loaded library.

func HasLRNCrossChannelForward

func HasLRNCrossChannelForward() bool

HasLRNCrossChannelForward reports whether cudnnLRNCrossChannelForward resolved in the loaded library.

func HasMakeFusedOpsPlan

func HasMakeFusedOpsPlan() bool

HasMakeFusedOpsPlan reports whether cudnnMakeFusedOpsPlan resolved in the loaded library.

func HasMultiHeadAttnBackwardData

func HasMultiHeadAttnBackwardData() bool

HasMultiHeadAttnBackwardData reports whether cudnnMultiHeadAttnBackwardData resolved in the loaded library.

func HasMultiHeadAttnBackwardWeights

func HasMultiHeadAttnBackwardWeights() bool

HasMultiHeadAttnBackwardWeights reports whether cudnnMultiHeadAttnBackwardWeights resolved in the loaded library.

func HasMultiHeadAttnForward

func HasMultiHeadAttnForward() bool

HasMultiHeadAttnForward reports whether cudnnMultiHeadAttnForward resolved in the loaded library.

func HasNormalizationBackward

func HasNormalizationBackward() bool

HasNormalizationBackward reports whether cudnnNormalizationBackward resolved in the loaded library.

func HasNormalizationForwardInference

func HasNormalizationForwardInference() bool

HasNormalizationForwardInference reports whether cudnnNormalizationForwardInference resolved in the loaded library.

func HasNormalizationForwardTraining

func HasNormalizationForwardTraining() bool

HasNormalizationForwardTraining reports whether cudnnNormalizationForwardTraining resolved in the loaded library.

func HasOpTensor

func HasOpTensor() bool

HasOpTensor reports whether cudnnOpTensor resolved in the loaded library.

func HasOpsVersionCheck

func HasOpsVersionCheck() bool

HasOpsVersionCheck reports whether cudnnOpsVersionCheck resolved in the loaded library.

func HasPoolingBackward

func HasPoolingBackward() bool

HasPoolingBackward reports whether cudnnPoolingBackward resolved in the loaded library.

func HasPoolingForward

func HasPoolingForward() bool

HasPoolingForward reports whether cudnnPoolingForward resolved in the loaded library.

func HasQueryRuntimeError

func HasQueryRuntimeError() bool

HasQueryRuntimeError reports whether cudnnQueryRuntimeError resolved in the loaded library.

func HasRNNBackwardData

func HasRNNBackwardData() bool

HasRNNBackwardData reports whether cudnnRNNBackwardData_v8 resolved in the loaded library.

func HasRNNBackwardWeights

func HasRNNBackwardWeights() bool

HasRNNBackwardWeights reports whether cudnnRNNBackwardWeights_v8 resolved in the loaded library.

func HasRNNForward

func HasRNNForward() bool

HasRNNForward reports whether cudnnRNNForward resolved in the loaded library.

func HasRNNGetClip

func HasRNNGetClip() bool

HasRNNGetClip reports whether cudnnRNNGetClip_v9 resolved in the loaded library.

func HasRNNSetClip

func HasRNNSetClip() bool

HasRNNSetClip reports whether cudnnRNNSetClip_v9 resolved in the loaded library.

func HasReduceTensor

func HasReduceTensor() bool

HasReduceTensor reports whether cudnnReduceTensor resolved in the loaded library.

func HasReorderFilterAndBias

func HasReorderFilterAndBias() bool

HasReorderFilterAndBias reports whether cudnnReorderFilterAndBias resolved in the loaded library.

func HasRestoreDropoutDescriptor

func HasRestoreDropoutDescriptor() bool

HasRestoreDropoutDescriptor reports whether cudnnRestoreDropoutDescriptor resolved in the loaded library.

func HasScaleTensor

func HasScaleTensor() bool

HasScaleTensor reports whether cudnnScaleTensor resolved in the loaded library.

func HasSetActivationDescriptor

func HasSetActivationDescriptor() bool

HasSetActivationDescriptor reports whether cudnnSetActivationDescriptor resolved in the loaded library.

func HasSetActivationDescriptorSwishBeta

func HasSetActivationDescriptorSwishBeta() bool

HasSetActivationDescriptorSwishBeta reports whether cudnnSetActivationDescriptorSwishBeta resolved in the loaded library.

func HasSetAttnDescriptor

func HasSetAttnDescriptor() bool

HasSetAttnDescriptor reports whether cudnnSetAttnDescriptor resolved in the loaded library.

func HasSetCTCLossDescriptor

func HasSetCTCLossDescriptor() bool

HasSetCTCLossDescriptor reports whether cudnnSetCTCLossDescriptor_v9 resolved in the loaded library.

func HasSetCTCLossDescriptorEx

func HasSetCTCLossDescriptorEx() bool

HasSetCTCLossDescriptorEx reports whether cudnnSetCTCLossDescriptorEx resolved in the loaded library.

func HasSetCallback

func HasSetCallback() bool

HasSetCallback reports whether cudnnSetCallback resolved in the loaded library.

func HasSetConvolution2dDescriptor

func HasSetConvolution2dDescriptor() bool

HasSetConvolution2dDescriptor reports whether cudnnSetConvolution2dDescriptor resolved in the loaded library.

func HasSetConvolutionGroupCount

func HasSetConvolutionGroupCount() bool

HasSetConvolutionGroupCount reports whether cudnnSetConvolutionGroupCount resolved in the loaded library.

func HasSetConvolutionMathType

func HasSetConvolutionMathType() bool

HasSetConvolutionMathType reports whether cudnnSetConvolutionMathType resolved in the loaded library.

func HasSetConvolutionNdDescriptor

func HasSetConvolutionNdDescriptor() bool

HasSetConvolutionNdDescriptor reports whether cudnnSetConvolutionNdDescriptor resolved in the loaded library.

func HasSetConvolutionReorderType

func HasSetConvolutionReorderType() bool

HasSetConvolutionReorderType reports whether cudnnSetConvolutionReorderType resolved in the loaded library.

func HasSetDropoutDescriptor

func HasSetDropoutDescriptor() bool

HasSetDropoutDescriptor reports whether cudnnSetDropoutDescriptor resolved in the loaded library.

func HasSetFilter4dDescriptor

func HasSetFilter4dDescriptor() bool

HasSetFilter4dDescriptor reports whether cudnnSetFilter4dDescriptor resolved in the loaded library.

func HasSetFilterNdDescriptor

func HasSetFilterNdDescriptor() bool

HasSetFilterNdDescriptor reports whether cudnnSetFilterNdDescriptor resolved in the loaded library.

func HasSetFusedOpsConstParamPackAttribute

func HasSetFusedOpsConstParamPackAttribute() bool

HasSetFusedOpsConstParamPackAttribute reports whether cudnnSetFusedOpsConstParamPackAttribute resolved in the loaded library.

func HasSetFusedOpsVariantParamPackAttribute

func HasSetFusedOpsVariantParamPackAttribute() bool

HasSetFusedOpsVariantParamPackAttribute reports whether cudnnSetFusedOpsVariantParamPackAttribute resolved in the loaded library.

func HasSetLRNDescriptor

func HasSetLRNDescriptor() bool

HasSetLRNDescriptor reports whether cudnnSetLRNDescriptor resolved in the loaded library.

func HasSetOpTensorDescriptor

func HasSetOpTensorDescriptor() bool

HasSetOpTensorDescriptor reports whether cudnnSetOpTensorDescriptor resolved in the loaded library.

func HasSetPooling2dDescriptor

func HasSetPooling2dDescriptor() bool

HasSetPooling2dDescriptor reports whether cudnnSetPooling2dDescriptor resolved in the loaded library.

func HasSetPoolingNdDescriptor

func HasSetPoolingNdDescriptor() bool

HasSetPoolingNdDescriptor reports whether cudnnSetPoolingNdDescriptor resolved in the loaded library.

func HasSetRNNDataDescriptor

func HasSetRNNDataDescriptor() bool

HasSetRNNDataDescriptor reports whether cudnnSetRNNDataDescriptor resolved in the loaded library.

func HasSetRNNDescriptor

func HasSetRNNDescriptor() bool

HasSetRNNDescriptor reports whether cudnnSetRNNDescriptor_v8 resolved in the loaded library.

func HasSetReduceTensorDescriptor

func HasSetReduceTensorDescriptor() bool

HasSetReduceTensorDescriptor reports whether cudnnSetReduceTensorDescriptor resolved in the loaded library.

func HasSetSeqDataDescriptor

func HasSetSeqDataDescriptor() bool

HasSetSeqDataDescriptor reports whether cudnnSetSeqDataDescriptor resolved in the loaded library.

func HasSetSpatialTransformerNdDescriptor

func HasSetSpatialTransformerNdDescriptor() bool

HasSetSpatialTransformerNdDescriptor reports whether cudnnSetSpatialTransformerNdDescriptor resolved in the loaded library.

func HasSetStream

func HasSetStream() bool

HasSetStream reports whether cudnnSetStream resolved in the loaded library.

func HasSetTensor

func HasSetTensor() bool

HasSetTensor reports whether cudnnSetTensor resolved in the loaded library.

func HasSetTensor4dDescriptor

func HasSetTensor4dDescriptor() bool

HasSetTensor4dDescriptor reports whether cudnnSetTensor4dDescriptor resolved in the loaded library.

func HasSetTensor4dDescriptorEx

func HasSetTensor4dDescriptorEx() bool

HasSetTensor4dDescriptorEx reports whether cudnnSetTensor4dDescriptorEx resolved in the loaded library.

func HasSetTensorNdDescriptor

func HasSetTensorNdDescriptor() bool

HasSetTensorNdDescriptor reports whether cudnnSetTensorNdDescriptor resolved in the loaded library.

func HasSetTensorNdDescriptorEx

func HasSetTensorNdDescriptorEx() bool

HasSetTensorNdDescriptorEx reports whether cudnnSetTensorNdDescriptorEx resolved in the loaded library.

func HasSetTensorTransformDescriptor

func HasSetTensorTransformDescriptor() bool

HasSetTensorTransformDescriptor reports whether cudnnSetTensorTransformDescriptor resolved in the loaded library.

func HasSoftmaxBackward

func HasSoftmaxBackward() bool

HasSoftmaxBackward reports whether cudnnSoftmaxBackward resolved in the loaded library.

func HasSoftmaxForward

func HasSoftmaxForward() bool

HasSoftmaxForward reports whether cudnnSoftmaxForward resolved in the loaded library.

func HasSpatialTfGridGeneratorBackward

func HasSpatialTfGridGeneratorBackward() bool

HasSpatialTfGridGeneratorBackward reports whether cudnnSpatialTfGridGeneratorBackward resolved in the loaded library.

func HasSpatialTfGridGeneratorForward

func HasSpatialTfGridGeneratorForward() bool

HasSpatialTfGridGeneratorForward reports whether cudnnSpatialTfGridGeneratorForward resolved in the loaded library.

func HasSpatialTfSamplerBackward

func HasSpatialTfSamplerBackward() bool

HasSpatialTfSamplerBackward reports whether cudnnSpatialTfSamplerBackward resolved in the loaded library.

func HasSpatialTfSamplerForward

func HasSpatialTfSamplerForward() bool

HasSpatialTfSamplerForward reports whether cudnnSpatialTfSamplerForward resolved in the loaded library.

func HasTransformFilter

func HasTransformFilter() bool

HasTransformFilter reports whether cudnnTransformFilter resolved in the loaded library.

func HasTransformTensor

func HasTransformTensor() bool

HasTransformTensor reports whether cudnnTransformTensor resolved in the loaded library.

func HasTransformTensorEx

func HasTransformTensorEx() bool

HasTransformTensorEx reports whether cudnnTransformTensorEx resolved in the loaded library.

func Load

func Load(path string) error

Load opens the shared library from path, or from the default search list when path is empty, and binds all symbols. Callers that need to direct loading should call Load before any other function; otherwise the first call loads from the default search list.

Load is idempotent: calling it again with the same path, or with an empty path, returns nil. Calling it with a different path after a successful load returns *LibraryConflictError rather than replacing the library. After a failed load, Load retries.

func Loaded

func Loaded() bool

Loaded reports whether the library is currently loaded. It does not trigger a load.

func OpsVersionCheck

func OpsVersionCheck() error

OpsVersionCheck checks that the version of cuDNN's ops sub-library matches those of the sub-libraries it depends on.

Cross-library version checker.

Each sublibrary has a version checker that checks whether its own version matches that of its dependencies.

A nil error means the version check passed.

Errors:

Wraps cudnnOpsVersionCheck.

func Path

func Path() string

Path returns the path or name the loaded library was opened from, or the empty string if no library is loaded.

func SetCallback

func SetCallback(mask uint32, udata uintptr, fptr uintptr) error

SetCallback sets the internal states of cuDNN error reporting functionality.

  • mask: Input. An unsigned integer. The four least significant bits (LSBs) of this unsigned integer are used for switching on and off the different levels of error reporting messages. This applies for both the default callbacks, and for the customized callbacks. The bit position is in correspondence with the enum of Severity. The user may utilize the predefined macros CUDNN_SEV_ERROR_EN, CUDNN_SEV_WARNING_EN, and CUDNN_SEV_INFO_EN to form the bit mask. When a bit is set to 1, the corresponding message channel is enabled. For example, when bit 3 is set to 1, the API logging is enabled. Currently, only the log output of level SevInfo is functional; the others are not yet implemented. When used for turning on and off the logging with the default callback, the user may pass NULL to udata and fptr. In addition, the environment variable CUDNN_LOGDEST_DBG must be set. For more information, refer to the Deprecation Policy. CUDNN_SEV_INFO_EN = 0b1000 (functional). CUDNN_SEV_ERROR_EN = 0b0010 (functional). CUDNN_SEV_WARNING_EN = 0b0100 (functional). The output of SevFatal is always enabled and cannot be disabled
  • udata: Input. A pointer provided by the user. This pointer will be passed to the user’s custom logging callback function. The data it points to will not be read, nor be changed by cuDNN. This pointer may be used in many ways, such as in a mutex or in a communication socket for the user’s callback function for logging. If the user is utilizing the default callback function, or doesn’t want to use this input in the customized callback function, they may pass in NULL
  • fptr: Input. A pointer to a user-supplied callback function. When NULL is passed to this pointer, then cuDNN switches back to the built-in default callback function. The user-supplied callback function prototype must be similar to the following (also defined in the header file): The structure Debug is defined in the header file. It provides the metadata, such as time, time since start, stream ID, process and thread ID, that the user may choose to print or store in their customized callback. The variable msg is the logging message generated by cuDNN. Each line of this message is terminated by 0, and the end of the message is terminated by 00. Users may select what is necessary to show in the log, and may reformat the string

A nil error means the function launched successfully.

Wraps cudnnSetCallback.

Types

type ActivationDescriptor deprecated

type ActivationDescriptor uintptr

ActivationDescriptor is a pointer to an opaque structure holding the description of an activation operation.

CreateActivationDescriptor is used to create one instance, and ActivationDescriptor.Set must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateActivationDescriptor deprecated

func CreateActivationDescriptor() (ActivationDescriptor, error)

CreateActivationDescriptor creates an activation descriptor object by allocating the memory needed to hold its opaque structure.

For more information, refer to ActivationDescriptor.

Errors:

Wraps cudnnCreateActivationDescriptor.

Deprecated: Deprecated by NVIDIA.

func (*ActivationDescriptor) Close deprecated

func (a *ActivationDescriptor) Close() error

Close destroys a previously created activation descriptor object.

If a is zero, Close returns nil. Otherwise Close sets a to zero when the call succeeds and leaves it unchanged when it fails. Only a is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyActivationDescriptor.

Deprecated: Deprecated by NVIDIA.

func (ActivationDescriptor) Destroy deprecated

func (a ActivationDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use ActivationDescriptor.Close instead.

func (ActivationDescriptor) Get deprecated

Get queries a previously initialized generic activation descriptor object.

Wraps cudnnGetActivationDescriptor.

Deprecated: Deprecated by NVIDIA.

func (ActivationDescriptor) Set deprecated

func (a ActivationDescriptor) Set(mode ActivationMode, reluNanOpt NanPropagation, coef float64) error

Set initializes a previously created generic activation descriptor object.

  • mode: Input. Enumerant to specify the activation mode
  • reluNanOpt: Input. Enumerant to specify the Nan propagation mode
  • coef: Input. Floating point number. When the activation mode (refer to ActivationMode) is set to ActivationClippedRelu, this input specifies the clipping threshold; and when the activation mode is set to ActivationRelu, this input specifies the upper bound

Errors:

  • ErrBadParam: mode or reluNanOpt has an invalid enumerant value.

Wraps cudnnSetActivationDescriptor.

Deprecated: Deprecated by NVIDIA.

func (ActivationDescriptor) SetSwishBeta deprecated

func (a ActivationDescriptor) SetSwishBeta(swishBeta float64) error

SetSwishBeta sets the beta parameter of the SWISH activation function to swishBeta.

  • swishBeta: Input. The value to set the SWISH activations’ beta parameter to

A nil error means the value was set successfully.

Errors:

  • ErrBadParam: The activation descriptor is a NULL pointer.

Wraps cudnnSetActivationDescriptorSwishBeta.

Deprecated: Deprecated by NVIDIA.

func (ActivationDescriptor) SwishBeta deprecated

func (a ActivationDescriptor) SwishBeta() (float64, error)

SwishBeta queries the current beta parameter set for SWISH activation.

A nil error means the beta parameter was queried successfully.

Errors:

  • ErrBadParam: At least one of activationDesc or swish_beta were NULL.

Wraps cudnnGetActivationDescriptorSwishBeta.

Deprecated: Deprecated by NVIDIA.

type ActivationMode deprecated

type ActivationMode int32

ActivationMode is an enumerated type used to select the neuron activation function used in Handle.ActivationForward, Handle.ActivationBackward, and Handle.ConvolutionBiasActivationForward.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	ActivationSigmoid     ActivationMode = 0 // Selects the sigmoid function.
	ActivationRelu        ActivationMode = 1 // Selects the rectified linear function.
	ActivationTanh        ActivationMode = 2 // Selects the hyperbolic tangent function.
	ActivationClippedRelu ActivationMode = 3 // Selects the clipped rectified linear function.
	ActivationElu         ActivationMode = 4 // Selects the exponential linear function.
	ActivationIdentity    ActivationMode = 5 // Selects the identity function, intended for bypassing the activation step in [Handle.ConvolutionBiasActivationForward]. (The [Handle.ConvolutionBiasActivationForward] function must use [ConvolutionFwdAlgoImplicitPrecompGemm].) Does not work with [Handle.ActivationForward] or [Handle.ActivationBackward].
	ActivationSwish       ActivationMode = 6 // Selects the swish function.
)

func (ActivationMode) String

func (e ActivationMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type AttnConfig

type AttnConfig struct {
	// Pointer to the storage for binary attention flags.
	AttnMode uint32
	// Pointer to the storage for the number of attention heads.
	NHeads int32
	// Pointer to the storage for the softmax smoothing/sharpening coefficient.
	SmScaler float64
	// Data type for attention weights, sequence data inputs, and outputs.
	DataType DataType
	// Pointer to the storage for the compute precision.
	ComputePrec DataType
	// NVIDIA Tensor Core settings.
	MathType MathType
	// Descriptor of the dropout operation applied to the softmax output.
	AttnDropoutDesc DropoutDescriptor
	// Descriptor of the dropout operation applied to the multihead attention output.
	PostDropoutDesc DropoutDescriptor
	// Q, K, and V embedding vector lengths.
	QSize int32
	// Q, K, and V embedding vector lengths.
	KSize int32
	// Q, K, and V embedding vector lengths.
	VSize int32
	// Q, K, and V embedding vector lengths after input projections.
	QProjSize int32
	// Q, K, and V embedding vector lengths after input projections.
	KProjSize int32
	// Q, K, and V embedding vector lengths after input projections.
	VProjSize int32
	// Pointer to store the output vector length after projection.
	OProjSize int32
	// Largest sequence length expected in sequence data descriptors related to Q, O, dQ, dO inputs and outputs.
	QoMaxSeqLength int32
	// Largest sequence length expected in sequence data descriptors related to K, V, dK, dV inputs and outputs.
	KvMaxSeqLength int32
	// Largest batch size expected in the [SeqDataDescriptor] container.
	MaxBatchSize int32
	// Largest beam size expected in the [SeqDataDescriptor] container.
	MaxBeamSize int32
}

AttnConfig holds the settings AttnDescriptor.Get reports.

type AttnDescriptor deprecated

type AttnDescriptor uintptr

AttnDescriptor is a pointer to an opaque structure holding parameters of the multihead attention layer, such as: Use the CreateAttnDescriptor function to create an instance of the attention descriptor object and AttnDescriptor.Close to delete the previously created descriptor. Use the AttnDescriptor.Set function to configure the descriptor.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateAttnDescriptor deprecated

func CreateAttnDescriptor() (AttnDescriptor, error)

CreateAttnDescriptor creates one instance of an opaque attention descriptor object by allocating the host memory for it and initializing all descriptor fields.

This function creates one instance of an opaque attention descriptor object by allocating the host memory for it and initializing all descriptor fields. The function writes NULL to attnDesc when the attention descriptor object cannot be allocated. Use the AttnDescriptor.Set function to configure the attention descriptor and AttnDescriptor.Close to destroy it and release the allocated memory.

A nil error means the descriptor object was created successfully.

Errors:

Wraps cudnnCreateAttnDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (*AttnDescriptor) Close deprecated

func (a *AttnDescriptor) Close() error

Close destroys the attention descriptor object and releases its memory.

This function destroys the attention descriptor object and releases its memory. The attnDesc argument can be NULL. Invoking AttnDescriptor.Close with a NULL argument is a no operation (NOP). The AttnDescriptor.Close function is not able to detect if the attnDesc argument holds a valid address. Undefined behavior will occur in case of passing an invalid pointer, not returned by the CreateAttnDescriptor function, or in the double deletion scenario of a valid address.

If a is zero, Close returns nil. Otherwise Close sets a to zero when the call succeeds and leaves it unchanged when it fails. Only a is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyAttnDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (AttnDescriptor) Destroy deprecated

func (a AttnDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use AttnDescriptor.Close instead.

func (AttnDescriptor) Get deprecated

func (a AttnDescriptor) Get() (AttnConfig, error)

Get retrieves settings from the previously created attention descriptor.

This function retrieves settings from the previously created attention descriptor. The user can assign NULL to any pointer except attnDesc when the retrieved value is not needed.

A nil error means requested attention descriptor fields were retrieved successfully.

Errors:

Wraps cudnnGetAttnDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (AttnDescriptor) Set deprecated

func (a AttnDescriptor) Set(attnMode uint32, nHeads int32, smScaler float64, dataType DataType, computePrec DataType, mathType MathType, attnDropoutDesc DropoutDescriptor, postDropoutDesc DropoutDescriptor, qSize int32, kSize int32, vSize int32, qProjSize int32, kProjSize int32, vProjSize int32, oProjSize int32, qoMaxSeqLength int32, kvMaxSeqLength int32, maxBatchSize int32, maxBeamSize int32) error

Set configures a multihead attention descriptor that was previously created using the CreateAttnDescriptor function.

This function configures a multihead attention descriptor that was previously created using the CreateAttnDescriptor function. The function sets attention parameters that are necessary to compute internal buffer sizes, dimensions of weight and bias tensors, or to select optimized code paths. Input sequence data descriptors in Handle.MultiHeadAttnForward, Handle.MultiHeadAttnBackwardData, and Handle.MultiHeadAttnBackwardWeights functions are checked against the configuration parameters stored in the attention descriptor. Some parameters must match exactly while max arguments such as maxBatchSize or qoMaxSeqLength establish upper limits for the corresponding dimensions. The multihead attention model can be described by the following equations: hᵢ=(W_(V,i)V)softmax(smScaler(KᵀW_(K,i)ᵀ)(W_(Q,i)q)),fori=0⋯nHeads−1 MultiHeadAttn(q,K,V,W_(Q),W_(K),W_(V),W_(O))=∑_(i=0)^(nHeads−1)W_(O,i)hᵢ Where: The lengths of query, key, and value vectors are defined by the qSize, kSize, and vSize arguments respectively. For simplicity, the above equations are presented using a single embedding vector q but the cuDNN API can handle multiple q candidates in the beam search scheme, process q vectors from multiple sequences bundled into a batch, or automatically iterate through all embedding vectors (time-steps) of a sequence. Thus, in general, q, K, V inputs are tensors with additional pieces of information such as the active length of each sequence or how unused padding vectors should be saved. In some publications, W O,i matrices are combined into one output projection matrix and h i vectors are merged explicitly into a single vector. This is an equivalent notation. In the cuDNN library, W O,i matrices are conceptually treated the same way as W Q,i, W K,i, or W V,i input projection weights. Refer to the description of the Handle.MultiHeadAttnWeights function for more details. Weight matrices W Q,i, W K,i, W V,i, and W O,i play similar roles, adjusting vector lengths in q, K, V inputs and in the multihead attention final output. The user can disable any or all projections by setting qProjSize, kProjSize, vProjSize, or oProjSize arguments to zero. Embedding vector sizes in q, K, V and the vector lengths after projections need to be selected in such a way that matrix multiplications described above are feasible. Otherwise, ErrBadParam is returned by the AttnDescriptor.Set function. All four weight matrices are used when it is desirable to maintain rank deficiency W_(KQ,i)=W_(K,i)ᵀW_(Q,i) or W_(OV,i)=W_(O,i)W_(V,i) of matrices to eliminate one or more dimensions during linear transformations in each head. This is a form of feature extraction. In such cases, the projected sizes are smaller than the original vector lengths. For each attention head, weight matrix sizes are defined as follows: When the output projection is disabled ( oProjSize=0), the output vector length is nHeads * (vProjSize > 0 ? vProjSize : vSize), meaning, the output is a concatenation of all h i vectors. In the alternative interpretation, a concatenated matrix W O = [ W O,0, W O,1, W O,2, …] forms the identity matrix. Softmax is a normalized, exponential vector function that takes and outputs vectors of the same size. The multihead attention API utilizes softmax of the SoftmaxAccurate type to reduce the likelihood of the floating-point overflow. The smScaler parameter is the softmax sharpening/smoothing coefficient. When smScaler=1.0, softmax uses the natural exponential function exp(x) or 2.7183*. When smScaler<1.0, for example smScaler=0.2, the function used by the softmax block will not grow as fast because exp(0.2*x) ≈ 1.2214 x. The smScaler parameter can be adjusted to process larger ranges of values fed to softmax. When the range is too large (or smScaler is not sufficiently small for the given range), the output vector of the softmax block becomes categorical, meaning, one vector element is close to 1.0 and other outputs are zero or very close to zero. When this occurs, the Jacobian matrix of the softmax block is also close to zero so deltas are not back-propagated during training from output to input except through residual connections, if these connections are enabled. The user can set smScaler to any positive floating-point value or even zero. The smScaler parameter is not trainable. The qoMaxSeqLength, kvMaxSeqLength, maxBatchSize, and maxBeamSize arguments declare the maximum sequence lengths, maximum batch size, and maximum beam size respectively, in the SeqDataDescriptor containers. The actual dimensions supplied to forward and backward (gradient) API functions should not exceed the max limits. The max arguments should be set carefully because too large values will result in excessive memory usage due to oversized work and reserve space buffers. The attnMode argument is treated as a binary mask where various on/off options are set. These options can affect the internal buffer sizes, enforce certain argument checks, select optimized code execution paths, or enable attention variants that do not require additional numerical arguments. An example of such options is the inclusion of biases in input and output projections. The attnDropoutDesc and postDropoutDesc arguments are descriptors that define two dropout layers active in the training mode. The first dropout operation defined by attnDropoutDesc, is applied directly to the softmax output. The second dropout operation, specified by postDropoutDesc, alters the multihead attention output, just before the point where residual connections are added. Supported “attnMode“ Flags CUDNN_ATTN_QUERYMAP_ALL_TO_ONE Forward declaration of mapping between Q and K, V vectors when the beam size is greater than one in the Q input. Multiple Q vectors from the same beam bundle map to the same K, V vectors. This means that beam sizes in the K, V sets are equal to one. CUDNN_ATTN_QUERYMAP_ONE_TO_ONE Forward declaration of mapping between Q and K, V vectors when the beam size is greater than one in the Q input. Multiple Q vectors from the same beam bundle map to different K, V vectors. This requires beam sizes in K, V sets to be the same as in the Q input. CUDNN_ATTN_DISABLE_PROJ_BIASES Use no biases in the attention input and output projections. CUDNN_ATTN_ENABLE_PROJ_BIASES Use extra biases in the attention input and output projections. In this case the projected K¯ vectors are computed as K¯ᵢ=W_(K,i)K+b*[1,1,⋯,1]₁ₓₙ, where n is the number of columns in the K matrix. In other words, the same column vector b is added to all columns of K after the weight matrix multiplication.

Unsupported Features

  • The paddingFill argument in SeqDataDescriptor is currently ignored by all multihead attention functions.

Parameters:

  • attnMode: Input. Enables various attention options that do not require additional numerical values. Refer to the table below for the list of supported flags. The user should assign a preferred set of bitwise OR-ed flags to this argument
  • nHeads: Input. Number of attention heads
  • smScaler: Input. Softmax smoothing ( 1.0 >= smScaler >= 0.0) or sharpening ( smScaler > 1.0) coefficient. Negative values are not accepted
  • dataType: Input. Data type used to represent attention inputs, attention weights and attention outputs
  • computePrec: Input. Compute precision
  • mathType: Input. NVIDIA Tensor Core settings
  • attnDropoutDesc: Input. Descriptor of the dropout operation applied to the softmax output. Refer to the table below for a list of unsupported features
  • postDropoutDesc: Input. Descriptor of the dropout operation applied to the multihead attention output, just before the point where residual connections are added. Refer to the table below for a list of unsupported features
  • qSize: Input. Q, K, V embedding vector lengths
  • kSize: Input. Q, K, V embedding vector lengths
  • vSize: Input. Q, K, V embedding vector lengths
  • qProjSize: Input. Q, K, V embedding vector lengths after input projections. Use zero to disable the corresponding projection
  • kProjSize: Input. Q, K, V embedding vector lengths after input projections. Use zero to disable the corresponding projection
  • vProjSize: Input. Q, K, V embedding vector lengths after input projections. Use zero to disable the corresponding projection
  • oProjSize: Input. The h i vector length after the output projection. Use zero to disable this projection
  • qoMaxSeqLength: Input. Largest sequence length expected in sequence data descriptors related to Q, O, dQ, and dO inputs and outputs
  • kvMaxSeqLength: Input. Largest sequence length expected in sequence data descriptors related to K, V, dK, and dV inputs and outputs
  • maxBatchSize: Input. Largest batch size expected in any SeqDataDescriptor container
  • maxBeamSize: Input. Largest beam size expected in any SeqDataDescriptor container

A nil error means the attention descriptor was configured successfully.

Errors:

  • ErrBadParam: An invalid input argument was encountered. Some examples include: post projection Q and K sizes were not equal dataType, computePrec, or mathType were invalid one or more of the following arguments were either negative or zero: nHeads, qSize, kSize, vSize, qoMaxSeqLength, kvMaxSeqLength, maxBatchSize, maxBeamSize one or more of the following arguments were negative: qProjSize, kProjSize, vProjSize, smScaler
  • ErrNotSupported: A requested option or a combination of input arguments is not supported.

Wraps cudnnSetAttnDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

type BackendAttributeName

type BackendAttributeName int32

BackendAttributeName is an enumerated type that indicates the backend descriptor attributes that can be set or get using BackendDescriptor.SetAttribute and BackendDescriptor.Attribute functions. The backend descriptor to which an attribute belongs is identified by the prefix of the attribute name.

const (
	AttrPointwiseMode     BackendAttributeName = 0
	AttrPointwiseMathPrec BackendAttributeName = 1
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrPointwiseNanPropagation     BackendAttributeName = 2
	AttrPointwiseReluLowerClip      BackendAttributeName = 3
	AttrPointwiseReluUpperClip      BackendAttributeName = 4
	AttrPointwiseReluLowerClipSlope BackendAttributeName = 5
	AttrPointwiseEluAlpha           BackendAttributeName = 6
	AttrPointwiseSoftplusBeta       BackendAttributeName = 7
	AttrPointwiseSwishBeta          BackendAttributeName = 8
	AttrPointwiseAxis               BackendAttributeName = 9
	AttrConvolutionCompType         BackendAttributeName = 100
	AttrConvolutionConvMode         BackendAttributeName = 101
	AttrConvolutionDilations        BackendAttributeName = 102
	AttrConvolutionFilterStrides    BackendAttributeName = 103
	AttrConvolutionPostPaddings     BackendAttributeName = 104
	AttrConvolutionPrePaddings      BackendAttributeName = 105
	AttrConvolutionSpatialDims      BackendAttributeName = 106
	AttrEngineheurMode              BackendAttributeName = 200
	AttrEngineheurOperationGraph    BackendAttributeName = 201
	AttrEngineheurResults           BackendAttributeName = 202
	AttrEngineheurSmCountTarget     BackendAttributeName = 203
	AttrEngineheurDeviceprop        BackendAttributeName = 204
	AttrEnginecfgEngine             BackendAttributeName = 300
	AttrEnginecfgIntermediateInfo   BackendAttributeName = 301
	AttrEnginecfgKnobChoices        BackendAttributeName = 302
	AttrEnginecfgWorkspaceSize      BackendAttributeName = 303
	AttrEnginecfgSharedMemoryUsed   BackendAttributeName = 304
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrExecutionPlanHandle                       BackendAttributeName = 400
	AttrExecutionPlanEngineConfig                 BackendAttributeName = 401
	AttrExecutionPlanWorkspaceSize                BackendAttributeName = 402
	AttrExecutionPlanComputedIntermediateUids     BackendAttributeName = 403
	AttrExecutionPlanRunOnlyIntermediateUids      BackendAttributeName = 404
	AttrExecutionPlanJsonRepresentation           BackendAttributeName = 405
	AttrExecutionPlanKernelCache                  BackendAttributeName = 406
	AttrExecutionPlanDeviceprop                   BackendAttributeName = 407
	AttrIntermediateInfoUniqueId                  BackendAttributeName = 500
	AttrIntermediateInfoSize                      BackendAttributeName = 501
	AttrIntermediateInfoDependentDataUids         BackendAttributeName = 502
	AttrIntermediateInfoDependentAttributes       BackendAttributeName = 503
	AttrKnobChoiceKnobType                        BackendAttributeName = 600
	AttrKnobChoiceKnobValue                       BackendAttributeName = 601
	AttrOperationConvolutionForwardAlpha          BackendAttributeName = 700
	AttrOperationConvolutionForwardBeta           BackendAttributeName = 701
	AttrOperationConvolutionForwardConvDesc       BackendAttributeName = 702
	AttrOperationConvolutionForwardW              BackendAttributeName = 703
	AttrOperationConvolutionForwardX              BackendAttributeName = 704
	AttrOperationConvolutionForwardY              BackendAttributeName = 705
	AttrOperationConvolutionBwdDataAlpha          BackendAttributeName = 706
	AttrOperationConvolutionBwdDataBeta           BackendAttributeName = 707
	AttrOperationConvolutionBwdDataConvDesc       BackendAttributeName = 708
	AttrOperationConvolutionBwdDataW              BackendAttributeName = 709
	AttrOperationConvolutionBwdDataDx             BackendAttributeName = 710
	AttrOperationConvolutionBwdDataDy             BackendAttributeName = 711
	AttrOperationConvolutionBwdFilterAlpha        BackendAttributeName = 712
	AttrOperationConvolutionBwdFilterBeta         BackendAttributeName = 713
	AttrOperationConvolutionBwdFilterConvDesc     BackendAttributeName = 714
	AttrOperationConvolutionBwdFilterDw           BackendAttributeName = 715
	AttrOperationConvolutionBwdFilterX            BackendAttributeName = 716
	AttrOperationConvolutionBwdFilterDy           BackendAttributeName = 717
	AttrOperationPointwisePwDescriptor            BackendAttributeName = 750
	AttrOperationPointwiseXdesc                   BackendAttributeName = 751
	AttrOperationPointwiseBdesc                   BackendAttributeName = 752
	AttrOperationPointwiseYdesc                   BackendAttributeName = 753
	AttrOperationPointwiseAlpha1                  BackendAttributeName = 754
	AttrOperationPointwiseAlpha2                  BackendAttributeName = 755
	AttrOperationPointwiseDxdesc                  BackendAttributeName = 756
	AttrOperationPointwiseDydesc                  BackendAttributeName = 757
	AttrOperationPointwiseTdesc                   BackendAttributeName = 758
	AttrOperationGenstatsMode                     BackendAttributeName = 770
	AttrOperationGenstatsMathPrec                 BackendAttributeName = 771
	AttrOperationGenstatsXdesc                    BackendAttributeName = 772
	AttrOperationGenstatsSumdesc                  BackendAttributeName = 773
	AttrOperationGenstatsSqsumdesc                BackendAttributeName = 774
	AttrOperationBnFinalizeStatsMode              BackendAttributeName = 780
	AttrOperationBnFinalizeMathPrec               BackendAttributeName = 781
	AttrOperationBnFinalizeYSumDesc               BackendAttributeName = 782
	AttrOperationBnFinalizeYSqSumDesc             BackendAttributeName = 783
	AttrOperationBnFinalizeScaleDesc              BackendAttributeName = 784
	AttrOperationBnFinalizeBiasDesc               BackendAttributeName = 785
	AttrOperationBnFinalizePrevRunningMeanDesc    BackendAttributeName = 786
	AttrOperationBnFinalizePrevRunningVarDesc     BackendAttributeName = 787
	AttrOperationBnFinalizeUpdatedRunningMeanDesc BackendAttributeName = 788
	AttrOperationBnFinalizeUpdatedRunningVarDesc  BackendAttributeName = 789
	AttrOperationBnFinalizeSavedMeanDesc          BackendAttributeName = 790
	AttrOperationBnFinalizeSavedInvStdDesc        BackendAttributeName = 791
	AttrOperationBnFinalizeEqScaleDesc            BackendAttributeName = 792
	AttrOperationBnFinalizeEqBiasDesc             BackendAttributeName = 793
	AttrOperationBnFinalizeAccumCountDesc         BackendAttributeName = 794
	AttrOperationBnFinalizeEpsilonDesc            BackendAttributeName = 795
	AttrOperationBnFinalizeExpAverateFactorDesc   BackendAttributeName = 796
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationgraphHandle                BackendAttributeName = 800
	AttrOperationgraphOps                   BackendAttributeName = 801
	AttrOperationgraphEngineGlobalCount     BackendAttributeName = 802
	AttrOperationgraphIsDynamicShapeEnabled BackendAttributeName = 803
	AttrOperationgraphIsSameTopology        BackendAttributeName = 804
	AttrTensorByteAlignment                 BackendAttributeName = 900
	AttrTensorDataType                      BackendAttributeName = 901
	AttrTensorDimensions                    BackendAttributeName = 902
	AttrTensorStrides                       BackendAttributeName = 903
	AttrTensorVectorCount                   BackendAttributeName = 904
	AttrTensorVectorizedDimension           BackendAttributeName = 905
	AttrTensorUniqueId                      BackendAttributeName = 906
	AttrTensorIsVirtual                     BackendAttributeName = 907
	AttrTensorIsByValue                     BackendAttributeName = 908
	AttrTensorReorderingMode                BackendAttributeName = 909
	AttrTensorRaggedOffsetDesc              BackendAttributeName = 913
	AttrVariantPackUniqueIds                BackendAttributeName = 1000
	AttrVariantPackDataPointers             BackendAttributeName = 1001
	AttrVariantPackIntermediates            BackendAttributeName = 1002
	AttrVariantPackWorkspace                BackendAttributeName = 1003
	AttrVariantPackOverrideUniqueIds        BackendAttributeName = 1010
	AttrVariantPackOverrideShapes           BackendAttributeName = 1011
	AttrVariantPackOverrideStrides          BackendAttributeName = 1012
	AttrLayoutInfoTensorUid                 BackendAttributeName = 1100
	AttrLayoutInfoTypes                     BackendAttributeName = 1101
	AttrKnobInfoType                        BackendAttributeName = 1200
	AttrKnobInfoMaximumValue                BackendAttributeName = 1201
	AttrKnobInfoMinimumValue                BackendAttributeName = 1202
	AttrKnobInfoStride                      BackendAttributeName = 1203
	AttrEngineOperationGraph                BackendAttributeName = 1300
	AttrEngineGlobalIndex                   BackendAttributeName = 1301
	AttrEngineKnobInfo                      BackendAttributeName = 1302
	AttrEngineNumericalNote                 BackendAttributeName = 1303
	AttrEngineLayoutInfo                    BackendAttributeName = 1304
	AttrEngineBehaviorNote                  BackendAttributeName = 1305
	AttrEngineSmCountTarget                 BackendAttributeName = 1306
	AttrEngineDeviceprop                    BackendAttributeName = 1307
	AttrEngineDisableClusterCooperative     BackendAttributeName = 1308
	AttrMatmulCompType                      BackendAttributeName = 1500
	AttrMatmulPaddingValue                  BackendAttributeName = 1503
	AttrOperationMatmulAdesc                BackendAttributeName = 1520
	AttrOperationMatmulBdesc                BackendAttributeName = 1521
	AttrOperationMatmulCdesc                BackendAttributeName = 1522
	AttrOperationMatmulDesc                 BackendAttributeName = 1523
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationMatmulIrregularlyStridedBatchCount BackendAttributeName = 1524
	AttrOperationMatmulGemmMOverrideDesc            BackendAttributeName = 1525
	AttrOperationMatmulGemmNOverrideDesc            BackendAttributeName = 1526
	AttrOperationMatmulGemmKOverrideDesc            BackendAttributeName = 1527
	AttrReductionOperator                           BackendAttributeName = 1600
	AttrReductionCompType                           BackendAttributeName = 1601
	AttrReductionIsDeterministic                    BackendAttributeName = 1602
	AttrOperationReductionXdesc                     BackendAttributeName = 1610
	AttrOperationReductionYdesc                     BackendAttributeName = 1611
	AttrOperationReductionDesc                      BackendAttributeName = 1612
	AttrOperationBnBwdWeightsMathPrec               BackendAttributeName = 1620
	AttrOperationBnBwdWeightsMeanDesc               BackendAttributeName = 1621
	AttrOperationBnBwdWeightsInvstdDesc             BackendAttributeName = 1622
	AttrOperationBnBwdWeightsBnScaleDesc            BackendAttributeName = 1623
	AttrOperationBnBwdWeightsXDesc                  BackendAttributeName = 1624
	AttrOperationBnBwdWeightsDyDesc                 BackendAttributeName = 1625
	AttrOperationBnBwdWeightsDbnScaleDesc           BackendAttributeName = 1626
	AttrOperationBnBwdWeightsDbnBiasDesc            BackendAttributeName = 1627
	AttrOperationBnBwdWeightsEqDyScaleDesc          BackendAttributeName = 1628
	AttrOperationBnBwdWeightsEqXScaleDesc           BackendAttributeName = 1629
	AttrOperationBnBwdWeightsEqBias                 BackendAttributeName = 1630
	AttrResampleMode                                BackendAttributeName = 1700
	AttrResampleCompType                            BackendAttributeName = 1701
	AttrResampleSpatialDims                         BackendAttributeName = 1702
	AttrResamplePostPaddings                        BackendAttributeName = 1703
	AttrResamplePrePaddings                         BackendAttributeName = 1704
	AttrResampleStrides                             BackendAttributeName = 1705
	AttrResampleWindowDims                          BackendAttributeName = 1706
	AttrResampleNanPropagation                      BackendAttributeName = 1707
	AttrResamplePaddingMode                         BackendAttributeName = 1708
	AttrOperationResampleFwdXdesc                   BackendAttributeName = 1710
	AttrOperationResampleFwdYdesc                   BackendAttributeName = 1711
	AttrOperationResampleFwdIdxdesc                 BackendAttributeName = 1712
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationResampleFwdAlpha BackendAttributeName = 1713
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationResampleFwdBeta    BackendAttributeName = 1714
	AttrOperationResampleFwdDesc    BackendAttributeName = 1716
	AttrOperationResampleBwdDxdesc  BackendAttributeName = 1720
	AttrOperationResampleBwdDydesc  BackendAttributeName = 1721
	AttrOperationResampleBwdIdxdesc BackendAttributeName = 1722
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationResampleBwdAlpha BackendAttributeName = 1723
	//
	// Deprecated: Deprecated by NVIDIA.
	AttrOperationResampleBwdBeta                      BackendAttributeName = 1724
	AttrOperationResampleBwdDesc                      BackendAttributeName = 1725
	AttrOperationResampleBwdXdesc                     BackendAttributeName = 1726
	AttrOperationResampleBwdYdesc                     BackendAttributeName = 1727
	AttrOperationConcatAxis                           BackendAttributeName = 1800
	AttrOperationConcatInputDescs                     BackendAttributeName = 1801
	AttrOperationConcatInplaceIndex                   BackendAttributeName = 1802
	AttrOperationConcatOutputDesc                     BackendAttributeName = 1803
	AttrOperationSignalMode                           BackendAttributeName = 1900
	AttrOperationSignalFlagdesc                       BackendAttributeName = 1901
	AttrOperationSignalValue                          BackendAttributeName = 1902
	AttrOperationSignalXdesc                          BackendAttributeName = 1903
	AttrOperationSignalYdesc                          BackendAttributeName = 1904
	AttrOperationPagedCacheLoadContainerDesc          BackendAttributeName = 1950
	AttrOperationPagedCacheLoadYdesc                  BackendAttributeName = 1951
	AttrOperationPagedCacheLoadSequenceDesc           BackendAttributeName = 1952
	AttrOperationPagedCacheLoadPageTableDesc          BackendAttributeName = 1953
	AttrOperationNormFwdMode                          BackendAttributeName = 2000
	AttrOperationNormFwdPhase                         BackendAttributeName = 2001
	AttrOperationNormFwdXdesc                         BackendAttributeName = 2002
	AttrOperationNormFwdMeanDesc                      BackendAttributeName = 2003
	AttrOperationNormFwdInvVarianceDesc               BackendAttributeName = 2004
	AttrOperationNormFwdScaleDesc                     BackendAttributeName = 2005
	AttrOperationNormFwdBiasDesc                      BackendAttributeName = 2006
	AttrOperationNormFwdEpsilonDesc                   BackendAttributeName = 2007
	AttrOperationNormFwdExpAvgFactorDesc              BackendAttributeName = 2008
	AttrOperationNormFwdInputRunningMeanDesc          BackendAttributeName = 2009
	AttrOperationNormFwdInputRunningVarDesc           BackendAttributeName = 2010
	AttrOperationNormFwdOutputRunningMeanDesc         BackendAttributeName = 2011
	AttrOperationNormFwdOutputRunningVarDesc          BackendAttributeName = 2012
	AttrOperationNormFwdYdesc                         BackendAttributeName = 2013
	AttrOperationNormFwdPeerStatDescs                 BackendAttributeName = 2014
	AttrOperationNormBwdMode                          BackendAttributeName = 2100
	AttrOperationNormBwdXdesc                         BackendAttributeName = 2101
	AttrOperationNormBwdMeanDesc                      BackendAttributeName = 2102
	AttrOperationNormBwdInvVarianceDesc               BackendAttributeName = 2103
	AttrOperationNormBwdDydesc                        BackendAttributeName = 2104
	AttrOperationNormBwdScaleDesc                     BackendAttributeName = 2105
	AttrOperationNormBwdEpsilonDesc                   BackendAttributeName = 2106
	AttrOperationNormBwdDscaleDesc                    BackendAttributeName = 2107
	AttrOperationNormBwdDbiasDesc                     BackendAttributeName = 2108
	AttrOperationNormBwdDxdesc                        BackendAttributeName = 2109
	AttrOperationNormBwdPeerStatDescs                 BackendAttributeName = 2110
	AttrOperationReshapeXdesc                         BackendAttributeName = 2200
	AttrOperationReshapeYdesc                         BackendAttributeName = 2201
	AttrOperationExpandBandMatrixXdesc                BackendAttributeName = 2250
	AttrOperationExpandBandMatrixYdesc                BackendAttributeName = 2251
	AttrOperationExpandBandMatrixLowerBandwidth       BackendAttributeName = 2252
	AttrOperationExpandBandMatrixUpperBandwidth       BackendAttributeName = 2253
	AttrOperationExpandBandMatrixAxis                 BackendAttributeName = 2254
	AttrOperationExpandBandMatrixPadValue             BackendAttributeName = 2255
	AttrOperationExpandBandMatrixKvTokenOffsetDesc    BackendAttributeName = 2256
	AttrOperationExpandBandMatrixSpeculativeMaskDesc  BackendAttributeName = 2257
	AttrOperationContractBandMatrixXdesc              BackendAttributeName = 2270
	AttrOperationContractBandMatrixYdesc              BackendAttributeName = 2271
	AttrOperationContractBandMatrixLowerBandwidth     BackendAttributeName = 2272
	AttrOperationContractBandMatrixUpperBandwidth     BackendAttributeName = 2273
	AttrOperationContractBandMatrixAxis               BackendAttributeName = 2274
	AttrOperationContractBandMatrixPadValue           BackendAttributeName = 2275
	AttrOperationContractBandMaxTokenValue            BackendAttributeName = 2276
	AttrRngDistribution                               BackendAttributeName = 2300
	AttrRngNormalDistMean                             BackendAttributeName = 2301
	AttrRngNormalDistStandardDeviation                BackendAttributeName = 2302
	AttrRngUniformDistMaximum                         BackendAttributeName = 2303
	AttrRngUniformDistMinimum                         BackendAttributeName = 2304
	AttrRngBernoulliDistProbability                   BackendAttributeName = 2305
	AttrOperationRngYdesc                             BackendAttributeName = 2310
	AttrOperationRngSeed                              BackendAttributeName = 2311
	AttrOperationRngDesc                              BackendAttributeName = 2312
	AttrOperationRngOffsetDesc                        BackendAttributeName = 2313
	AttrKernelCacheOperationGraph                     BackendAttributeName = 2400
	AttrKernelCacheIsEnginecfgKernelCached            BackendAttributeName = 2401
	AttrKernelCacheJsonRepresentation                 BackendAttributeName = 2402
	AttrOperationBlockScaleQuantizeXdesc              BackendAttributeName = 2500
	AttrOperationBlockScaleQuantizeYdesc              BackendAttributeName = 2501
	AttrOperationBlockScaleQuantizeScaleDesc          BackendAttributeName = 2502
	AttrOperationBlockScaleQuantizeMathPrec           BackendAttributeName = 2503
	AttrOperationBlockScaleQuantizeBlockSize          BackendAttributeName = 2504
	AttrOperationBlockScaleDequantizeXdesc            BackendAttributeName = 2600
	AttrOperationBlockScaleDequantizeScaleDesc        BackendAttributeName = 2601
	AttrOperationBlockScaleDequantizeYdesc            BackendAttributeName = 2602
	AttrOperationBlockScaleDequantizeMathPrec         BackendAttributeName = 2603
	AttrOperationBlockScaleDequantizeBlockSize        BackendAttributeName = 2604
	AttrOperationBlockScaleDequantizeNegScale         BackendAttributeName = 2605
	AttrDevicepropDeviceId                            BackendAttributeName = 2700
	AttrDevicepropHandle                              BackendAttributeName = 2701
	AttrDevicepropJsonRepresentation                  BackendAttributeName = 2702
	AttrOperationSdpaFwdQdesc                         BackendAttributeName = 2800
	AttrOperationSdpaFwdKdesc                         BackendAttributeName = 2801
	AttrOperationSdpaFwdVdesc                         BackendAttributeName = 2802
	AttrOperationSdpaFwdOdesc                         BackendAttributeName = 2803
	AttrOperationSdpaFwdStatsdesc                     BackendAttributeName = 2804
	AttrOperationSdpaFwdScaledesc                     BackendAttributeName = 2805
	AttrOperationSdpaFwdBlockMaskDesc                 BackendAttributeName = 2806
	AttrOperationSdpaFwdPageTableKdesc                BackendAttributeName = 2807
	AttrOperationSdpaFwdPageTableVdesc                BackendAttributeName = 2808
	AttrOperationSdpaFwdSeqLenQdesc                   BackendAttributeName = 2809
	AttrOperationSdpaFwdSeqLenKvdesc                  BackendAttributeName = 2810
	AttrOperationSdpaBwdQdesc                         BackendAttributeName = 2851
	AttrOperationSdpaBwdKdesc                         BackendAttributeName = 2852
	AttrOperationSdpaBwdVdesc                         BackendAttributeName = 2853
	AttrOperationSdpaBwdOdesc                         BackendAttributeName = 2854
	AttrOperationSdpaBwdStatsdesc                     BackendAttributeName = 2855
	AttrOperationSdpaBwdScaledesc                     BackendAttributeName = 2856
	AttrOperationSdpaBwdSeqLenQdesc                   BackendAttributeName = 2857
	AttrOperationSdpaBwdSeqLenKvdesc                  BackendAttributeName = 2858
	AttrOperationSdpaBwdDqdesc                        BackendAttributeName = 2859
	AttrOperationSdpaBwdDkdesc                        BackendAttributeName = 2860
	AttrOperationSdpaBwdDvdesc                        BackendAttributeName = 2861
	AttrOperationSdpaBwdDoddesc                       BackendAttributeName = 2862
	AttrOperationMoeGroupedMatmulMode                 BackendAttributeName = 2900
	AttrOperationMoeGroupedMatmulMathPrec             BackendAttributeName = 2901
	AttrOperationMoeGroupedMatmulTokenDesc            BackendAttributeName = 2902
	AttrOperationMoeGroupedMatmulWeightDesc           BackendAttributeName = 2903
	AttrOperationMoeGroupedMatmulFirstTokenOffsetDesc BackendAttributeName = 2904
	AttrOperationMoeGroupedMatmulOutputDesc           BackendAttributeName = 2905
	AttrOperationMoeGroupedMatmulTokenIndexDesc       BackendAttributeName = 2906
	AttrOperationMoeGroupedMatmulTokenKsDesc          BackendAttributeName = 2907
	AttrOperationMoeGroupedMatmulTopK                 BackendAttributeName = 2908
	AttrOperationDiagonalBandMaskXdesc                BackendAttributeName = 3000
	AttrOperationDiagonalBandMaskSeqLenKvdesc         BackendAttributeName = 3001
	AttrOperationDiagonalBandMaskSeqLenQdesc          BackendAttributeName = 3002
	AttrOperationDiagonalBandMaskLeftBoundDesc        BackendAttributeName = 3003
	AttrOperationDiagonalBandMaskShiftRightBoundDesc  BackendAttributeName = 3004
	AttrOperationDiagonalBandMaskBdesc                BackendAttributeName = 3005
	AttrOperationDiagonalBandMaskYdesc                BackendAttributeName = 3006
	AttrOperationDiagonalBandMaskComparisonMode       BackendAttributeName = 3007
	AttrOperationSoftmaxXdesc                         BackendAttributeName = 3100
	AttrOperationSoftmaxYdesc                         BackendAttributeName = 3101
	AttrOperationSoftmaxStatsDesc                     BackendAttributeName = 3102
	AttrOperationSoftmaxMaxDesc                       BackendAttributeName = 3103
	AttrOperationSoftmaxSumExpDesc                    BackendAttributeName = 3104
	AttrOperationSoftmaxSinkDesc                      BackendAttributeName = 3105
)

func (BackendAttributeName) String

func (e BackendAttributeName) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendAttributeType

type BackendAttributeType int32

BackendAttributeType specifies the data type of an attribute of a cuDNN backend descriptor.

It is used to specify the type of data pointed to by the void *arrayOfElements argument of BackendDescriptor.SetAttribute and BackendDescriptor.Attribute. Attribute Types for BackendAttributeType

const (
	TypeHandle          BackendAttributeType = 0
	TypeDataType        BackendAttributeType = 1
	TypeBoolean         BackendAttributeType = 2
	TypeInt64           BackendAttributeType = 3
	TypeFloat           BackendAttributeType = 4
	TypeDouble          BackendAttributeType = 5
	TypeVoidPtr         BackendAttributeType = 6
	TypeConvolutionMode BackendAttributeType = 7
	TypeHeurMode        BackendAttributeType = 8
	TypeKnobType        BackendAttributeType = 9
	//
	// Deprecated: Deprecated by NVIDIA.
	TypeNanPropogation        BackendAttributeType = 10
	TypeNumericalNote         BackendAttributeType = 11
	TypeLayoutType            BackendAttributeType = 12
	TypeAttribName            BackendAttributeType = 13
	TypePointwiseMode         BackendAttributeType = 14
	TypeBackendDescriptor     BackendAttributeType = 15
	TypeGenstatsMode          BackendAttributeType = 16
	TypeBnFinalizeStatsMode   BackendAttributeType = 17
	TypeReductionOperatorType BackendAttributeType = 18
	TypeBehaviorNote          BackendAttributeType = 19
	TypeTensorReorderingMode  BackendAttributeType = 20
	TypeResampleMode          BackendAttributeType = 21
	TypePaddingMode           BackendAttributeType = 22
	TypeInt32                 BackendAttributeType = 23
	TypeChar                  BackendAttributeType = 24
	TypeSignalMode            BackendAttributeType = 25
	TypeFraction              BackendAttributeType = 26
	TypeNormMode              BackendAttributeType = 27
	TypeNormFwdPhase          BackendAttributeType = 28
	TypeRngDistribution       BackendAttributeType = 29
	TypeMoeGroupedMatmulMode  BackendAttributeType = 30
)

func (BackendAttributeType) String

func (e BackendAttributeType) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendBehaviorNote

type BackendBehaviorNote int32

BackendBehaviorNote is an enumerated type that indicates queryable behavior notes of an engine.

Users can query for an array of behavior notes from an BackendEngineDescriptor using the BackendDescriptor.Attribute function.

const (
	BehaviorNoteRuntimeCompilation           BackendBehaviorNote = 0
	BehaviorNoteRequiresFilterInt8x32Reorder BackendBehaviorNote = 1
	BehaviorNoteRequiresBiasInt8x32Reorder   BackendBehaviorNote = 2
	BehaviorNoteSupportsCudaGraphNativeApi   BackendBehaviorNote = 3
	BehaviorNoteCublasltDependency           BackendBehaviorNote = 4
	BehaviorNoteTypeCount                    BackendBehaviorNote = 5
)

func (BackendBehaviorNote) String

func (e BackendBehaviorNote) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendDescriptor

type BackendDescriptor uintptr

BackendDescriptor is an opaque handle for cudnnBackendDescriptor_t.

func NewBackendDescriptor

func NewBackendDescriptor(descriptorType BackendDescriptorType) (BackendDescriptor, error)

NewBackendDescriptor allocates memory in the descriptor for a given descriptor type and at the location pointed by the descriptor.

A nil error means the creation was successful.

Errors:

Wraps cudnnBackendCreateDescriptor.

func (BackendDescriptor) Attribute

func (b BackendDescriptor) Attribute(attributeName BackendAttributeName, attributeType BackendAttributeType, requestedElementCount int64, arrayOfElements unsafe.Pointer) (int64, error)

Attribute retrieves the values of an attribute of a descriptor.

attributeName is the name of the attribute whose value is requested. attributeType is the type of attribute. requestsedElementCount is the number of elements to be potentially retrieved. The number of elements for the requested attribute is returned. The retrieved values are stored in arrayOfElements. When the attribute is expected to have a single value, arrayOfElements can be pointer to the output value. This function will return CUDNN_STATUS_NOT_INTIALIZED if the descriptor has not been successfully finalized using BackendDescriptor.Finalize.

  • attributeName: Input. The name of the attribute being get from the on the descriptor
  • attributeType: Input. The type of attribute
  • requestedElementCount: Input. Number of elements to output to arrayOfElements
  • arrayOfElements: Input. Array of elements of the datatype of the attributeType. The data type of the attributeType is listed in the mapping table of BackendAttributeType

A nil error means the attributeName was given to the descriptor successfully.

Errors:

  • ErrBadParam: One or more invalid or inconsistent argument values were encountered. Some examples include: attributeName is not a valid attribute for the descriptor. attributeType is not one of the valid types for the attribute.
  • ErrNotInitialized: The descriptor has not been successfully finalized using BackendDescriptor.Finalize.

Wraps cudnnBackendGetAttribute.

func (*BackendDescriptor) Close

func (b *BackendDescriptor) Close() error

Close destroys instances of BackendDescriptor that were previously created using NewBackendDescriptor.

A nil error means the memory was destroyed successfully.

Errors:

  • ErrAllocFailed: The destruction of memory failed. Undefined Behavior The descriptor was altered between the Create and Handle.Close Descriptor. Undefined The value pointed by the descriptor will be Undefined after the memory is free and done.

If b is zero, Close returns nil. Otherwise Close sets b to zero when the call succeeds and leaves it unchanged when it fails. Only b is zeroed: a copy of it still refers to the released object.

Wraps cudnnBackendDestroyDescriptor.

func (BackendDescriptor) Destroy deprecated

func (b BackendDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use BackendDescriptor.Close instead.

func (BackendDescriptor) Execute

func (b BackendDescriptor) Execute(handle Handle, variantPack BackendDescriptor) error

Execute executes the given Engine Configuration Plan on the VariantPack and the finalized ExecutionPlan on the data.

The data and the working space are encapsulated in the VariantPack.

  • variantPack: Input. Pointer to the finalized VariantPack consisting of: Data pointer for each non-virtual pointer of the operation set in the execution plan. Pointer to user-allocated workspace in global memory at least as large as the size queried from CUDNN_BACKEND_

A nil error means the ExecutionPlan was executed successfully.

Errors:

  • ErrBadParam: An incorrect or inconsistent value is encountered. For example, a required data pointer is invalid.
  • ErrExecutionFailed: An error was encountered executing the plan with the variant pack.
  • ErrInternalError: Some internal errors were encountered.

Wraps cudnnBackendExecute.

func (BackendDescriptor) Finalize

func (b BackendDescriptor) Finalize() error

Finalize finalizes the memory pointed to by the descriptor.

The type of finalization is done depending on the descriptorType argument with which the descriptor was created using NewBackendDescriptor or initialized using BackendDescriptor.Initialize. BackendDescriptor.Finalize also checks all the attributes set between the create/initialization and finalize phase. If successful, BackendDescriptor.Finalize returns Success and the finalized state of the descriptor is set to true. In this state, setting attributes using BackendDescriptor.SetAttribute is not allowed. Getting attributes using BackendDescriptor.Attribute is only allowed when the finalized state of the descriptor is true.

A nil error means the descriptor was finalized successfully.

Errors:

  • CUDNN_STATUS_BAD_PARAMS: Invalid descriptor attribute values or combination thereof is encountered.
  • ErrInternalError: Some internal errors are encountered.
  • ErrNotSupported: Descriptor attribute values or combinations therefore not supported by the current version of cuDNN are encountered.

Wraps cudnnBackendFinalize.

func (BackendDescriptor) Initialize deprecated

func (b BackendDescriptor) Initialize() error

Initialize repurposes a pre-allocated memory pointed to by a descriptor of size sizeInByte to a backend descriptor of type descriptorType.

This function repurposes a pre-allocated memory pointed to by a descriptor of size sizeInByte to a backend descriptor of type descriptorType. The finalized state of the descriptor is set to false.

A nil error means the memory was initialized successfully.

Errors:

  • ErrBadParam: An invalid or inconsistent argument value is encountered. Some examples include: descriptor is a nullptr sizeInBytes is less than the size required by the descriptor type

Wraps cudnnBackendInitialize.

Deprecated: Deprecated in cuDNN 9.2.

func (BackendDescriptor) PopulateCudaGraph

func (b BackendDescriptor) PopulateCudaGraph(handle Handle, variantPack BackendDescriptor, graph Graph) error

PopulateCudaGraph wraps cudnnBackendPopulateCudaGraph.

func (BackendDescriptor) SetAttribute

func (b BackendDescriptor) SetAttribute(attributeName BackendAttributeName, attributeType BackendAttributeType, elementCount int64, arrayOfElements unsafe.Pointer) error

SetAttribute sets an attribute of a descriptor to values provided as a pointer.

descriptor is the descriptor to be set. attributeName is the name of the attribute to be set. attributeType is the type of attribute. The value to which the attribute is set, is pointed by the arrayOfElements. The number of elements is given by elementCount. This function will return CUDNN_STATUS_NOT_INTIALIZED if the descriptor is already successfully finalized using BackendDescriptor.Finalize.

  • attributeName: Input. The name of the attribute being set on the descriptor
  • attributeType: Input. The type of attribute
  • elementCount: Input. Number of elements being set
  • arrayOfElements: Input. The starting location for an array from where to read the values from. The elements of the array are expected to be of the datatype of the attributeType. The datatype of the attributeType is listed in the mapping table of BackendAttributeType

A nil error means the attributeName was set to the descriptor.

Errors:

  • ErrBadParam: The function is called with arguments that correspond to invalid values. Some examples include: attributeName is not a settable attribute of descriptor. attributeType is incorrect for this attributeName. elemCount value is unexpected. arrayOfElements contains values invalid for the attributeType.
  • ErrNotInitialized: The backend descriptor pointed to by the descriptor is already in the finalized state.
  • ErrNotSupported: The values to which the attributes are being set are not supported by the current version of cuDNN.

Wraps cudnnBackendSetAttribute.

func (BackendDescriptor) UpdateCudaGraph

func (b BackendDescriptor) UpdateCudaGraph(handle Handle, variantPack BackendDescriptor, graph Graph) error

UpdateCudaGraph wraps cudnnBackendUpdateCudaGraph.

type BackendDescriptorType

type BackendDescriptorType int32

BackendDescriptorType is an enumerated type that indicates the type of backend descriptors.

Users create a backend descriptor of a particular type by passing a value from this enumerate to the NewBackendDescriptor function.

const (
	BackendPointwiseDescriptor                          BackendDescriptorType = 0
	BackendConvolutionDescriptor                        BackendDescriptorType = 1
	BackendEngineDescriptor                             BackendDescriptorType = 2
	BackendEnginecfgDescriptor                          BackendDescriptorType = 3
	BackendEngineheurDescriptor                         BackendDescriptorType = 4
	BackendExecutionPlanDescriptor                      BackendDescriptorType = 5
	BackendIntermediateInfoDescriptor                   BackendDescriptorType = 6
	BackendKnobChoiceDescriptor                         BackendDescriptorType = 7
	BackendKnobInfoDescriptor                           BackendDescriptorType = 8
	BackendLayoutInfoDescriptor                         BackendDescriptorType = 9
	BackendOperationConvolutionForwardDescriptor        BackendDescriptorType = 10
	BackendOperationConvolutionBackwardFilterDescriptor BackendDescriptorType = 11
	BackendOperationConvolutionBackwardDataDescriptor   BackendDescriptorType = 12
	BackendOperationPointwiseDescriptor                 BackendDescriptorType = 13
	BackendOperationGenStatsDescriptor                  BackendDescriptorType = 14
	BackendOperationgraphDescriptor                     BackendDescriptorType = 15
	BackendVariantPackDescriptor                        BackendDescriptorType = 16
	BackendTensorDescriptor                             BackendDescriptorType = 17
	BackendMatmulDescriptor                             BackendDescriptorType = 18
	BackendOperationMatmulDescriptor                    BackendDescriptorType = 19
	BackendOperationBnFinalizeStatisticsDescriptor      BackendDescriptorType = 20
	BackendReductionDescriptor                          BackendDescriptorType = 21
	BackendOperationReductionDescriptor                 BackendDescriptorType = 22
	BackendOperationBnBwdWeightsDescriptor              BackendDescriptorType = 23
	BackendResampleDescriptor                           BackendDescriptorType = 24
	BackendOperationResampleFwdDescriptor               BackendDescriptorType = 25
	BackendOperationResampleBwdDescriptor               BackendDescriptorType = 26
	BackendOperationConcatDescriptor                    BackendDescriptorType = 27
	BackendOperationSignalDescriptor                    BackendDescriptorType = 28
	BackendOperationNormForwardDescriptor               BackendDescriptorType = 29
	BackendOperationNormBackwardDescriptor              BackendDescriptorType = 30
	BackendOperationReshapeDescriptor                   BackendDescriptorType = 31
	BackendRngDescriptor                                BackendDescriptorType = 32
	BackendOperationRngDescriptor                       BackendDescriptorType = 33
	BackendKernelCacheDescriptor                        BackendDescriptorType = 34
	BackendOperationPagedCacheLoadDescriptor            BackendDescriptorType = 35
	BackendOperationBlockScaleQuantizeDescriptor        BackendDescriptorType = 36
	BackendOperationBlockScaleDequantizeDescriptor      BackendDescriptorType = 37
	BackendDevicepropDescriptor                         BackendDescriptorType = 38
	BackendOperationExpandBandMatrixDescriptor          BackendDescriptorType = 39
	BackendOperationContractBandMatrixDescriptor        BackendDescriptorType = 40
	BackendOperationSdpaFwdDescriptor                   BackendDescriptorType = 41
	BackendOperationMoeGroupedMatmulDescriptor          BackendDescriptorType = 42
	BackendOperationSdpaBwdDescriptor                   BackendDescriptorType = 43
	BackendOperationDiagonalBandMaskDescriptor          BackendDescriptorType = 44
	BackendOperationSoftmaxDescriptor                   BackendDescriptorType = 45
)

func (BackendDescriptorType) String

func (e BackendDescriptorType) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendHeurMode

type BackendHeurMode int32

BackendHeurMode is an enumerated type that indicates the operation mode of a BackendEngineheurDescriptor.

const (
	HeurModeInstant  BackendHeurMode = 0
	HeurModeB        BackendHeurMode = 1 // Can utilize the neural net based heuristics to improve generalization performance compared to [HeurModeInstant]. In cases where the neural net is utilized, inference time on the CPU will be increased by 10-100x compared to [HeurModeInstant]. These neural net heuristics are not supported for any of the following cases: Further, the neural net is only enabled on x86 platforms when cuDNN is run on an A100 GPU. In cases where the neural net is not supported, [HeurModeB] will fall back to [HeurModeInstant]. [HeurModeB] will also fall back to [HeurModeInstant] in cases where the overhead of [HeurModeB] is projected to reduce overall network performance.
	HeurModeFallback BackendHeurMode = 2 // This heuristic mode is intended to be used for finding fallback options which provide functional support (without any expectation of providing optimal GPU performance).
	HeurModeA        BackendHeurMode = 3
	HeurModesCount   BackendHeurMode = 4
)

func (BackendHeurMode) String

func (e BackendHeurMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendKnobType

type BackendKnobType int32

BackendKnobType is an enumerated type that indicates the type of performance knobs.

Performance knobs are runtime settings to an engine that will affect its performance. Users can query for an array of performance knobs and their valid value range from a BackendEngineDescriptor using the BackendDescriptor.Attribute function. Users can set the choice for each knob using the BackendDescriptor.SetAttribute function with a BackendKnobChoiceDescriptor.

const (
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeSplitK   BackendKnobType = 0
	KnobTypeSwizzle  BackendKnobType = 1
	KnobTypeTileSize BackendKnobType = 2
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeUseTex BackendKnobType = 3
	KnobTypeEdge   BackendKnobType = 4
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeKblock BackendKnobType = 5
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeLdga BackendKnobType = 6
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeLdgb BackendKnobType = 7
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeChunkK BackendKnobType = 8
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeSplitH BackendKnobType = 9
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeWinoTile      BackendKnobType = 10
	KnobTypeMultiply      BackendKnobType = 11
	KnobTypeSplitKBuf     BackendKnobType = 12
	KnobTypeTilek         BackendKnobType = 13
	KnobTypeStages        BackendKnobType = 14
	KnobTypeReductionMode BackendKnobType = 15
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeCtaSplitKMode BackendKnobType = 16
	KnobTypeSplitKSlc     BackendKnobType = 17
	KnobTypeIdxMode       BackendKnobType = 18
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeSliced BackendKnobType = 19
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeSplitRs BackendKnobType = 20
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeSinglebuffer BackendKnobType = 21
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeLdgc      BackendKnobType = 22
	KnobTypeSpecfilt  BackendKnobType = 23
	KnobTypeKernelCfg BackendKnobType = 24
	KnobTypeWorkspace BackendKnobType = 25
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeTileCga            BackendKnobType = 26
	KnobTypeTileCgaM           BackendKnobType = 27
	KnobTypeTileCgaN           BackendKnobType = 28
	KnobTypeBlockSize          BackendKnobType = 29
	KnobTypeOccupancy          BackendKnobType = 30
	KnobTypeArraySizePerThread BackendKnobType = 31
	//
	// Deprecated: Deprecated by NVIDIA.
	KnobTypeNumCPerBlock BackendKnobType = 32
	KnobTypeSplitCols    BackendKnobType = 33
	KnobTypeTileRows     BackendKnobType = 34
	KnobTypeTileCols     BackendKnobType = 35
	KnobTypeLoadSize     BackendKnobType = 36
	KnobTypeCtaCount     BackendKnobType = 37
	KnobTypeStreamK      BackendKnobType = 38
	KnobTypeSplitPSlc    BackendKnobType = 39
	KnobTypeTileM        BackendKnobType = 40
	KnobTypeTileN        BackendKnobType = 41
	KnobTypeWarpSpecCfg  BackendKnobType = 42
	KnobTypeSwapAb       BackendKnobType = 43
	KnobTypeCounts       BackendKnobType = 44
)

func (BackendKnobType) String

func (e BackendKnobType) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendLayoutType

type BackendLayoutType int32

BackendLayoutType is an enumerated type that indicates queryable layout requirements of an engine.

Users can query for layout requirements from a BackendEngineDescriptor using the BackendDescriptor.Attribute function.

const (
	LayoutTypePreferredNchw   BackendLayoutType = 0
	LayoutTypePreferredNhwc   BackendLayoutType = 1
	LayoutTypePreferredPad4ck BackendLayoutType = 2
	LayoutTypePreferredPad8ck BackendLayoutType = 3
	LayoutTypeCount           BackendLayoutType = 4
)

func (BackendLayoutType) String

func (e BackendLayoutType) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendNormFwdPhase

type BackendNormFwdPhase int32

BackendNormFwdPhase is an enumerated type used to distinguish the inference and training phase of the normalization forward operation.

const (
	NormFwdInference BackendNormFwdPhase = 0
	NormFwdTraining  BackendNormFwdPhase = 1
)

func (BackendNormFwdPhase) String

func (e BackendNormFwdPhase) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendNormMode

type BackendNormMode int32

BackendNormMode is an enumerated type to indicate the normalization mode in the backend normalization forward and normalization backward operations. For reference: GroupNorm is not yet supported. If you try to use it, cuDNN returns a ErrInternalError error.

const (
	LayerNorm    BackendNormMode = 0
	InstanceNorm BackendNormMode = 1
	BatchNorm    BackendNormMode = 2
	GroupNorm    BackendNormMode = 3
	RmsNorm      BackendNormMode = 4
	AdaLayerNorm BackendNormMode = 5
)

func (BackendNormMode) String

func (e BackendNormMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendNumericalNote

type BackendNumericalNote int32

BackendNumericalNote is an enumerated type that indicates queryable numerical properties of an engine.

Users can query for an array of numerical notes from an BackendEngineDescriptor using the BackendDescriptor.Attribute function.

const (
	NumericalNoteTensorCore                BackendNumericalNote = 0
	NumericalNoteDownConvertInputs         BackendNumericalNote = 1
	NumericalNoteReducedPrecisionReduction BackendNumericalNote = 2
	NumericalNoteFft                       BackendNumericalNote = 3
	NumericalNoteNondeterministic          BackendNumericalNote = 4
	NumericalNoteWinograd                  BackendNumericalNote = 5
	NumericalNoteWinogradTile4x4           BackendNumericalNote = 6
	NumericalNoteWinogradTile6x6           BackendNumericalNote = 7
	NumericalNoteWinogradTile13x13         BackendNumericalNote = 8
	NumericalNoteStrictNanProp             BackendNumericalNote = 9
	NumericalNoteTypeCount                 BackendNumericalNote = 10
)

func (BackendNumericalNote) String

func (e BackendNumericalNote) String() string

String returns the constant name, or a numeric representation for unknown values.

type BackendTensorReordering

type BackendTensorReordering int32

BackendTensorReordering is an enumerated type that indicates tensor reordering as a property of the tensor descriptor.

Users can get and set this property in a BackendTensorDescriptor using the BackendDescriptor.SetAttribute and BackendDescriptor.Attribute functions.

const (
	TensorReorderingNone    BackendTensorReordering = 0
	TensorReorderingInt8x32 BackendTensorReordering = 1
	TensorReorderingF16x16  BackendTensorReordering = 2
	TensorReorderingF8128x4 BackendTensorReordering = 3
)

func (BackendTensorReordering) String

func (e BackendTensorReordering) String() string

String returns the constant name, or a numeric representation for unknown values.

type BatchNormMode deprecated

type BatchNormMode int32

BatchNormMode is an enumerated type used to specify the mode of operation in Handle.BatchNormalizationForwardInference, Handle.BatchNormalizationForwardTraining, Handle.BatchNormalizationBackward, and TensorDescriptor.DeriveBN routines.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	BatchnormPerActivation     BatchNormMode = 0 // Normalization is performed per-activation. This mode is intended to be used after the non-convolutional network layers. In this mode, the tensor dimensions of bnBias and bnScale and the parameters used in the cudnnBatchNormalization* functions are 1xCxHxW.
	BatchnormSpatial           BatchNormMode = 1 // Normalization is performed over N+spatial dimensions. This mode is intended for use after convolutional layers (where spatial invariance is desired). In this mode, the bnBias and bnScale tensor dimensions are 1xCx1x1.
	BatchnormSpatialPersistent BatchNormMode = 2 // This mode is similar to [BatchnormSpatial] but it can be faster for some tasks. An optimized path may be selected for [DataFloat] and [DataHalf] types, compute capability 6.0 or higher for the following two batch normalization API calls: [Handle.BatchNormalizationForwardTraining], and [Handle.BatchNormalizationBackward]. In the case of [Handle.BatchNormalizationBackward], the savedMean and savedInvVariance arguments should not be NULL. NCHW Mode Only This mode may use a scaled atomic integer reduction that is deterministic but imposes more restrictions on the input data range. When a numerical overflow occurs, the algorithm may produce NaN-s or Inf-s (infinity) in output buffers. When Inf-s/NaN-s are present in the input data, the output in this mode is the same as from a pure floating-point implementation. For finite but very large input values, the algorithm may encounter overflows more frequently due to a lower dynamic range and emit Inf-s/NaN-s while [BatchnormSpatial] will produce finite results. The user can invoke [Handle.QueryRuntimeError] to check if a numerical overflow occurred in this mode.
)

func (BatchNormMode) String

func (e BatchNormMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type BatchNormOps deprecated

type BatchNormOps int32

BatchNormOps is an enumerated type used to specify the mode of operation in Handle.BatchNormalizationForwardTrainingExWorkspaceSize, Handle.BatchNormalizationForwardTrainingEx, Handle.BatchNormalizationBackwardExWorkspaceSize, Handle.BatchNormalizationBackwardEx, and Handle.BatchNormalizationTrainingExReserveSpaceSize functions.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	BatchnormOpsBn              BatchNormOps = 0 // Only batch normalization is performed, per-activation.
	BatchnormOpsBnActivation    BatchNormOps = 1 // First, the batch normalization is performed, and then the activation is performed.
	BatchnormOpsBnAddActivation BatchNormOps = 2 // Performs the batch normalization, then element-wise addition, followed by the activation operation.
)

func (BatchNormOps) String

func (e BatchNormOps) String() string

String returns the constant name, or a numeric representation for unknown values.

type BindFailure

type BindFailure struct {
	Symbol string
	Err    error
}

BindFailure names a symbol the loaded library exports but that could not be bound, and why.

func BindFailures

func BindFailures() []BindFailure

BindFailures returns the symbols the loaded library exports that could not be bound, sorted by symbol name, or nil if every exported symbol bound. Calling one of these reports *SymbolError with the same Err.

A load that reports no error can still leave symbols unbound: the library is fine and the signatures are not representable here. Call this after Load to find that out at once rather than one call site at a time. It does not trigger a load, and returns nil if none has happened.

type BnFinalizeStatsMode

type BnFinalizeStatsMode int32

BnFinalizeStatsMode is an enumerated type that that exposes the different mathematical operation modes that converts batch norm statistics and the trained scale and bias to the equivalent scale and bias to be applied in the next normalization stage for inference and training use cases.

const (
	BnFinalizeStatisticsTraining  BnFinalizeStatsMode = 0
	BnFinalizeStatisticsInference BnFinalizeStatsMode = 1
)

func (BnFinalizeStatsMode) String

func (e BnFinalizeStatsMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type CTCGradMode

type CTCGradMode int32

CTCGradMode is an enumerated type used by CTCLossDescriptor.Set and CTCLossDescriptor.Get to indicate the behavior for out of boundary (OOB) samples. OOB samples are samples where L+R > T is encountered during the gradient calculation.

const (
	CtcZeroOobGradients CTCGradMode = 0
	CtcSkipOobGradients CTCGradMode = 1
)

func (CTCGradMode) String

func (e CTCGradMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type CTCLossAlgo

type CTCLossAlgo int32

CTCLossAlgo is an enumerated type that exposes the different algorithms available to execute the CTC loss operation.

const (
	CtcLossAlgoDeterministic    CTCLossAlgo = 0 // Results are guaranteed to be reproducible.
	CtcLossAlgoNonDeterministic CTCLossAlgo = 1 // Results are not guaranteed to be reproducible.
)

func (CTCLossAlgo) String

func (e CTCLossAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type CTCLossConfig

type CTCLossConfig struct {
	// Compute type associated with this CTC loss function descriptor.
	CompType DataType
	// Input normalization type for this CTC loss function descriptor. For more information, refer to [LossNormalizationMode].
	NormMode LossNormalizationMode
	// The gradient mode for handling OOB samples for this CTC loss function descriptor. Refer to [CTCLossDescriptor.Set] for more information.
	CTCGradMode CTCGradMode
	// The max label length for this CTC loss function descriptor.
	MaxLabelLength int32
}

CTCLossConfig holds the settings CTCLossDescriptor.Get reports.

type CTCLossDescriptor

type CTCLossDescriptor uintptr

CTCLossDescriptor is a pointer to an opaque structure holding the description of a CTC loss operation.

CreateCTCLossDescriptor is used to create one instance, CTCLossDescriptor.Set is used to initialize this instance, and CTCLossDescriptor.Close is used to destroy this instance.

func CreateCTCLossDescriptor

func CreateCTCLossDescriptor() (CTCLossDescriptor, error)

CreateCTCLossDescriptor creates a CTC loss function descriptor.

Errors:

  • ErrAllocFailed: Memory allocation for this CTC loss descriptor failed.
  • ErrBadParam: The CTC loss descriptor passed to the function is invalid.

Wraps cudnnCreateCTCLossDescriptor.

func (*CTCLossDescriptor) Close

func (c *CTCLossDescriptor) Close() error

Close destroys a CTC loss function descriptor object.

If c is zero, Close returns nil. Otherwise Close sets c to zero when the call succeeds and leaves it unchanged when it fails. Only c is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyCTCLossDescriptor.

func (CTCLossDescriptor) Destroy deprecated

func (c CTCLossDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use CTCLossDescriptor.Close instead.

func (CTCLossDescriptor) Get

Get returns the configuration of the passed CTC loss function descriptor.

Errors:

  • ErrBadParam: Input ctcLossDesc descriptor passed is invalid.

Wraps cudnnGetCTCLossDescriptor_v9.

func (CTCLossDescriptor) GetEx deprecated

GetEx returns the configuration of the passed CTC loss function descriptor.

This function returns the configuration of the passed CTC loss function descriptor.

Errors:

  • ErrBadParam: Input ctcLossDesc descriptor passed is invalid.

Wraps cudnnGetCTCLossDescriptorEx.

Deprecated: Deprecated in cuDNN 9.0. Use CTCLossDescriptor.Get instead. This function has been deprecated in cuDNN 9.0; use CTCLossDescriptor.Get instead.

func (CTCLossDescriptor) Set

Set sets a CTC loss function descriptor.

Errors:

  • ErrBadParam: At least one of the input parameters passed is invalid.

Wraps cudnnSetCTCLossDescriptor_v9.

func (CTCLossDescriptor) SetEx deprecated

func (c CTCLossDescriptor) SetEx(compType DataType, normMode LossNormalizationMode, gradMode NanPropagation) error

SetEx is an extension of CTCLossDescriptor.Set.

This function is an extension of CTCLossDescriptor.Set. This function provides an additional interface normMode to set the input normalization mode for the CTC loss function, and gradMode to control the NaN propagation type. When this function CTCLossDescriptor.SetEx is used with normMode set to LossNormalizationNone and the gradMode set to NotPropagateNan, then it is the same as CTCLossDescriptor.Set, meaning:

  • compType: Input. Compute type for this CTC loss function
  • normMode: Input. Input normalization type for this CTC loss function. For more information, refer to LossNormalizationMode
  • gradMode: Input. NaN propagation type for this CTC loss function. For L the sequence length, R the number of repeated letters in the sequence, and T the length of sequential data, the following applies: when a sample with L+R > T is encountered during the gradient calculation, if gradMode is set to PropagateNan (refer to NanPropagation), then the CTC loss function does not write to the gradient buffer for that sample. Instead, the current values, even not finite, are retained. If gradMode is set to NotPropagateNan, then the gradient for that sample is set to zero. This guarantees a finite gradient

Errors:

  • ErrBadParam: At least one of the input parameters passed is invalid.

Wraps cudnnSetCTCLossDescriptorEx.

Deprecated: Deprecated in cuDNN 9.0. Use CTCLossDescriptor.Set instead. This function has been deprecated in cuDNN 9.0; use CTCLossDescriptor.Set instead.

type CallError

type CallError struct {
	Func   string // the C symbol called
	Result Result
}

CallError reports that a library call returned a failure result.

Unwrap returns Result, so errors.Is(err, c) reports whether the call returned the Result constant c, and errors.As(err, &r) with r of type Result recovers the code.

func (*CallError) Error

func (e *CallError) Error() string

Error reports the C symbol called and the result it returned.

func (*CallError) Unwrap

func (e *CallError) Unwrap() error

Unwrap returns the result the call reported.

type Callback

type Callback func(sev Severity, udata uintptr, dbg uintptr, msg uintptr)

Callback is the Go form of cudnnCallback_t.

It corresponds to the C signature

typedef void (*cudnnCallback_t)(cudnnSeverity_t sev, void *udata, const cudnnDebug_t *dbg, const char *msg);

Pass one to the API by converting it with purego.NewCallback, which is why every pointer argument is a uintptr rather than a Go pointer: the memory belongs to the C library and must not be traced by the collector.

type Convolution2DConfig

type Convolution2DConfig struct {
	// Zero-padding height: number of rows of zeros implicitly concatenated onto the top and onto the bottom of input images.
	PadH int32
	// Zero-padding width: number of columns of zeros implicitly concatenated onto the left and onto the right of input images.
	PadW int32
	// Vertical filter stride.
	U int32
	// Horizontal filter stride.
	V int32
	// Filter height dilation.
	DilationH int32
	// Filter width dilation.
	DilationW int32
	// Convolution mode.
	Mode ConvolutionMode
	// Compute precision.
	ComputeType DataType
}

Convolution2DConfig holds the settings ConvolutionDescriptor.Get2D reports.

type ConvolutionBwdDataAlgo

type ConvolutionBwdDataAlgo int32

ConvolutionBwdDataAlgo is an enumerated type that exposes the different algorithms available to execute the backward data convolution operation.

const (
	ConvolutionBwdDataAlgo0                ConvolutionBwdDataAlgo = 0 // This algorithm expresses the convolution as a sum of matrix products without actually explicitly forming the matrix that holds the input tensor data. The sum is done using the atomic add operation, thus the results are non-deterministic.
	ConvolutionBwdDataAlgo1                ConvolutionBwdDataAlgo = 1 // This algorithm expresses the convolution as a matrix product without actually explicitly forming the matrix that holds the input tensor data. The results are deterministic.
	ConvolutionBwdDataAlgoFft              ConvolutionBwdDataAlgo = 2 // This algorithm uses a Fast-Fourier Transform approach to compute the convolution. A significant memory workspace is needed to store intermediate results. The results are deterministic.
	ConvolutionBwdDataAlgoFftTiling        ConvolutionBwdDataAlgo = 3 // This algorithm uses the Fast-Fourier Transform approach but splits the inputs into tiles. A significant memory workspace is needed to store intermediate results but less than [ConvolutionBwdDataAlgoFft] for large size images. The results are deterministic.
	ConvolutionBwdDataAlgoWinograd         ConvolutionBwdDataAlgo = 4 // This algorithm uses the Winograd Transform approach to compute the convolution. A reasonably sized workspace is needed to store intermediate results. The results are deterministic.
	ConvolutionBwdDataAlgoWinogradNonfused ConvolutionBwdDataAlgo = 5 // This algorithm uses the Winograd Transform approach to compute the convolution. A significant workspace may be needed to store intermediate results. The results are deterministic.
	ConvolutionBwdDataAlgoCount            ConvolutionBwdDataAlgo = 6
)

func (ConvolutionBwdDataAlgo) String

func (e ConvolutionBwdDataAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type ConvolutionBwdDataAlgoPerf deprecated

type ConvolutionBwdDataAlgoPerf struct {
	Algo        ConvolutionBwdDataAlgo
	Status      Result
	Time        float32
	Memory      uint
	Determinism Determinism
	MathType    MathType
	Reserved    [3]int32
}

ConvolutionBwdDataAlgoPerf is a structure containing performance results returned by Handle.FindConvolutionBackwardDataAlgorithm or heuristic results returned by Handle.ConvolutionBackwardDataAlgorithm. Data Members ConvolutionBwdDataAlgo algo The algorithm runs to obtain the associated performance metrics. Result status If any error occurs during the workspace allocation or timing of Handle.ConvolutionBackwardData, this status will represent that error. Otherwise, this status will be the return status of Handle.ConvolutionBackwardData. float time The execution time of Handle.ConvolutionBackwardData (in milliseconds). size_t memory The workspace size (in bytes). Determinism determinism The determinism of the algorithm. MathType mathType The math type provided to the algorithm. int reserved[3] Reserved space for future properties.

Deprecated: Deprecated by NVIDIA. This structure is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this structure.

type ConvolutionBwdFilterAlgo

type ConvolutionBwdFilterAlgo int32

ConvolutionBwdFilterAlgo is an enumerated type that exposes the different algorithms available to execute the backward filter convolution operation.

const (
	ConvolutionBwdFilterAlgo0                ConvolutionBwdFilterAlgo = 0 // This algorithm expresses the convolution as a sum of matrix products without actually explicitly forming the matrix that holds the input tensor data. The sum is done using the atomic add operation, thus the results are non-deterministic.
	ConvolutionBwdFilterAlgo1                ConvolutionBwdFilterAlgo = 1 // This algorithm expresses the convolution as a matrix product without actually explicitly forming the matrix that holds the input tensor data. The results are deterministic.
	ConvolutionBwdFilterAlgoFft              ConvolutionBwdFilterAlgo = 2 // This algorithm uses the Fast-Fourier Transform approach to compute the convolution. A significant workspace is needed to store intermediate results. The results are deterministic.
	ConvolutionBwdFilterAlgo3                ConvolutionBwdFilterAlgo = 3 // This algorithm is similar to [ConvolutionBwdFilterAlgo0] but uses some small workspace to precompute some indices. The results are also non-deterministic.
	ConvolutionBwdFilterAlgoWinograd         ConvolutionBwdFilterAlgo = 4
	ConvolutionBwdFilterAlgoWinogradNonfused ConvolutionBwdFilterAlgo = 5
	ConvolutionBwdFilterAlgoFftTiling        ConvolutionBwdFilterAlgo = 6 // This algorithm uses the Fast-Fourier Transform approach to compute the convolution but splits the input tensor into tiles. A significant workspace may be needed to store intermediate results. The results are deterministic.
	ConvolutionBwdFilterAlgoCount            ConvolutionBwdFilterAlgo = 7
)

func (ConvolutionBwdFilterAlgo) String

func (e ConvolutionBwdFilterAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type ConvolutionBwdFilterAlgoPerf deprecated

type ConvolutionBwdFilterAlgoPerf struct {
	Algo        ConvolutionBwdFilterAlgo
	Status      Result
	Time        float32
	Memory      uint
	Determinism Determinism
	MathType    MathType
	Reserved    [3]int32
}

ConvolutionBwdFilterAlgoPerf is a structure containing performance results returned by Handle.FindConvolutionBackwardFilterAlgorithm or heuristic results returned by Handle.ConvolutionBackwardFilterAlgorithm. Data Members ConvolutionBwdFilterAlgo algo The algorithm runs to obtain the associated performance metrics. Result status If any error occurs during the workspace allocation or timing of Handle.ConvolutionBackwardFilter, this status will represent that error. Otherwise, this status will be the return status of Handle.ConvolutionBackwardFilter. float time The execution time of Handle.ConvolutionBackwardFilter (in milliseconds). size_t memory The workspace size (in bytes). Determinism determinism The determinism of the algorithm. MathType mathType The math type provided to the algorithm. int reserved[3] Reserved space for future properties.

Deprecated: Deprecated by NVIDIA. This structure is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this structure.

type ConvolutionConfig

type ConvolutionConfig struct {
	// Array of dimension of at least arrayLengthRequested that will be filled with the padding parameters from the provided convolution descriptor.
	PadA []int32
	// Array of dimension of at least arrayLengthRequested that will be filled with the filter stride from the provided convolution descriptor.
	StrideA []int32
	// Array of dimension of at least arrayLengthRequested that will be filled with the dilation parameters from the provided convolution descriptor.
	DilationA []int32
	// Convolution mode of the provided descriptor.
	Mode ConvolutionMode
	// Datatype of the provided descriptor.
	ComputeType DataType
}

ConvolutionConfig holds the settings ConvolutionDescriptor.Get reports.

type ConvolutionDescriptor deprecated

type ConvolutionDescriptor uintptr

ConvolutionDescriptor is a pointer to an opaque structure holding the description of a convolution operation.

CreateConvolutionDescriptor is used to create one instance, and ConvolutionDescriptor.Set or ConvolutionDescriptor.Set2D must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateConvolutionDescriptor deprecated

func CreateConvolutionDescriptor() (ConvolutionDescriptor, error)

CreateConvolutionDescriptor creates a convolution descriptor object by allocating the memory needed to hold its opaque structure.

This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. For more information, refer to ConvolutionDescriptor.

Errors:

Wraps cudnnCreateConvolutionDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (*ConvolutionDescriptor) Close deprecated

func (c *ConvolutionDescriptor) Close() error

Close destroys a previously created convolution descriptor object.

This function destroys a previously created convolution descriptor object.

If c is zero, Close returns nil. Otherwise Close sets c to zero when the call succeeds and leaves it unchanged when it fails. Only c is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyConvolutionDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) Destroy deprecated

func (c ConvolutionDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use ConvolutionDescriptor.Close instead.

func (ConvolutionDescriptor) ForwardOutputDim2D deprecated

func (c ConvolutionDescriptor) ForwardOutputDim2D(inputTensorDesc TensorDescriptor, filterDesc FilterDescriptor) (int32, int32, int32, int32, error)

ForwardOutputDim2D returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor.

This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to set up the output tensor and allocate the proper amount of memory prior to launching the actual convolution. Each dimension h and w of the output images is computed as follows:

  • inputTensorDesc: Input. Handle to a previously initialized tensor descriptor
  • filterDesc: Input. Handle to a previously initialized filter descriptor

Errors:

  • ErrBadParam: One or more of the descriptors has not been created correctly or there is a mismatch between the feature maps of inputTensorDesc and filterDesc.

Wraps cudnnGetConvolution2dForwardOutputDim.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) ForwardOutputDims deprecated

func (c ConvolutionDescriptor) ForwardOutputDims(inputTensorDesc TensorDescriptor, filterDesc FilterDescriptor, nbDims int) ([]int32, error)

ForwardOutputDims returns the dimensions of the resulting Nd tensor of a nbDims-2-D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution.

This function returns the dimensions of the resulting Nd tensor of a nbDims-2-D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution. Each dimension of the (nbDims-2)-D images of the output tensor is computed as follows: The dimensions provided by this routine must be strictly respected when calling Handle.ConvolutionForward or Handle.ConvolutionBackwardBias. Providing a smaller or larger output tensor is not supported by the convolution routines.

  • inputTensorDesc: Input. Handle to a previously initialized tensor descriptor
  • filterDesc: Input. Handle to a previously initialized filter descriptor
  • nbDims: Input. Dimension of the output tensor

A nil error means the routine exited successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters convDesc, inputTensorDesc, and filterDesc is NIL. The dimension of the filter descriptor filterDesc is different from the dimension of input tensor descriptor inputTensorDesc. The dimension of the convolution descriptor is different from the dimension of input tensor descriptor inputTensorDesc-2. The features map of the filter descriptor filterDesc is different from the one of input tensor descriptor inputTensorDesc. The size of the dilated filter filterDesc is larger than the padded sizes of the input tensor. The dimension nbDims of the output array is negative or greater than the dimension of input tensor descriptor inputTensorDesc.

Wraps cudnnGetConvolutionNdForwardOutputDim.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) Get deprecated

func (c ConvolutionDescriptor) Get(arrayLengthRequested int) (ConvolutionConfig, error)

Get queries a previously initialized convolution descriptor object.

This function queries a previously initialized convolution descriptor object.

  • arrayLengthRequested: Input. Dimension of the expected convolution descriptor. It is also the minimum size of the arrays padA, filterStrideA, and dilationA in order to be able to hold the results

Errors:

  • ErrBadParam: At least one of the following conditions are met: The descriptor convDesc is NIL. The arrayLengthRequest is negative.
  • ErrNotSupported: The arrayLengthRequested is greater than CUDNN_DIM_MAX-2.

Wraps cudnnGetConvolutionNdDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) Get2D deprecated

Get2D queries a previously initialized 2D convolution descriptor object.

This function queries a previously initialized 2D convolution descriptor object.

Errors:

Wraps cudnnGetConvolution2dDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) GroupCount deprecated

func (c ConvolutionDescriptor) GroupCount() (int32, error)

GroupCount returns the group count specified in the given convolution descriptor.

This function returns the group count specified in the given convolution descriptor.

A nil error means the group count was returned successfully.

Errors:

  • ErrBadParam: An invalid convolution descriptor was provided.

Wraps cudnnGetConvolutionGroupCount.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) MathType deprecated

func (c ConvolutionDescriptor) MathType() (MathType, error)

MathType returns the math type specified in a given convolution descriptor.

This function returns the math type specified in a given convolution descriptor.

A nil error means the math type was returned successfully.

Errors:

  • ErrBadParam: An invalid convolution descriptor was provided.

Wraps cudnnGetConvolutionMathType.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) ReorderType deprecated

func (c ConvolutionDescriptor) ReorderType() (ReorderType, error)

ReorderType retrieves the convolution reorder type from the given convolution descriptor.

This function retrieves the convolution reorder type from the given convolution descriptor.

A nil error means the reorder type is retrieved successfully.

Errors:

  • ErrBadParam: One of the inputs to this function is not valid.

Wraps cudnnGetConvolutionReorderType.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) Set deprecated

func (c ConvolutionDescriptor) Set(padA []int32, filterStrideA []int32, dilationA []int32, mode ConvolutionMode, computeType DataType) error

Set initializes a previously created generic convolution descriptor object into a Nd correlation.

This function initializes a previously created generic convolution descriptor object into a Nd correlation. That same convolution descriptor can be reused in the backward path provided it corresponds to the same layer. The convolution computation will be done in the specified dataType, which can be potentially different from the input/output tensors.

Note: DataHalf in ConvolutionDescriptor.Set with HALF_CONVOLUTION_BWD_FILTER is not recommended as it is known to not be useful for any practical use case for training and will be considered to be blocked in a future cuDNN release. The use of DataHalf for input tensors in TensorDescriptor.Set and DataFloat in ConvolutionDescriptor.Set with HALF_CONVOLUTION_BWD_FILTER is recommended and is used with the automatic mixed precision (AMP) training in many well known deep learning frameworks.

  • padA: Input. Array of dimension arrayLength containing the zero-padding size for each dimension. For every dimension, the padding represents the number of extra zeros implicitly concatenated at the start and at the end of every element of that dimension
  • filterStrideA: Input. Array of dimension arrayLength containing the filter stride for each dimension. For every dimension, the filter stride represents the number of elements to slide to reach the next start of the filtering window of the next point
  • dilationA: Input. Array of dimension arrayLength containing the dilation factor for each dimension
  • mode: Input. Selects between Convolution and CrossCorrelation

Errors:

  • ErrBadParam: At least one of the following conditions are met: The descriptor convDesc is NIL. The arrayLengthRequest is negative. The enumerant mode has an invalid value. The enumerant datatype has an invalid value. One of the elements of padA is strictly negative. One of the elements of strideA is negative or zero. One of the elements of dilationA is negative or zero.
  • ErrNotSupported: At least one of the following conditions are met: The arrayLengthRequest is greater than CUDNN_DIM_MAX.

Wraps cudnnSetConvolutionNdDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) Set2D deprecated

func (c ConvolutionDescriptor) Set2D(padH int32, padW int32, u int32, v int32, dilationH int32, dilationW int32, mode ConvolutionMode, computeType DataType) error

Set2D initializes a previously created convolution descriptor object into a 2D correlation.

This function initializes a previously created convolution descriptor object into a 2D correlation. This function assumes that the tensor and filter descriptors correspond to the forward convolution path and checks if their settings are valid. That same convolution descriptor can be reused in the backward path provided it corresponds to the same layer.

  • padH: Input. Zero-padding height: number of rows of zeros implicitly concatenated onto the top and onto the bottom of input images
  • padW: Input. Zero-padding width: number of columns of zeros implicitly concatenated onto the left and onto the right of input images
  • u: Input. Vertical filter stride
  • v: Input. Horizontal filter stride
  • dilationH: Input. Filter height dilation
  • dilationW: Input. Filter width dilation
  • mode: Input. Selects between Convolution and CrossCorrelation
  • computeType: Input. compute precision

Errors:

  • ErrBadParam: At least one of the following conditions are met: The descriptor convDesc is NIL. One of the parameters pad_h, pad_w is strictly negative. One of the parameters u, v is negative or zero. One of the parameters dilation_h, dilation_w is negative or zero. The parameter mode has an invalid enumerant value.

Wraps cudnnSetConvolution2dDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) SetGroupCount deprecated

func (c ConvolutionDescriptor) SetGroupCount(groupCount int32) error

SetGroupCount allows the user to specify the number of groups to be used in the associated convolution.

This function allows the user to specify the number of groups to be used in the associated convolution.

A nil error means the group count was set successfully.

Errors:

  • ErrBadParam: An invalid convolution descriptor was provided.

Wraps cudnnSetConvolutionGroupCount.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) SetMathType deprecated

func (c ConvolutionDescriptor) SetMathType(mathType MathType) error

SetMathType allows the user to specify whether or not the use of tensor op is permitted in the library routines associated with a given convolution descriptor.

This function allows the user to specify whether or not the use of tensor op is permitted in the library routines associated with a given convolution descriptor.

A nil error means the math type was set successfully.

Errors:

  • ErrBadParam: Either an invalid convolution descriptor was provided or an invalid math type was specified.

Wraps cudnnSetConvolutionMathType.

Deprecated: Deprecated in cuDNN 9.0.

func (ConvolutionDescriptor) SetReorderType deprecated

func (c ConvolutionDescriptor) SetReorderType(reorderType ReorderType) error

SetReorderType sets the convolution reorder type for the given convolution descriptor.

This function sets the convolution reorder type for the given convolution descriptor.

  • reorderType: Input. Set the reorder type to this value. For more information, refer to ReorderType

A nil error means reorder type is set successfully.

Errors:

  • ErrBadParam: The reorder type supplied is not supported.

Wraps cudnnSetConvolutionReorderType.

Deprecated: Deprecated in cuDNN 9.0.

type ConvolutionFwdAlgo

type ConvolutionFwdAlgo int32

ConvolutionFwdAlgo is an enumerated type that exposes the different algorithms available to execute the forward convolution operation.

const (
	ConvolutionFwdAlgoImplicitGemm        ConvolutionFwdAlgo = 0 // This algorithm expresses the convolution as a matrix product without actually explicitly forming the matrix that holds the input tensor data.
	ConvolutionFwdAlgoImplicitPrecompGemm ConvolutionFwdAlgo = 1
	ConvolutionFwdAlgoGemm                ConvolutionFwdAlgo = 2 // This algorithm expresses convolution as an explicit matrix product. A significant memory workspace is needed to store the matrix that holds the input tensor data.
	ConvolutionFwdAlgoDirect              ConvolutionFwdAlgo = 3 // This algorithm expresses the convolution as a direct convolution (for example, without implicitly or explicitly doing a matrix multiplication).
	ConvolutionFwdAlgoFft                 ConvolutionFwdAlgo = 4 // This algorithm uses the Fast-Fourier Transform approach to compute the convolution. A significant memory workspace is needed to store intermediate results.
	ConvolutionFwdAlgoFftTiling           ConvolutionFwdAlgo = 5 // This algorithm uses the Fast-Fourier Transform approach but splits the inputs into tiles. A significant memory workspace is needed to store intermediate results but less than [ConvolutionFwdAlgoFft] for large size images.
	ConvolutionFwdAlgoWinograd            ConvolutionFwdAlgo = 6 // This algorithm uses the Winograd Transform approach to compute the convolution. A reasonably sized workspace is needed to store intermediate results.
	ConvolutionFwdAlgoWinogradNonfused    ConvolutionFwdAlgo = 7 // This algorithm uses the Winograd Transform approach to compute the convolution. A significant workspace may be needed to store intermediate results.
	ConvolutionFwdAlgoCount               ConvolutionFwdAlgo = 8
)

func (ConvolutionFwdAlgo) String

func (e ConvolutionFwdAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type ConvolutionFwdAlgoPerf deprecated

type ConvolutionFwdAlgoPerf struct {
	Algo        ConvolutionFwdAlgo
	Status      Result
	Time        float32
	Memory      uint
	Determinism Determinism
	MathType    MathType
	Reserved    [3]int32
}

ConvolutionFwdAlgoPerf is a structure containing performance results returned by Handle.FindConvolutionForwardAlgorithm or heuristic results returned by Handle.ConvolutionForwardAlgorithm. Data Members ConvolutionFwdAlgo algo The algorithm runs to obtain the associated performance metrics. Result status If any error occurs during the workspace allocation or timing of Handle.ConvolutionForward, this status will represent that error. Otherwise, this status will be the return status of Handle.ConvolutionForward. float time The execution time of Handle.ConvolutionForward (in milliseconds). size_t memory The workspace size (in bytes). Determinism determinism The determinism of the algorithm. MathType mathType The math type provided to the algorithm. int reserved[3] Reserved space for future properties. These are the pointers to the opaque struct types in the cudnn_cnn library.

Deprecated: Deprecated by NVIDIA. This structure is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this structure.

type ConvolutionMode deprecated

type ConvolutionMode int32

ConvolutionMode is an enumerated type used by ConvolutionDescriptor.Set2D to configure a convolution descriptor.

The filter used for the convolution can be applied in two different ways, corresponding mathematically to a convolution or to a cross-correlation. (A cross-correlation is equivalent to a convolution with its filter rotated by 180 degrees.).

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	Convolution      ConvolutionMode = 0 // In this mode, a convolution operation will be done when applying the filter to the images.
	CrossCorrelation ConvolutionMode = 1 // In this mode, a cross-correlation operation will be done when applying the filter to the images.
)

func (ConvolutionMode) String

func (e ConvolutionMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type DataType

type DataType int32

DataType is an enumerated type indicating the data type to which a tensor descriptor or filter descriptor refers.

const (
	DataFloat  DataType = 0 // The data is a 32-bit single-precision floating-point ( float).
	DataDouble DataType = 1 // The data is a 64-bit double-precision floating-point ( double).
	DataHalf   DataType = 2 // The data is a 16-bit floating-point.
	DataINT8   DataType = 3 // The data is an 8-bit signed integer.
	DataInt32  DataType = 4 // The data is a 32-bit signed integer.
	// DataInt8x4: The data is 32-bit elements each composed of 4 8-bit signed integers. This data type is only supported with the tensor format [TensorNchwVectC].
	//
	// Deprecated: Deprecated by NVIDIA.
	DataInt8x4 DataType = 5
	DataUint8  DataType = 6 // The data is an 8-bit unsigned integer.
	// DataUint8x4: The data is 32-bit elements each composed of 4 8-bit unsigned integers. This data type is only supported with the tensor format [TensorNchwVectC].
	//
	// Deprecated: Deprecated by NVIDIA.
	DataUint8x4 DataType = 7
	// DataInt8x32: The data is 32-element vectors, each element being an 8-bit signed integer. This data type is only supported with the tensor format [TensorNchwVectC]. Moreover, this data type can only be used with algo 1, meaning, [ConvolutionFwdAlgoImplicitPrecompGemm]. For more information, refer to [ConvolutionFwdAlgo].
	//
	// Deprecated: Use [ConvolutionFwdAlgo] instead.
	DataInt8x32         DataType = 8
	DataBfloat16        DataType = 9  // The data is a 16-bit quantity, with 7 mantissa bits, 8 exponent bits, and 1 sign bit.
	DataInt64           DataType = 10 // The data is a 64-bit signed integer.
	DataBoolean         DataType = 11 // The data is a boolean ( bool). Note that for type [TypeBoolean], elements are expected to be “packed”: that is, one byte contains 8 elements of type [TypeBoolean]. Further, within each byte, elements are indexed from the least significant bit to the most significant bit. For example, a 1 dimensional tensor of 8 elements containing 01001111 has value 1 for elements 0 through 3, 0 for elements 4 and 5, 1 for element 6 and 0 for element 7. Tensors with more than 8 elements simply use more bytes, where the order is also from least significant to most significant byte. Note, CUDA is little-endian, meaning that the least significant byte has the lower memory address address. For example, in the case of 16 elements, 01001111 11111100 has value 1 for elements 0 through 3, 0 for elements 4 and 5, 1 for element 6 and 0 for element 7, value 0 for elements 8 and 9, 1 for elements 10 through 15.
	DataFP8E4M3         DataType = 12 // The data is an 8-bit quantity, with 3 mantissa bits, 4 exponent bits, and 1 sign bit.
	DataFP8E5M2         DataType = 13 // The data is an 8-bit quantity, with 2 mantissa bits, 5 exponent bits, and 1 sign bit.
	DataFastFloatForFP8 DataType = 14 // The data type is a higher throughput but lower precision compute type (compared to [DataFloat]) used for FP8 tensor core operations.
	DataFP8E8M0         DataType = 15
	DataFP4E2M1         DataType = 16
	DataINT4            DataType = 17
	DataUint4           DataType = 18
	DataUint32          DataType = 19
	DataComplexFP32     DataType = 20
	DataComplexFP64     DataType = 21
)

func (DataType) String

func (e DataType) String() string

String returns the constant name, or a numeric representation for unknown values.

type Debug

type Debug struct {
	CudnnVersion uint32
	CudnnStatus  Result
	TimeSec      uint32
	TimeUsec     uint32
	TimeDelta    uint32
	Handle       Handle
	Stream       driver.Stream
	Pid          uint64
	Tid          uint64
	CudaDeviceId int32
	Reserved     [15]int32
}

Debug is a structure used by SetCallback and GetCallback containing the metadata, such as time, time since start, stream ID, process and thread ID, that the user may choose to print or store in customized callbacks.

type Determinism

type Determinism int32

Determinism is an enumerated type used to indicate if the computed results are deterministic (reproducible).

For more information, refer to Reproducibility (Determinism).

const (
	NonDeterministic Determinism = 0 // Results are not guaranteed to be reproducible.
	Deterministic    Determinism = 1 // Results are guaranteed to be reproducible.
)

func (Determinism) String

func (e Determinism) String() string

String returns the constant name, or a numeric representation for unknown values.

type DirectionMode

type DirectionMode int32

DirectionMode is an enumerated type used to specify the recurrence pattern.

const (
	Unidirectional DirectionMode = 0 // The network iterates recurrently from the first input to the last.
	Bidirectional  DirectionMode = 1 // Each layer of the network iterates recurrently from the first input to the last and separately from the last input to the first. The outputs of the two are concatenated at each iteration giving the output of the layer.
)

func (DirectionMode) String

func (e DirectionMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type DivNormMode

type DivNormMode int32

DivNormMode is an enumerated type used to specify the mode of operation in Handle.DivisiveNormalizationForward and Handle.DivisiveNormalizationBackward.

const (
	DivnormPrecomputedMeans DivNormMode = 0 // The means tensor data pointer is expected to contain means or other kernel convolution values precomputed by the user. The means pointer can also be NULL, in that case, it’s considered to be filled with zeroes. This is equivalent to spatial LRN. In the backward pass, the means are treated as independent inputs and the gradient over means is computed independently. In this mode, to yield a net gradient over the entire LCN computational graph, the destDiffMeans result should be backpropagated through the user’s means layer (which can be implemented using average pooling) and added to the destDiffData tensor produced by [Handle.DivisiveNormalizationBackward].
)

func (DivNormMode) String

func (e DivNormMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type DropoutDescriptor

type DropoutDescriptor uintptr

DropoutDescriptor is a pointer to an opaque structure holding the description of a dropout operation.

CreateDropoutDescriptor is used to create one instance, DropoutDescriptor.Set is used to initialize this instance, DropoutDescriptor.Close is used to destroy this instance, DropoutDescriptor.Get is used to query fields of a previously initialized instance, DropoutDescriptor.Restore is used to restore an instance to a previously saved off state.

func CreateDropoutDescriptor

func CreateDropoutDescriptor() (DropoutDescriptor, error)

CreateDropoutDescriptor creates a generic dropout descriptor object by allocating the memory needed to hold its opaque structure.

For more information, refer to DropoutDescriptor.

Errors:

Wraps cudnnCreateDropoutDescriptor.

func (*DropoutDescriptor) Close

func (d *DropoutDescriptor) Close() error

Close destroys a previously created dropout descriptor object.

If d is zero, Close returns nil. Otherwise Close sets d to zero when the call succeeds and leaves it unchanged when it fails. Only d is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyDropoutDescriptor.

func (DropoutDescriptor) Destroy deprecated

func (d DropoutDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use DropoutDescriptor.Close instead.

func (DropoutDescriptor) Get

func (d DropoutDescriptor) Get(handle Handle) (float32, uintptr, uint64, error)

Get queries the fields of a previously initialized dropout descriptor.

  • handle: Input. Handle to a previously created cuDNN context

Errors:

  • ErrBadParam: One or more of the arguments was an invalid pointer.

Wraps cudnnGetDropoutDescriptor.

func (DropoutDescriptor) Restore

func (d DropoutDescriptor) Restore(handle Handle, dropout float32, states driver.DevicePtr, stateSizeInBytes int, seed uint64) error

Restore restores a dropout descriptor to a previously saved-off state.

  • handle: Input. Handle to a previously created cuDNN context
  • dropout: Input. Probability with which the value from an input tensor is set to 0 when performing dropout
  • states: Input. Pointer to GPU memory that holds random number generator states initialized by a prior call to DropoutDescriptor.Set
  • stateSizeInBytes: Input. Size in bytes of buffer holding random number generator states
  • seed: Input. Seed used in prior calls to DropoutDescriptor.Set that initialized states buffer. Using a different seed from this has no effect. A change of seed, and subsequent update to random number generator states can be achieved by calling DropoutDescriptor.Set

Errors:

  • ErrInvalidValue: The states buffer size (as indicated in stateSizeInBytes) is too small.

Wraps cudnnRestoreDropoutDescriptor.

func (DropoutDescriptor) Set

func (d DropoutDescriptor) Set(handle Handle, dropout float32, states driver.DevicePtr, stateSizeInBytes int, seed uint64) error

Set initializes a previously created dropout descriptor object.

If the states argument is equal to NULL, then the random number generator states won’t be initialized, and only the dropout value will be set. The user is expected not to change the memory pointed at by states for the duration of the computation. When the states argument is not NULL, a cuRAND initialization kernel is invoked by DropoutDescriptor.Set. This kernel requires a substantial amount of GPU memory for the stack. Memory is released when the kernel finishes. The ErrAllocFailed status is returned when no sufficient free memory is available for the GPU stack.

  • handle: Input. Handle to a previously created cuDNN context
  • dropout: Input. The probability with which the value from input is set to zero during the dropout layer
  • states: Output. Pointer to user-allocated GPU memory that will hold random number generator states
  • stateSizeInBytes: Input. Specifies the size in bytes of the provided memory for the states
  • seed: Input. Seed used to initialize random number generator states

Errors:

Wraps cudnnSetDropoutDescriptor.

type ErrQueryMode

type ErrQueryMode int32

ErrQueryMode is an enumerated type passed to Handle.QueryRuntimeError to select the remote kernel error query mode.

const (
	ErrqueryRawcode     ErrQueryMode = 0 // Read the error storage location regardless of the kernel completion status.
	ErrqueryNonblocking ErrQueryMode = 1 // Report if all tasks in the user stream of the cuDNN handle were completed. If that is the case, report the remote kernel error code.
	ErrqueryBlocking    ErrQueryMode = 2 // Wait for all tasks to complete in the user stream before reporting the remote kernel error code.
)

func (ErrQueryMode) String

func (e ErrQueryMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type Filter4DConfig

type Filter4DConfig struct {
	DataType DataType
	// Type of format.
	Format TensorFormat
	// Number of output feature maps.
	K int32
	// Number of input feature maps.
	C int32
	// Height of each filter.
	H int32
	// Width of each filter.
	W int32
}

Filter4DConfig holds the settings FilterDescriptor.Get4D reports.

type FilterDescriptor deprecated

type FilterDescriptor uintptr

FilterDescriptor is a pointer to an opaque structure holding the description of a filter dataset.

CreateFilterDescriptor is used to create one instance, and FilterDescriptor.Set4D or FilterDescriptor.Set must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateFilterDescriptor deprecated

func CreateFilterDescriptor() (FilterDescriptor, error)

CreateFilterDescriptor creates a filter descriptor object by allocating the memory needed to hold its opaque structure.

This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. For more information, refer to FilterDescriptor.

Errors:

Wraps cudnnCreateFilterDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (*FilterDescriptor) Close deprecated

func (f *FilterDescriptor) Close() error

Close destroys a filter object.

This function destroys a filter object.

If f is zero, Close returns nil. Otherwise Close sets f to zero when the call succeeds and leaves it unchanged when it fails. Only f is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyFilterDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (FilterDescriptor) Destroy deprecated

func (f FilterDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use FilterDescriptor.Close instead.

func (FilterDescriptor) Get deprecated

func (f FilterDescriptor) Get(nbDimsRequested int) (DataType, TensorFormat, []int32, error)

Get queries a previously initialized FilterNd descriptor object.

This function queries a previously initialized FilterNd descriptor object.

  • nbDimsRequested: Input. Dimension of the expected filter descriptor. It is also the minimum size of the arrays filterDimA in order to be able to hold the results

Errors:

  • ErrBadParam: The parameter nbDimsRequested is negative.

Wraps cudnnGetFilterNdDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (FilterDescriptor) Get4D deprecated

func (f FilterDescriptor) Get4D() (Filter4DConfig, error)

Get4D queries the parameters of the previously initialized Filter4d descriptor object.

This function queries the parameters of the previously initialized Filter4d descriptor object.

Wraps cudnnGetFilter4dDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (FilterDescriptor) Set deprecated

func (f FilterDescriptor) Set(dataType DataType, format TensorFormat, filterDimA []int32) error

Set initializes a previously created filter descriptor object.

This function initializes a previously created filter descriptor object. The layout of the filters must be contiguous in memory. The tensor format TensorNhwc has limited support in Handle.ConvolutionForward, Handle.ConvolutionBackwardData, and Handle.ConvolutionBackwardFilter.

  • dataType: Input. Data type
  • format: Input. Type of the filter layout format. If this input is set to TensorNchw, which is one of the enumerant values allowed by TensorFormat descriptor, then the layout of the filter is as follows: For N=4, a 4D filter descriptor, the filter layout is in the form of KCRS: K represents the number of output feature maps C is the number of input feature maps R is the number of rows per filter S is the number of columns per filter For N=3, a 3D filter descriptor, the number S (number of columns per filter) is omitted. For N=5 and greater, the layout of the higher dimensions immediately follows RS. On the other hand, if this input is set to TensorNhwc, then the layout of the filter is as follows: For N=4, a 4D filter descriptor, the filter layout is in the form of KRSC. For N=3, a 3D filter descriptor, the number S (number of columns per filter) is omitted, and the layout of C immediately follows R. For N=5 and greater, the layout of the higher dimensions are inserted between S and C
  • filterDimA: Input. Array of dimension nbDims containing the size of the filter for each dimension

Errors:

  • ErrBadParam: At least one of the elements of the array filterDimA is negative or dataType or format has an invalid enumerant value.
  • ErrNotSupported: The parameter nbDims exceeds CUDNN_DIM_MAX.

Wraps cudnnSetFilterNdDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (FilterDescriptor) Set4D deprecated

func (f FilterDescriptor) Set4D(dataType DataType, format TensorFormat, k int32, c int32, h int32, w int32) error

Set4D initializes a previously created filter descriptor object into a 4D filter.

This function initializes a previously created filter descriptor object into a 4D filter. The layout of the filters must be contiguous in memory. Tensor format TensorNhwc has limited support in Handle.ConvolutionForward, Handle.ConvolutionBackwardData, and Handle.ConvolutionBackwardFilter.

  • dataType: Input. Data type
  • format: Input. Type of the filter layout format. If this input is set to TensorNchw, which is one of the enumerant values allowed by TensorFormat descriptor, then the layout of the filter is in the form of KCRS, where: K represents the number of output feature maps C is the number of input feature maps R is the number of rows per filter S is the number of columns per filter If this input is set to TensorNhwc, then the layout of the filter is in the form of KRSC
  • k: Input. Number of output feature maps
  • c: Input. Number of input feature maps
  • h: Input. Height of each filter
  • w: Input. Width of each filter

Errors:

  • ErrBadParam: At least one of the parameters k, c, h, w is negative or dataType or format has an invalid enumerant value.

Wraps cudnnSetFilter4dDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (FilterDescriptor) Size deprecated

func (f FilterDescriptor) Size() (int, error)

Size returns the size of the filter tensor in memory with respect to the given descriptor.

This function returns the size of the filter tensor in memory with respect to the given descriptor. It can be used to know the amount of GPU memory to be allocated to hold that filter tensor.

A nil error means filterDesc is valid.

Errors:

Wraps cudnnGetFilterSizeInBytes.

Deprecated: Deprecated in cuDNN 9.0.

type FoldingDirection

type FoldingDirection int32

FoldingDirection is an enumerated type used to select the folding direction.

For more information, refer to TensorTransformDescriptor. Data Member TransformFold = 0U Selects folding. TransformUnfold = 1U Selects unfolding.

const (
	TransformFold   FoldingDirection = 0
	TransformUnfold FoldingDirection = 1
)

func (FoldingDirection) String

func (e FoldingDirection) String() string

String returns the constant name, or a numeric representation for unknown values.

type ForwardMode

type ForwardMode int32

ForwardMode is an enumerated type to specify inference or training mode in RNN API.

This parameter allows the cuDNN library to tune more precisely the size of the workspace buffer that could be different in inference and training regimens.

const (
	FwdModeInference ForwardMode = 0 // Selects the inference mode.
	FwdModeTraining  ForwardMode = 1 // Selects the training mode.
)

func (ForwardMode) String

func (e ForwardMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type Fraction

type Fraction struct {
	Numerator   int64
	Denominator int64
}

Fraction is a structure that allows a user to define int64_t fractions.

These are the enumeration types for the cudnn_graph library.

type FusedOps deprecated

type FusedOps int32

FusedOps is an enumerated type to select a specific sequence of computations to perform in the fused operations. Members and Descriptions FusedScaleBiasActivationConvBnstats = 0 On a per-channel basis, it performs these operations in this order: scale, add bias, activation, convolution, and generate batchNorm statistics. cudnnFusedOps_tCUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD = 1 On a per-channel basis, it performs these operations in this order: scale, add bias, activation, convolution backward weights, and generate batchNorm statistics. cudnnFusedOps_tCUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING = 2 Computes the equivalent scale and bias from ySum, ySqSum, learned scale, and bias. Optionally, update running statistics and generate saved stats. FusedBnFinalizeStatisticsInference = 3 Computes the equivalent scale and bias from the learned running statistics and the learned scale and bias. FusedConvScaleBiasAddActivation = 4 On a per-channel basis, performs these operations in this order: convolution, scale, add bias, element-wise addition with another tensor, and activation. FusedScaleBiasAddActivationGenBitmask = 5 On a per-channel basis, performs these operations in this order: scale and bias on one tensor, scale and bias on a second tensor, element-wise addition of these two tensors, and on the resulting tensor performs activation and generates activation bit mask. FusedDactivationForkDbatchnorm = 6 On a per-channel basis, performs these operations in this order: backward activation, fork (meaning, write out gradient for the residual branch), and backward batch norm.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	FusedScaleBiasActivationConvBnstats   FusedOps = 0
	FusedScaleBiasActivationWgrad         FusedOps = 1
	FusedBnFinalizeStatisticsTraining     FusedOps = 2
	FusedBnFinalizeStatisticsInference    FusedOps = 3
	FusedConvScaleBiasAddActivation       FusedOps = 4
	FusedScaleBiasAddActivationGenBitmask FusedOps = 5
	FusedDactivationForkDbatchnorm        FusedOps = 6
)

func (FusedOps) String

func (e FusedOps) String() string

String returns the constant name, or a numeric representation for unknown values.

type FusedOpsConstParamLabel deprecated

type FusedOpsConstParamLabel int32

FusedOpsConstParamLabel is an enumerated type for the selection of the type of the cudnnFusedOps descriptor.

For more information, refer to FusedOpsConstParamPack.SetAttribute. Legend For Tables in FusedOpsConstParamLabel For the Attribute FusedScaleBiasActivationConvBnstats in FusedOpsVariantParamLabel Note As of cuDNN 7.6.0, if the following conditions in the table are met, then the fully fused fast path will be triggered. Otherwise, a slower partially fused path will be triggered. Conditions for Fully Fused Fast Path (Forward) for FusedOpsConstParamLabel For the attribute FusedScaleBiasActivationWgrad in FusedOpsConstParamLabel Note As of cuDNN 7.6.0, if the following conditions in the table are met, then the fully fused fast path will be triggered. Otherwise, a slower partially fused path will be triggered. Conditions for Fully Fused Fast Path (Backward) for FusedOpsConstParamLabel For the attribute FusedBnFinalizeStatisticsTraining in FusedOpsConstParamLabel For the attribute FusedBnFinalizeStatisticsInference in FusedOpsConstParamLabel The following operation performs the computation, where * denotes convolution operator: y=α₁(w*x)+α₂z+b For the attribute CUDNN_FUSED_CONVOLUTION_SCALE_BIAS_ADD_RELU in FusedOpsConstParamLabel

Deprecated: Use FusedOpsConstParamPack.SetAttribute instead. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	ParamXdesc                        FusedOpsConstParamLabel = 0
	ParamXdataPlaceholder             FusedOpsConstParamLabel = 1
	ParamBnMode                       FusedOpsConstParamLabel = 2
	ParamBnEqscalebiasDesc            FusedOpsConstParamLabel = 3
	ParamBnEqscalePlaceholder         FusedOpsConstParamLabel = 4
	ParamBnEqbiasPlaceholder          FusedOpsConstParamLabel = 5
	ParamActivationDesc               FusedOpsConstParamLabel = 6
	ParamConvDesc                     FusedOpsConstParamLabel = 7
	ParamWdesc                        FusedOpsConstParamLabel = 8
	ParamWdataPlaceholder             FusedOpsConstParamLabel = 9
	ParamDwdesc                       FusedOpsConstParamLabel = 10
	ParamDwdataPlaceholder            FusedOpsConstParamLabel = 11
	ParamYdesc                        FusedOpsConstParamLabel = 12
	ParamYdataPlaceholder             FusedOpsConstParamLabel = 13
	ParamDydesc                       FusedOpsConstParamLabel = 14
	ParamDydataPlaceholder            FusedOpsConstParamLabel = 15
	ParamYstatsDesc                   FusedOpsConstParamLabel = 16
	ParamYsumPlaceholder              FusedOpsConstParamLabel = 17
	ParamYsqsumPlaceholder            FusedOpsConstParamLabel = 18
	ParamBnScalebiasMeanvarDesc       FusedOpsConstParamLabel = 19
	ParamBnScalePlaceholder           FusedOpsConstParamLabel = 20
	ParamBnBiasPlaceholder            FusedOpsConstParamLabel = 21
	ParamBnSavedMeanPlaceholder       FusedOpsConstParamLabel = 22
	ParamBnSavedInvstdPlaceholder     FusedOpsConstParamLabel = 23
	ParamBnRunningMeanPlaceholder     FusedOpsConstParamLabel = 24
	ParamBnRunningVarPlaceholder      FusedOpsConstParamLabel = 25
	ParamZdesc                        FusedOpsConstParamLabel = 26
	ParamZdataPlaceholder             FusedOpsConstParamLabel = 27
	ParamBnZEqscalebiasDesc           FusedOpsConstParamLabel = 28
	ParamBnZEqscalePlaceholder        FusedOpsConstParamLabel = 29
	ParamBnZEqbiasPlaceholder         FusedOpsConstParamLabel = 30
	ParamActivationBitmaskDesc        FusedOpsConstParamLabel = 31
	ParamActivationBitmaskPlaceholder FusedOpsConstParamLabel = 32
	ParamDxdesc                       FusedOpsConstParamLabel = 33
	ParamDxdataPlaceholder            FusedOpsConstParamLabel = 34
	ParamDzdesc                       FusedOpsConstParamLabel = 35
	ParamDzdataPlaceholder            FusedOpsConstParamLabel = 36
	ParamBnDscalePlaceholder          FusedOpsConstParamLabel = 37
	ParamBnDbiasPlaceholder           FusedOpsConstParamLabel = 38
)

func (FusedOpsConstParamLabel) String

func (e FusedOpsConstParamLabel) String() string

String returns the constant name, or a numeric representation for unknown values.

type FusedOpsConstParamPack deprecated

type FusedOpsConstParamPack uintptr

FusedOpsConstParamPack is a pointer to an opaque structure holding the description of the cudnnFusedOps constant parameters. Use the function CreateFusedOpsConstParamPack to create one instance of this structure, and the function FusedOpsConstParamPack.Close to destroy a previously-created descriptor.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateFusedOpsConstParamPack deprecated

func CreateFusedOpsConstParamPack(ops FusedOps) (FusedOpsConstParamPack, error)

CreateFusedOpsConstParamPack creates an opaque structure to store the various problem size information, such as the shape, layout and the type of tensors, and the descriptors for convolution and activation, for the selected sequence of cudnnFusedOps computations.

This function creates an opaque structure to store the various problem size information, such as the shape, layout and the type of tensors, and the descriptors for convolution and activation, for the selected sequence of cudnnFusedOps computations.

  • ops: Input. The specific sequence of computations to perform in the cudnnFusedOps computations, as defined in the enumerant type FusedOps

A nil error means the descriptor is created successfully.

Errors:

Wraps cudnnCreateFusedOpsConstParamPack.

Deprecated: Deprecated in cuDNN 9.0.

func (FusedOpsConstParamPack) Attribute deprecated

func (f FusedOpsConstParamPack) Attribute(paramLabel FusedOpsConstParamLabel, param unsafe.Pointer) (int32, error)

Attribute retrieves the values of the descriptor pointed to by the param pointer input.

The type of the descriptor is indicated by the enum value of paramLabel input.

  • paramLabel: Input. Several types of descriptors can be retrieved by this getter function. The param input points to the descriptor itself, and this input indicates the type of the descriptor pointed to by the param input. The FusedOpsConstParamLabel enumerant type enables the selection of the type of the descriptor. Refer to the param description below
  • param: Input. Data pointer to the host memory associated with the descriptor that should be retrieved. The type of this descriptor depends on the value of paramLabel. For the given paramLabel, if the associated value inside the constPack is set to NULL or by default NULL, then cuDNN will copy the value or the opaque structure in the constPack to the host memory buffer pointed to by param. For more information, refer to the table in FusedOpsConstParamLabel

A nil error means the descriptor values are retrieved successfully.

Errors:

  • ErrBadParam: If either constPack, param, or isNULL is NULL; or if paramLabel is invalid.

Wraps cudnnGetFusedOpsConstParamPackAttribute.

Deprecated: Deprecated by NVIDIA.

func (*FusedOpsConstParamPack) Close deprecated

func (f *FusedOpsConstParamPack) Close() error

Close destroys a previously-created FusedOpsConstParamPack structure.

This function destroys a previously-created FusedOpsConstParamPack structure.

Errors:

If f is zero, Close returns nil. Otherwise Close sets f to zero when the call succeeds and leaves it unchanged when it fails. Only f is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyFusedOpsConstParamPack.

Deprecated: Deprecated in cuDNN 9.0.

func (FusedOpsConstParamPack) Destroy deprecated

func (f FusedOpsConstParamPack) Destroy() error

Destroy calls Close.

Deprecated: Use FusedOpsConstParamPack.Close instead.

func (FusedOpsConstParamPack) SetAttribute deprecated

func (f FusedOpsConstParamPack) SetAttribute(paramLabel FusedOpsConstParamLabel, param unsafe.Pointer) error

SetAttribute sets the descriptor pointed to by the param pointer input.

This function sets the descriptor pointed to by the param pointer input. The type of the descriptor to be set is indicated by the enum value of the paramLabel input.

  • paramLabel: Input. Several types of descriptors can be set by this setter function. The param input points to the descriptor itself, and this input indicates the type of the descriptor pointed to by the param input. The FusedOpsConstParamPack enumerant type enables the selection of the type of the descriptor
  • param: Input. Data pointer to the host memory, associated with the specific descriptor. The type of the descriptor depends on the value of paramLabel. For more information, refer to the table in FusedOpsConstParamPack. If this pointer is set to NULL, then the cuDNN library will record as such. If not, then the values pointed to by this pointer (meaning, the value or the opaque structure underneath) will be copied into the constPack during FusedOpsConstParamPack.SetAttribute operation

A nil error means the descriptor is set successfully.

Errors:

  • ErrBadParam: If constPack is NULL, or if paramLabel or the ops setting for constPack is invalid.

Wraps cudnnSetFusedOpsConstParamPackAttribute.

Deprecated: Deprecated in cuDNN 9.0.

type FusedOpsPlan deprecated

type FusedOpsPlan uintptr

FusedOpsPlan is a pointer to an opaque structure holding the description of the cudnnFusedOpsPlan.

This descriptor contains the plan information, including the problem type and size, which kernels should be run, and the internal workspace partition. Use the function CreateFusedOpsPlan to create one instance of this structure, and the function FusedOpsPlan.Close to destroy a previously-created descriptor.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateFusedOpsPlan deprecated

func CreateFusedOpsPlan(ops FusedOps) (FusedOpsPlan, error)

CreateFusedOpsPlan creates the plan descriptor for the cudnnFusedOps computation.

This function creates the plan descriptor for the cudnnFusedOps computation. This descriptor contains the plan information, including the problem type and size, which kernels should be run, and the internal workspace partition.

  • ops: Input. The specific sequence of fused operations computations for which this plan descriptor should be created. For more information, refer to FusedOps

A nil error means the plan descriptor is created successfully.

Errors:

  • ErrAllocFailed: The resources could not be allocated.
  • ErrBadParam: If either the input *plan is NULL or the ops input is not a valid cudnnFusedOp enum.

Wraps cudnnCreateFusedOpsPlan.

Deprecated: Deprecated in cuDNN 9.0.

func (*FusedOpsPlan) Close deprecated

func (f *FusedOpsPlan) Close() error

Close destroys the plan descriptor provided.

This function destroys the plan descriptor provided.

A nil error means either the plan descriptor is NULL or the descriptor was successfully destroyed.

If f is zero, Close returns nil. Otherwise Close sets f to zero when the call succeeds and leaves it unchanged when it fails. Only f is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyFusedOpsPlan.

Deprecated: Deprecated in cuDNN 9.0.

func (FusedOpsPlan) Destroy deprecated

func (f FusedOpsPlan) Destroy() error

Destroy calls Close.

Deprecated: Use FusedOpsPlan.Close instead.

type FusedOpsPointerPlaceHolder deprecated

type FusedOpsPointerPlaceHolder int32

FusedOpsPointerPlaceHolder is an enumerated type used to select the alignment type of the cudnnFusedOps descriptor pointer. Members and Descriptions PtrNull = 0 Indicates that the pointer to the tensor in the variantPack will be NULL. PtrElemAligned = 1 Indicates that the pointer to the tensor in the variantPack will not be NULL, and will have element alignment. Ptr16BAligned = 2 Indicates that the pointer to the tensor in the variantPack will not be NULL, and will have 16 byte alignment.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	PtrNull        FusedOpsPointerPlaceHolder = 0
	PtrElemAligned FusedOpsPointerPlaceHolder = 1
	Ptr16BAligned  FusedOpsPointerPlaceHolder = 2
)

func (FusedOpsPointerPlaceHolder) String

String returns the constant name, or a numeric representation for unknown values.

type FusedOpsVariantParamLabel deprecated

type FusedOpsVariantParamLabel int32

FusedOpsVariantParamLabel is an enumerated type that is used to set the buffer pointers.

These buffer pointers can be changed in each iteration. Legend For Tables in FusedOpsVariantParamLabel For the Attribute FusedScaleBiasActivationConvBnstats in FusedOpsConstParamLabel Note For the attribute FusedScaleBiasActivationWgrad in FusedOpsVariantParamLabel Note For the attribute FusedBnFinalizeStatisticsTraining in FusedOpsVariantParamLabel Note For the attribute FusedBnFinalizeStatisticsInference in FusedOpsVariantParamLabel Note For the attribute FusedBnFinalizeStatisticsInference in FusedOpsVariantParamLabel Note.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	PtrXdata                        FusedOpsVariantParamLabel = 0
	PtrBnEqscale                    FusedOpsVariantParamLabel = 1
	PtrBnEqbias                     FusedOpsVariantParamLabel = 2
	PtrWdata                        FusedOpsVariantParamLabel = 3
	PtrDwdata                       FusedOpsVariantParamLabel = 4
	PtrYdata                        FusedOpsVariantParamLabel = 5
	PtrDydata                       FusedOpsVariantParamLabel = 6
	PtrYsum                         FusedOpsVariantParamLabel = 7
	PtrYsqsum                       FusedOpsVariantParamLabel = 8
	PtrWorkspace                    FusedOpsVariantParamLabel = 9
	PtrBnScale                      FusedOpsVariantParamLabel = 10
	PtrBnBias                       FusedOpsVariantParamLabel = 11
	PtrBnSavedMean                  FusedOpsVariantParamLabel = 12
	PtrBnSavedInvstd                FusedOpsVariantParamLabel = 13
	PtrBnRunningMean                FusedOpsVariantParamLabel = 14
	PtrBnRunningVar                 FusedOpsVariantParamLabel = 15
	PtrZdata                        FusedOpsVariantParamLabel = 16
	PtrBnZEqscale                   FusedOpsVariantParamLabel = 17
	PtrBnZEqbias                    FusedOpsVariantParamLabel = 18
	PtrActivationBitmask            FusedOpsVariantParamLabel = 19
	PtrDxdata                       FusedOpsVariantParamLabel = 20
	PtrDzdata                       FusedOpsVariantParamLabel = 21
	PtrBnDscale                     FusedOpsVariantParamLabel = 22
	PtrBnDbias                      FusedOpsVariantParamLabel = 23
	ScalarSizeTWorkspaceSizeInBytes FusedOpsVariantParamLabel = 100
	ScalarInt64TBnAccumulationCount FusedOpsVariantParamLabel = 101
	ScalarDoubleBnExpAvgFactor      FusedOpsVariantParamLabel = 102
	ScalarDoubleBnEpsilon           FusedOpsVariantParamLabel = 103
)

func (FusedOpsVariantParamLabel) String

func (e FusedOpsVariantParamLabel) String() string

String returns the constant name, or a numeric representation for unknown values.

type FusedOpsVariantParamPack deprecated

type FusedOpsVariantParamPack uintptr

FusedOpsVariantParamPack is a pointer to an opaque structure holding the description of the cudnnFusedOps variant parameters. Use the function CreateFusedOpsVariantParamPack to create one instance of this structure, and the function FusedOpsVariantParamPack.Close to destroy a previously-created descriptor. These are the enumeration types in the cudnn_cnn library.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateFusedOpsVariantParamPack deprecated

func CreateFusedOpsVariantParamPack(ops FusedOps) (FusedOpsVariantParamPack, error)

CreateFusedOpsVariantParamPack creates the variant pack descriptor for the cudnnFusedOps computation.

This function creates the variant pack descriptor for the cudnnFusedOps computation.

  • ops: Input. The specific sequence of fused operations computations for which this descriptor should be created

Errors:

Wraps cudnnCreateFusedOpsVariantParamPack.

Deprecated: Deprecated in cuDNN 9.0.

func (FusedOpsVariantParamPack) Attribute deprecated

func (f FusedOpsVariantParamPack) Attribute(paramLabel FusedOpsVariantParamLabel, ptr uintptr) error

Attribute retrieves the settings of the variable parameter pack descriptor.

  • paramLabel: Input. Type of the buffer pointer parameter (in the varPack descriptor). For more information, refer to FusedOpsConstParamLabel. The retrieved descriptor values vary according to this type
  • ptr: Output. Pointer to the host or device memory where the retrieved value is written by this function. The data type of the pointer, and the host/device memory location, depend on the paramLabel input selection. For more information, refer to FusedOpsVariantParamLabel

A nil error means the descriptor values are retrieved successfully.

Errors:

  • ErrBadParam: If either varPack or ptr is NULL, or if paramLabel is set to invalid value.

Wraps cudnnGetFusedOpsVariantParamPackAttribute.

Deprecated: Deprecated by NVIDIA.

func (*FusedOpsVariantParamPack) Close deprecated

func (f *FusedOpsVariantParamPack) Close() error

Close destroys a previously-created descriptor for cudnnFusedOps constant parameters.

This function destroys a previously-created descriptor for cudnnFusedOps constant parameters.

A nil error means the descriptor was successfully destroyed.

If f is zero, Close returns nil. Otherwise Close sets f to zero when the call succeeds and leaves it unchanged when it fails. Only f is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyFusedOpsVariantParamPack.

Deprecated: Deprecated in cuDNN 9.0.

func (FusedOpsVariantParamPack) Destroy deprecated

func (f FusedOpsVariantParamPack) Destroy() error

Destroy calls Close.

Deprecated: Use FusedOpsVariantParamPack.Close instead.

func (FusedOpsVariantParamPack) SetAttribute deprecated

func (f FusedOpsVariantParamPack) SetAttribute(paramLabel FusedOpsVariantParamLabel, ptr uintptr) error

SetAttribute sets the variable parameter pack descriptor.

This function sets the variable parameter pack descriptor.

  • paramLabel: Input. Type to which the buffer pointer parameter (in the varPack descriptor) is set by this function. For more information, refer to FusedOpsConstParamLabel
  • ptr: Input. Pointer to the host or device memory, to the value to which the descriptor parameter is set. The data type of the pointer, and the host/device memory location, depend on the paramLabel input selection. For more information, refer to FusedOpsVariantParamLabel

A nil error means the descriptor is set successfully.

Errors:

  • ErrBadParam: If varPack is NULL or if paramLabel is set to an unsupported value.

Wraps cudnnSetFusedOpsVariantParamPackAttribute.

Deprecated: Deprecated in cuDNN 9.0.

type GenStatsMode

type GenStatsMode int32

GenStatsMode is an enumerated type to indicate the statistics mode in the backend statistics generation operation.

const (
	GenstatsSumSqsum GenStatsMode = 0 // In this mode, the sum and sum of squares of the input tensor along the specified dimensions are computed and written out. The reduction dimensions currently supported are limited per channel, however additional support may be added upon request.
)

func (GenStatsMode) String

func (e GenStatsMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type Graph

type Graph uintptr

Graph is an opaque handle to a CUDA graph.

type Handle

type Handle uintptr

Handle is a pointer to an opaque structure holding the cuDNN library context.

The cuDNN library context must be created using Create and the returned handle must be passed to all subsequent library function calls. The context should be destroyed at the end using Handle.Close. The context is associated with only one GPU device, the current device at the time of the call to Create. However, multiple contexts can be created on the same GPU device.

func Create

func Create() (Handle, error)

Create initializes the cuDNN library and creates a handle to an opaque structure holding the cuDNN library context.

It allocates hardware resources on the host and device and must be called prior to making any other cuDNN library calls. The cuDNN library handle is tied to the current CUDA device (context). To use the library on multiple devices, one cuDNN handle needs to be created for each device. For a given device, multiple cuDNN handles with different configurations (for example, different current CUDA streams) may be created. Because Create allocates some internal resources, the release of those resources by calling Handle.Close will implicitly call cudaDeviceSynchronize; therefore, the recommended best practice is to call Create or Handle.Close outside of performance-critical code paths. For multithreaded applications that use the same device from different threads, the recommended programming model is to create one (or a few, as is convenient) cuDNN handles per thread and use that cuDNN handle for the entire life of the thread.

A nil error means cuDNN handle was created successfully.

Errors:

Wraps cudnnCreate.

func (Handle) ActivationBackward deprecated

func (h Handle) ActivationBackward(activationDesc ActivationDescriptor, alpha unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, dxDesc TensorDescriptor, dx driver.DevicePtr) error

ActivationBackward computes the gradient of a neuron activation function.

In-place operation is allowed for this routine; meaning dy and dx pointers may be equal. However, this requires the corresponding tensor descriptors to be identical (particularly, the strides of the input and output must match for an in-place operation to be allowed). All tensor formats are supported for 4 and 5 dimensions, however, the best performance is obtained when the strides of yDesc and xDesc are equal and HW-packed. For more than 5 dimensions the tensors must have their spatial dimensions packed.

  • activationDesc: Input. Activation descriptor. For more information, refer to ActivationDescriptor
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized input tensor descriptor. For more information, refer to TensorDescriptor
  • y: Input. Data pointer to GPU memory associated with the tensor descriptor yDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyDesc
  • xDesc: Input. Handle to the previously initialized output tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the output tensor descriptor xDesc
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dxDesc: Input. Handle to the previously initialized output differential tensor descriptor
  • dx: Output. Data pointer to GPU memory associated with the output tensor descriptor dxDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The strides nStride, cStride, hStride, wStride of the input differential tensor and output differential tensor differ and in-place operation is used.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Refer to the following for some examples of non-supported configurations: The dimensions n, c, h, and w of the input tensor and output tensor differ. The datatype of the input tensor and output tensor differs. The strides nStride, cStride, hStride, and wStride of the input tensor and the input differential tensor differ. The strides nStride, cStride, hStride, and wStride of the output tensor and the output differential tensor differ.

Wraps cudnnActivationBackward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ActivationForward deprecated

func (h Handle) ActivationForward(activationDesc ActivationDescriptor, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

ActivationForward applies a specified neuron activation function element-wise over each input value.

In-place operation is allowed for this routine; meaning, xData and yData pointers may be equal. However, this requires xDesc and yDesc descriptors to be identical (particularly, the strides of the input and output must match for an in-place operation to be allowed). All tensor formats are supported for 4 and 5 dimensions, however, the best performance is obtained when the strides of xDesc and yDesc are equal and HW-packed. For more than 5 dimensions the tensors must have their spatial dimensions packed.

  • activationDesc: Input. Activation descriptor. For more information, refer to ActivationDescriptor
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to the previously initialized input tensor descriptor. For more information, refer to TensorDescriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized input tensor descriptor
  • y: Input. Data pointer to GPU memory associated with the tensor descriptor yDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The parameter mode has an invalid enumerant value. The dimensions n, c, h, w of the input tensor and output tensor differ. The datatype of the input tensor and output tensor differs. The strides nStride, cStride, hStride, wStride of the input tensor and output tensor differ and in-place operation is used (meaning, x and y pointers are equal).
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnActivationForward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) AddTensor deprecated

AddTensor adds the scaled values of a bias tensor to another tensor.

This function adds the scaled values of a bias tensor to another tensor. Each dimension of the bias tensor A must match the corresponding dimension of the destination tensor C or must be equal to 1. In the latter case, the same value from the bias tensor for those dimensions will be used to blend into the C tensor. Only 4D and 5D tensors are supported. Beyond these dimensions, this routine is not supported.

  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the source value with the prior value in the destination tensor as follows: For more information, refer to Scaling Parameters
  • aDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • a: Input. Pointer to data of the tensor described by the aDesc descriptor
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the source value with the prior value in the destination tensor as follows: For more information, refer to Scaling Parameters
  • cDesc: Input. Handle to a previously initialized tensor descriptor
  • c: Input/Output. Pointer to data of the tensor described by the cDesc descriptor

Errors:

  • ErrBadParam: The dimensions of the bias tensor refer to an amount of data that is incompatible with the output tensor dimensions or the dataType of the two tensor descriptors are different.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnAddTensor.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationBackward deprecated

func (h Handle) BatchNormalizationBackward(mode BatchNormMode, alphaDataDiff unsafe.Pointer, betaDataDiff unsafe.Pointer, alphaParamDiff unsafe.Pointer, betaParamDiff unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, dxDesc TensorDescriptor, dx driver.DevicePtr, dBnScaleBiasDesc TensorDescriptor, bnScale driver.DevicePtr, dBnScaleResult driver.DevicePtr, dBnBiasResult driver.DevicePtr, epsilon float64, savedMean driver.DevicePtr, savedInvVariance driver.DevicePtr) error

BatchNormalizationBackward performs the backward batch normalization layer computation.

This function performs the backward batch normalization layer computation. This layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The epsilon value has to be the same during training, backpropagation, and inference. Higher performance can be obtained when HW-packed tensors are used for all of x, dy, and dx. For more information, refer to TensorDescriptor.DeriveBN for the secondary tensor descriptor generation for the parameters used in this function. Supported Configurations This function supports the following combinations of data types for various descriptors.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • alphaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alphaDataDiff[0]*resultValue + betaDataDiff[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alphaDataDiff[0]*resultValue + betaDataDiff[0]*priorDstValue. For more information, refer to Scaling Parameters
  • alphaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs resultBnScaleDiff and resultBnBiasDiff with prior values in the destination tensor as follows: dstValue = alphaParamDiff[0]*resultValue + betaParamDiff[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs resultBnScaleDiff and resultBnBiasDiff with prior values in the destination tensor as follows: dstValue = alphaParamDiff[0]*resultValue + betaParamDiff[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handles to the previously initialized tensor descriptors
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc, for the layer’s x data
  • dyDesc: Input. Handles to the previously initialized tensor descriptors
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyDesc, for the backpropagated differential dy input
  • dxDesc: Input. Handles to the previously initialized tensor descriptors
  • dx: Input/Output. Data pointer to GPU memory associated with the tensor descriptor dxDesc, for the resulting differential output with respect to x
  • bnScale: Input. Pointer in the device memory for the batch normalization scale parameter (in the original paper the quantity scale is referred to as gamma). Note: The bnBias parameter is not needed for this layer’s computation
  • epsilon: Input. Epsilon value used in batch normalization formula. Its value should be equal to or greater than the value defined for CUDNN_BN_MIN_EPSILON in cudnn.h. The same epsilon value should be used in forward and backward functions
  • savedMean: Input. Optional cache parameters containing saved intermediate results that were computed during the forward pass. For this to work correctly, the layer’s x and bnScale data have to remain unchanged until this backward function is called. Note: Both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • savedInvVariance: Input. Optional cache parameters containing saved intermediate results that were computed during the forward pass. For this to work correctly, the layer’s x and bnScale data have to remain unchanged until this backward function is called. Note: Both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small

Errors:

  • ErrBadParam: At least one of the following conditions are met: Any of the pointers alpha, beta, x, dy, dx, bnScale, resultBnScaleDiff, and resultBnBiasDiff is NULL. The number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). bnScaleBiasDiffDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of savedMean, savedInvVariance pointers is NULL. epsilon value is less than CUDNN_BN_MIN_EPSILON. Dimensions or data types mismatch for any pair of xDesc, dyDesc, or dxDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnBatchNormalizationBackward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationBackwardEx deprecated

func (h Handle) BatchNormalizationBackwardEx(mode BatchNormMode, bnOps BatchNormOps, alphaDataDiff unsafe.Pointer, betaDataDiff unsafe.Pointer, alphaParamDiff unsafe.Pointer, betaParamDiff unsafe.Pointer, xDesc TensorDescriptor, xData driver.DevicePtr, yDesc TensorDescriptor, yData driver.DevicePtr, dyDesc TensorDescriptor, dyData driver.DevicePtr, dzDesc TensorDescriptor, dzData driver.DevicePtr, dxDesc TensorDescriptor, dxData driver.DevicePtr, dBnScaleBiasDesc TensorDescriptor, bnScaleData driver.DevicePtr, bnBiasData driver.DevicePtr, dBnScaleData driver.DevicePtr, dBnBiasData driver.DevicePtr, epsilon float64, savedMean driver.DevicePtr, savedInvVariance driver.DevicePtr, activationDesc ActivationDescriptor, workSpace driver.DevicePtr, workSpaceSizeInBytes int, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int) error

BatchNormalizationBackwardEx is an extension of the Handle.BatchNormalizationBackward for performing the backward batch normalization layer computation with a fast NHWC semi-persistent kernel.

This function is an extension of the Handle.BatchNormalizationBackward for performing the backward batch normalization layer computation with a fast NHWC semi-persistent kernel. This API will trigger the new semi-persistent NHWC kernel when the following conditions are true: If workspace is NULL and workSpaceSizeInBytes of zero is passed in, this API will function exactly like the non-extended function Handle.BatchNormalizationBackward. This workspace is not required to be clean. Moreover, the workspace does not have to remain unchanged between the forward and backward pass, as it is not used for passing any information. This extended function can accept a *workspace pointer to the GPU workspace, and workSpaceSizeInBytes, the size of the workspace, from the user. The bnOps input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation. Only 4D and 5D tensors are supported. The epsilon value has to be the same during the training, the backpropagation, and the inference. When the tensor layout is NCHW, higher performance can be obtained when HW-packed tensors are used for x, dy, and dx. Supported Configurations This function supports the following combinations of data types for various descriptors.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • bnOps: Input. Mode of operation. Currently, BatchnormOpsBnActivation and BatchnormOpsBnAddActivation are only supported in the NHWC layout. For more information, refer to BatchNormOps. This input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation
  • alphaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • alphaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dBnScaleData and dBnBiasData with prior values in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dBnScaleData and dBnBiasData with prior values in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if bnOps is set to BatchnormOpsBn, users may pass NULL. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if bnOps is set to BatchnormOpsBn, users may pass NULL. For more information, refer to TensorDescriptor
  • yData: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if bnOps is set to BatchnormOpsBn, users may pass NULL. For more information, refer to TensorDescriptor
  • dyDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if bnOps is set to BatchnormOpsBn, users may pass NULL. For more information, refer to TensorDescriptor
  • dyData: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if bnOps is set to BatchnormOpsBn, users may pass NULL. For more information, refer to TensorDescriptor
  • dzDesc: Input. Tensor descriptors and pointers in the device memory for the computed gradient output dz, and dx. dzDesc is not needed when bnOps is BatchnormOpsBn or BatchnormOpsBnActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dzData: Output. Tensor descriptors and pointers in the device memory for the computed gradient output dz, and dx. *dzData is not needed when bnOps is BatchnormOpsBn or BatchnormOpsBnActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dxDesc: Input. Tensor descriptors and pointers in the device memory for the computed gradient output dz, and dx. dzDesc is not needed when bnOps is BatchnormOpsBn or BatchnormOpsBnActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dxData: Output. Tensor descriptors and pointers in the device memory for the computed gradient output dz, and dx. *dzData is not needed when bnOps is BatchnormOpsBn or BatchnormOpsBnActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dBnScaleBiasDesc: Input. Shared tensor descriptor for the following six tensors: bnScaleData, bnBiasData, dBnScaleData, dBnBiasData, savedMean, and savedInvVariance. For more information, refer to TensorDescriptor.DeriveBN. The dimensions for this tensor descriptor are dependent on normalization mode. Note: The data type of this tensor descriptor must be float for FP16 and FP32 input tensors and double for FP64 input tensors. For more information, refer to TensorDescriptor
  • bnScaleData: Input. Pointer in the device memory for the batch normalization scale parameter (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, the quantity scale is referred to as gamma)
  • bnBiasData: Input. Pointers in the device memory for the batch normalization bias parameter (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta). This parameter is used only when activation should be performed
  • dBnScaleData: Output. Pointers in the device memory for the gradients of bnScaleData and bnBiasData, respectively
  • dBnBiasData: Output. Pointers in the device memory for the gradients of bnScaleData and bnBiasData, respectively
  • epsilon: Input. Epsilon value used in batch normalization formula. Its value should be equal to or greater than the value defined for CUDNN_BN_MIN_EPSILON in cudnn.h. The same epsilon value should be used in forward and backward functions
  • savedMean: Input. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and bnScaleData, bnBiasData data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • savedInvVariance: Input. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and bnScaleData, bnBiasData data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • activationDesc: Input. Descriptor for the activation operation. When the bnOps input is set to either BatchnormOpsBnActivation or BatchnormOpsBnAddActivation then this activation is used, otherwise the user may pass NULL
  • workSpace: Input. Pointer to the GPU workspace. If workspace is NULL and workSpaceSizeInBytes of zero is passed in, then this API will function exactly like the non-extended function Handle.BatchNormalizationBackward
  • workSpaceSizeInBytes: Input. The size of the workspace. It must be large enough to trigger the fast NHWC semi-persistent kernel by this function
  • reserveSpace: Input. Pointer to the GPU workspace for the reserveSpace
  • reserveSpaceSizeInBytes: Input. The size of the reserveSpace. It must be equal or larger than the amount required by Handle.BatchNormalizationTrainingExReserveSpaceSize

Errors:

  • ErrBadParam: At least one of the following conditions are met: Any of the pointers alphaDataDiff, betaDataDiff, alphaParamDiff, betaParamDiff, x, dy, dx, bnScale, resultBnScaleDiff, and resultBnBiasDiff is NULL. The number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). dBnScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of savedMean, savedInvVariance pointers is NULL. epsilon value is less than CUDNN_BN_MIN_EPSILON. Dimensions or data types mismatch for any pair of xDesc, dyDesc, and dxDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnBatchNormalizationBackwardEx.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationBackwardExWorkspaceSize deprecated

func (h Handle) BatchNormalizationBackwardExWorkspaceSize(mode BatchNormMode, bnOps BatchNormOps, xDesc TensorDescriptor, yDesc TensorDescriptor, dyDesc TensorDescriptor, dzDesc TensorDescriptor, dxDesc TensorDescriptor, dBnScaleBiasDesc TensorDescriptor, activationDesc ActivationDescriptor) (int, error)

BatchNormalizationBackwardExWorkspaceSize returns the amount of GPU memory workspace the user should allocate to be able to call Handle.BatchNormalizationBackwardExWorkspaceSize function for the specified bnOps input setting.

The workspace allocated will then be passed to the function Handle.BatchNormalizationBackwardExWorkspaceSize.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • bnOps: Input. Mode of operation for the fast NHWC kernel. For more information, refer to BatchNormOps. This input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dyDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dzDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dxDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dBnScaleBiasDesc: Input. Shared tensor descriptor for the following six tensors: bnScaleData, bnBiasData, dBnScaleData, dBnBiasData, savedMean, and savedInvVariance. This is the shared tensor descriptor desc for the secondary tensor that was derived by TensorDescriptor.DeriveBN. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors
  • activationDesc: Input. Descriptor for the activation operation. When the bnOps input is set to either BatchnormOpsBnActivation or BatchnormOpsBnAddActivation, then this activation is used, otherwise user may pass NULL

Errors:

  • ErrBadParam: At least one of the following conditions are met: Number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). dBnScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Dimensions or data types mismatch for any pair of xDesc, dyDesc, or dxDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetBatchNormalizationBackwardExWorkspaceSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) BatchNormalizationForwardInference deprecated

func (h Handle) BatchNormalizationForwardInference(mode BatchNormMode, alpha unsafe.Pointer, beta unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, yDesc TensorDescriptor, y driver.DevicePtr, bnScaleBiasMeanVarDesc TensorDescriptor, bnScale driver.DevicePtr, bnBias driver.DevicePtr, estimatedMean driver.DevicePtr, estimatedVariance driver.DevicePtr, epsilon float64) error

BatchNormalizationForwardInference performs the forward batch normalization layer computation for the inference phase.

This function performs the forward batch normalization layer computation for the inference phase. This layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The input transformation performed by this function is defined as: The epsilon value has to be the same during training, backpropagation and inference. For the training phase, refer to Handle.BatchNormalizationForwardTraining. Higher performance can be obtained when HW-packed tensors are used for all of x and dx. For more information, refer to TensorDescriptor.DeriveBN for the secondary tensor descriptor generation for the parameters used in this function. Supported Configurations This function supports the following combinations of data types for various descriptors.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handles to the previously initialized tensor descriptors
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc, for the layer’s x input data
  • yDesc: Input. Handles to the previously initialized tensor descriptors
  • y: Input/Output. Data pointer to GPU memory associated with the tensor descriptor yDesc, for the y output of the batch normalization layer
  • bnScaleBiasMeanVarDesc: Input. Tensor descriptors and pointers in device memory for the batch normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • bnScale: Input. Tensor descriptors and pointers in device memory for the batch normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • bnBias: Input. Tensor descriptors and pointers in device memory for the batch normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • estimatedMean: Input. Mean and variance tensors (these have the same descriptor as the bias and scale). The resultRunningMean and resultRunningVariance, accumulated during the training phase from the Handle.BatchNormalizationForwardTraining call, should be passed as inputs here
  • estimatedVariance: Input. Mean and variance tensors (these have the same descriptor as the bias and scale). The resultRunningMean and resultRunningVariance, accumulated during the training phase from the Handle.BatchNormalizationForwardTraining call, should be passed as inputs here
  • epsilon: Input. Epsilon value used in batch normalization formula. Its value should be equal to or greater than the value defined for CUDNN_BN_MIN_EPSILON in cudnn.h. The same epsilon value should be used in forward and backward functions

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the pointers alpha, beta, x, y, bnScale, bnBias, estimatedMean, and estimatedInvVariance is NULL. The number of xDesc or yDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported.) bnScaleBiasMeanVarDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. epsilon value is less than CUDNN_BN_MIN_EPSILON. Dimensions or data types mismatch for xDesc, yDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnBatchNormalizationForwardInference.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationForwardTraining deprecated

func (h Handle) BatchNormalizationForwardTraining(mode BatchNormMode, alpha unsafe.Pointer, beta unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, yDesc TensorDescriptor, y driver.DevicePtr, bnScaleBiasMeanVarDesc TensorDescriptor, bnScale driver.DevicePtr, bnBias driver.DevicePtr, exponentialAverageFactor float64, resultRunningMean driver.DevicePtr, resultRunningVariance driver.DevicePtr, epsilon float64, resultSaveMean driver.DevicePtr, resultSaveInvVariance driver.DevicePtr) error

BatchNormalizationForwardTraining performs the forward batch normalization layer computation for the training phase.

This function performs the forward batch normalization layer computation for the training phase. This layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The epsilon value has to be the same during training, backpropagation, and inference. For the inference phase, use Handle.BatchNormalizationForwardInference. Higher performance can be obtained when HW-packed tensors are used for both x and y. Refer to TensorDescriptor.DeriveBN for the secondary tensor descriptor generation for the parameters used in this function. Supported Configurations This function supports the following combinations of data types for various descriptors.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptors and pointers in device memory for the layer’s x and y data. For more information, refer to TensorDescriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc, for the layer’s x input data
  • yDesc: Input. Tensor descriptors and pointers in device memory for the layer’s x and y data. For more information, refer to TensorDescriptor
  • y: Input. Data pointer to GPU memory associated with the tensor descriptor yDesc, for the y output of the batch normalization layer
  • bnScaleBiasMeanVarDesc: Input. Shared tensor descriptor desc for the secondary tensor that was derived by TensorDescriptor.DeriveBN. The dimensions for this tensor descriptor are dependent on the normalization mode
  • bnScale: Input. Pointers in device memory for the batch normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma). Note that bnBias parameter can replace the previous layer’s bias parameter for improved efficiency
  • bnBias: Input. Pointers in device memory for the batch normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma). Note that bnBias parameter can replace the previous layer’s bias parameter for improved efficiency
  • exponentialAverageFactor: Input. Factor used in the moving average computation as follows: runningMean = runningMean*(1-factor) + newMean*factor. Use a factor=1/(1+n) at N-th call to the function to get the Cumulative Moving Average (CMA) behavior, for example: CMA[n] = (x[1]+...+x[n])/n. For example:
  • resultRunningMean: Input/Output. Running mean and variance tensors (these have the same descriptor as the bias and scale). Both of these pointers can be NULL but only at the same time. The value stored in resultRunningVariance (or passed as an input in inference mode) is the sample variance and is the moving average of variance[x] where the variance is computed either over batch or spatial+batch dimensions depending on the mode. If these pointers are not NULL, the tensors should be initialized to some reasonable values or to 0
  • resultRunningVariance: Input/Output. Running mean and variance tensors (these have the same descriptor as the bias and scale). Both of these pointers can be NULL but only at the same time. The value stored in resultRunningVariance (or passed as an input in inference mode) is the sample variance and is the moving average of variance[x] where the variance is computed either over batch or spatial+batch dimensions depending on the mode. If these pointers are not NULL, the tensors should be initialized to some reasonable values or to 0
  • epsilon: Input. Epsilon value used in the batch normalization formula. Its value should be equal to or greater than the value defined for CUDNN_BN_MIN_EPSILON in cudnn.h. The same epsilon value should be used in forward and backward functions
  • resultSaveMean: Output. Optional cache to save intermediate results computed during the forward pass. These buffers can be used to speed up the backward pass when supplied to the Handle.BatchNormalizationBackward function. The intermediate results stored in resultSaveMean and resultSaveInvVariance buffers should not be used directly by the user. Depending on the batch normalization mode, the results stored in resultSaveInvVariance may vary. For the cache to work correctly, the input layer data must remain unchanged until the backward function is called. Note that both parameters can be NULL but only at the same time. In such a case, intermediate statistics will not be saved, and Handle.BatchNormalizationBackward will have to re-compute them. It is recommended to use this cache as the memory overhead is relatively small because these tensors have a much lower product of dimensions than the data tensors
  • resultSaveInvVariance: Output. Optional cache to save intermediate results computed during the forward pass. These buffers can be used to speed up the backward pass when supplied to the Handle.BatchNormalizationBackward function. The intermediate results stored in resultSaveMean and resultSaveInvVariance buffers should not be used directly by the user. Depending on the batch normalization mode, the results stored in resultSaveInvVariance may vary. For the cache to work correctly, the input layer data must remain unchanged until the backward function is called. Note that both parameters can be NULL but only at the same time. In such a case, intermediate statistics will not be saved, and Handle.BatchNormalizationBackward will have to re-compute them. It is recommended to use this cache as the memory overhead is relatively small because these tensors have a much lower product of dimensions than the data tensors

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the pointers alpha, beta, x, y, bnScale, and bnBias is NULL. The number of xDesc or yDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported.) bnScaleBiasMeanVarDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of resultSaveMean, resultSaveInvVariance pointers are NULL. Exactly one of resultRunningMean, resultRunningInvVariance pointers are NULL. epsilon value is less than CUDNN_BN_MIN_EPSILON. Dimensions or data types mismatch for xDesc, yDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnBatchNormalizationForwardTraining.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationForwardTrainingEx deprecated

func (h Handle) BatchNormalizationForwardTrainingEx(mode BatchNormMode, bnOps BatchNormOps, alpha unsafe.Pointer, beta unsafe.Pointer, xDesc TensorDescriptor, xData driver.DevicePtr, zDesc TensorDescriptor, zData driver.DevicePtr, yDesc TensorDescriptor, yData driver.DevicePtr, bnScaleBiasMeanVarDesc TensorDescriptor, bnScale driver.DevicePtr, bnBias driver.DevicePtr, exponentialAverageFactor float64, resultRunningMean driver.DevicePtr, resultRunningVariance driver.DevicePtr, epsilon float64, resultSaveMean driver.DevicePtr, resultSaveInvVariance driver.DevicePtr, activationDesc ActivationDescriptor, workspace driver.DevicePtr, workSpaceSizeInBytes int, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int) error

BatchNormalizationForwardTrainingEx is an extension of the Handle.BatchNormalizationForwardTraining for performing the forward batch normalization layer computation.

This function is an extension of the Handle.BatchNormalizationForwardTraining for performing the forward batch normalization layer computation. This API will trigger the new semi-persistent NHWC kernel when the following conditions are true: If workspace is NULL and workSpaceSizeInBytes of zero is passed in, this API will function exactly like the non-extended function Handle.BatchNormalizationForwardTraining. This workspace is not required to be clean. Moreover, the workspace does not have to remain unchanged between the forward and backward pass, as it is not used for passing any information. This extended function can accept a *workspace pointer to the GPU workspace, and workSpaceSizeInBytes, the size of the workspace, from the user. The bnOps input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation. Only 4D and 5D tensors are supported. The epsilon value has to be the same during the training, the backpropagation, and the inference. When the tensor layout is NCHW, higher performance can be obtained when HW-packed tensors are used for x, dy, and dx. Supported Configurations This function supports the following combinations of data types for various descriptors.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • bnOps: Input. Mode of operation for the fast NHWC kernel. For more information, refer to BatchNormOps. This input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • xData: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • zDesc: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • zData: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • yData: Input. Tensor descriptors and pointers in device memory for the layer’s input x and output y, and for the optional z tensor input for residual addition to the result of the batch normalization operation, prior to the activation. The optional zDesc and *zData descriptors are only used when bnOps is BatchnormOpsBnAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor
  • bnScaleBiasMeanVarDesc: Input. Shared tensor descriptor desc for the secondary tensor that was derived by TensorDescriptor.DeriveBN. The dimensions for this tensor descriptor are dependent on the normalization mode
  • exponentialAverageFactor: Input. Factor used in the moving average computation as follows: runningMean = runningMean*(1-factor) + newMean*factor. Use a factor=1/(1+n) at N-th call to the function to get the Cumulative Moving Average (CMA) behavior, for example: CMA[n] = (x[1]+...+x[n])/n. For example:
  • epsilon: Input. Epsilon value used in the batch normalization formula. Its value should be equal to or greater than the value defined for CUDNN_BN_MIN_EPSILON in cudnn.h. The same epsilon value should be used in forward and backward functions
  • activationDesc: Input. The tensor descriptor for the activation operation. When the bnOps input is set to either BatchnormOpsBnActivation or BatchnormOpsBnAddActivation then this activation is used, otherwise user may pass NULL
  • workspace: Input. *workspace is a pointer to the GPU workspace, and workSpaceSizeInBytes is the size of the workspace. When *workspace is not NULL and *workSpaceSizeInBytes is large enough, and the tensor layout is NHWC and the data type configuration is supported, then this function will trigger a new semi-persistent NHWC kernel for batch normalization. The workspace is not required to be clean. Also, the workspace does not need to remain unchanged between the forward and backward passes
  • workSpaceSizeInBytes: Input. *workspace is a pointer to the GPU workspace, and workSpaceSizeInBytes is the size of the workspace. When *workspace is not NULL and *workSpaceSizeInBytes is large enough, and the tensor layout is NHWC and the data type configuration is supported, then this function will trigger a new semi-persistent NHWC kernel for batch normalization. The workspace is not required to be clean. Also, the workspace does not need to remain unchanged between the forward and backward passes
  • reserveSpace: Input. Pointer to the GPU workspace for the reserveSpace
  • reserveSpaceSizeInBytes: Input. The size of the reserveSpace. Must be equal or larger than the amount required by Handle.BatchNormalizationTrainingExReserveSpaceSize

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the pointers alpha, beta, x, y, bnScaleData, and bnBiasData is NULL. The number of xDesc or yDesc tensor descriptor dimensions is not within the [4,5] range (only 4D and 5D tensors are supported.) bnScaleBiasMeanVarDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of saveMean, saveInvVariance pointers are NULL. Exactly one of resultRunningMeanData, resultRunningInvVarianceData pointers are NULL. epsilon value is less than CUDNN_BN_MIN_EPSILON. Dimensions or data types mismatch for xDesc and yDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnBatchNormalizationForwardTrainingEx.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationForwardTrainingExWorkspaceSize deprecated

func (h Handle) BatchNormalizationForwardTrainingExWorkspaceSize(mode BatchNormMode, bnOps BatchNormOps, xDesc TensorDescriptor, zDesc TensorDescriptor, yDesc TensorDescriptor, bnScaleBiasMeanVarDesc TensorDescriptor, activationDesc ActivationDescriptor) (int, error)

BatchNormalizationForwardTrainingExWorkspaceSize returns the amount of GPU memory workspace the user should allocate to be able to call Handle.BatchNormalizationForwardTrainingExWorkspaceSize function for the specified bnOps input setting.

This function returns the amount of GPU memory workspace the user should allocate to be able to call Handle.BatchNormalizationForwardTrainingExWorkspaceSize function for the specified bnOps input setting. The workspace allocated should then be passed by the user to the function Handle.BatchNormalizationForwardTrainingExWorkspaceSize.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • bnOps: Input. Mode of operation for the fast NHWC kernel. For more information, refer to BatchNormOps. This input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, the optional z input data, and the y output. zDesc is only needed when bnOps is BatchnormOpsBnAddActivation, otherwise the user may pass NULL. For more information, refer to TensorDescriptor
  • zDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, the optional z input data, and the y output. zDesc is only needed when bnOps is BatchnormOpsBnAddActivation, otherwise the user may pass NULL. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, the optional z input data, and the y output. zDesc is only needed when bnOps is BatchnormOpsBnAddActivation, otherwise the user may pass NULL. For more information, refer to TensorDescriptor
  • bnScaleBiasMeanVarDesc: Input. Shared tensor descriptor for the following six tensors: bnScaleData, bnBiasData, dBnScaleData, dBnBiasData, savedMean, and savedInvVariance. This is the shared tensor descriptor desc for the secondary tensor that was derived by TensorDescriptor.DeriveBN. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors
  • activationDesc: Input. Descriptor for the activation operation. When the bnOps input is set to either BatchnormOpsBnActivation or BatchnormOpsBnAddActivation, then this activation is used, otherwise user may pass NULL

Errors:

  • ErrBadParam: At least one of the following conditions are met: Number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). dBnScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for spatial, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Dimensions or data types mismatch for any pair of xDesc or dyDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetBatchNormalizationForwardTrainingExWorkspaceSize.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BatchNormalizationTrainingExReserveSpaceSize deprecated

func (h Handle) BatchNormalizationTrainingExReserveSpaceSize(mode BatchNormMode, bnOps BatchNormOps, activationDesc ActivationDescriptor, xDesc TensorDescriptor) (int, error)

BatchNormalizationTrainingExReserveSpaceSize returns the amount of reserve GPU memory workspace the user should allocate for the batch normalization operation, for the specified bnOps input setting.

This function returns the amount of reserve GPU memory workspace the user should allocate for the batch normalization operation, for the specified bnOps input setting. In contrast to the workspace, the reserved space should be preserved between the forward and backward calls, and the data should not be altered.

  • mode: Input. Mode of operation (spatial or per-activation). For more information, refer to BatchNormMode
  • bnOps: Input. Mode of operation for the fast NHWC kernel. For more information, refer to BatchNormOps. This input can be used to set this function to perform either only the batch normalization, or batch normalization followed by activation, or batch normalization followed by element-wise addition and then activation
  • activationDesc: Input. Descriptor for the activation operation. When the bnOps input is set to either BatchnormOpsBnActivation or BatchnormOpsBnAddActivation, then this activation is used, otherwise user may pass NULL
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data. For more information, refer to TensorDescriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: The xDesc tensor descriptor dimension is not within the [4,5] range (only 4D and 5D tensors are supported).
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetBatchNormalizationTrainingExReserveSpaceSize.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) BuildRNNDynamic

func (h Handle) BuildRNNDynamic(rnnDesc RNNDescriptor, miniBatch int32) error

BuildRNNDynamic compiles the RNN persistent code using CUDA runtime compilation library (NVRTC) when the RnnAlgoPersistDynamic algo is selected.

The code is tailored to the current GPU and specific hyperparameters ( miniBatch). This call is expected to be expensive in terms of runtime and should be invoked infrequently. Note that the RnnAlgoPersistDynamic algo does not support variable length sequences within the batch.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • miniBatch: Input. The exact number of sequences in a batch

A nil error means the code was built and linked successfully.

Errors:

  • ErrAllocFailed: The resources could not be allocated.
  • ErrMappingError: A GPU/CUDA resource, such as a texture object, shared memory, or zero-copy memory is not available in the required size or there is a mismatch between the user resource and cuDNN internal resources. A resource mismatch may occur, for example, when calling Handle.SetStream. There could be a mismatch between the user provided CUDA stream and the internal CUDA events instantiated in the cuDNN handle when Create was invoked. This error status may not be correctable when it is related to texture dimensions, shared memory size, or zero-copy memory availability. If ErrMappingError is returned by Handle.SetStream, then it is typically correctable, however, it means that the cuDNN handle was created on one GPU and the user stream passed to this function is associated with another GPU.
  • ErrNotSupported: The current hyper-parameters are invalid.
  • ErrRuntimePrerequisiteMissing: The prerequisite runtime library could not be found.

Wraps cudnnBuildRNNDynamic.

func (Handle) CTCLoss

func (h Handle) CTCLoss(probsDesc TensorDescriptor, probs driver.DevicePtr, hostLabels *int32, hostLabelLengths *int32, hostInputLengths *int32, costs driver.DevicePtr, gradientsDesc TensorDescriptor, gradients driver.DevicePtr, algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor, workspace driver.DevicePtr, workSpaceSizeInBytes int) error

CTCLoss returns the CTC costs and gradients, given the probabilities and labels.

This function can have an inconsistent interface depending on the LossNormalizationMode chosen (bound to the CTCLossDescriptor with CTCLossDescriptor.SetEx). For the LossNormalizationNone, this function has an inconsistent interface, for example, the probs input is probability normalized by softmax, but the gradients output is with respect to the unnormalized activation. However, for LossNormalizationSoftmax, the function has a consistent interface; all values are normalized by softmax.

  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor. For more information, refer to TensorDescriptor
  • probs: Input. Pointer to a previously initialized probabilities tensor. These input probabilities are normalized by softmax
  • hostLabels: Input. Pointer to a previously initialized labels list, in CPU memory
  • hostLabelLengths: Input. Pointer to a previously initialized lengths list in CPU memory, to walk the above labels list
  • hostInputLengths: Input. Pointer to a previously initialized list of the lengths of the timing steps in each batch, in CPU memory
  • costs: Output. Pointer to the computed costs of CTC
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor
  • gradients: Output. Pointer to the computed gradients of CTC. These computed gradient outputs are with respect to the unnormalized activation
  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm. For more information, refer to CTCLossAlgo
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor. For more information, refer to CTCLossDescriptor
  • workspace: Input. Pointer to GPU memory of a workspace needed to be able to execute the specified algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc. The inputLengths do not agree with the first dimension of probsDesc. The workSpaceSizeInBytes is not sufficient. The labelLengths is greater than 255.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnCTCLoss.

func (Handle) CTCLossV1

func (h Handle) CTCLossV1(probsDesc TensorDescriptor, probs driver.DevicePtr, hostLabels *int32, hostLabelLengths *int32, hostInputLengths *int32, costs driver.DevicePtr, gradientsDesc TensorDescriptor, gradients driver.DevicePtr, algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor, workspace driver.DevicePtr, workSpaceSizeInBytes int) error

CTCLossV1 returns the CTC costs and gradients, given the probabilities and labels.

This function can have an inconsistent interface depending on the LossNormalizationMode chosen (bound to the CTCLossDescriptor with CTCLossDescriptor.SetEx). For the LossNormalizationNone, this function has an inconsistent interface, for example, the probs input is probability normalized by softmax, but the gradients output is with respect to the unnormalized activation. However, for LossNormalizationSoftmax, the function has a consistent interface; all values are normalized by softmax.

  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor. For more information, refer to TensorDescriptor
  • probs: Input. Pointer to a previously initialized probabilities tensor. These input probabilities are normalized by softmax
  • hostLabels: Input. Pointer to a previously initialized labels list, in CPU memory
  • hostLabelLengths: Input. Pointer to a previously initialized lengths list in CPU memory, to walk the above labels list
  • hostInputLengths: Input. Pointer to a previously initialized list of the lengths of the timing steps in each batch, in CPU memory
  • costs: Output. Pointer to the computed costs of CTC
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor
  • gradients: Output. Pointer to the computed gradients of CTC. These computed gradient outputs are with respect to the unnormalized activation
  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm. For more information, refer to CTCLossAlgo
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor. For more information, refer to CTCLossDescriptor
  • workspace: Input. Pointer to GPU memory of a workspace needed to be able to execute the specified algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc. The inputLengths do not agree with the first dimension of probsDesc. The workSpaceSizeInBytes is not sufficient. The labelLengths is greater than 255.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnCTCLoss.

func (Handle) CTCLossV8

func (h Handle) CTCLossV8(algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor, probsDesc TensorDescriptor, probs driver.DevicePtr, labels *int32, labelLengths *int32, inputLengths *int32, costs driver.DevicePtr, gradientsDesc TensorDescriptor, gradients driver.DevicePtr, workSpaceSizeInBytes int, workspace driver.DevicePtr) error

CTCLossV8 returns the CTC costs and gradients, given the probabilities and labels.

Many CTC API functions were updated in version 8 with the _v8 suffix to support CUDA graphs. Label and input data is now passed in GPU memory. This function can have an inconsistent interface depending on the LossNormalizationMode chosen (bound to the CTCLossDescriptor with CTCLossDescriptor.SetEx). For the LossNormalizationNone, this function has an inconsistent interface, for example, the probs input is probability normalized by softmax, but the gradients output is with respect to the unnormalized activation. However, for LossNormalizationSoftmax, the function has a consistent interface; all values are normalized by softmax.

  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm. For more information, refer to CTCLossAlgo
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor. For more information, refer to CTCLossDescriptor
  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor. For more information, refer to TensorDescriptor
  • probs: Input. Pointer to a previously initialized probabilities tensor. These input probabilities are normalized by softmax
  • labels: Input. Pointer to a previously initialized labels list, in GPU memory
  • labelLengths: Input. Pointer to a previously initialized lengths list in GPU memory, to walk the above labels list
  • inputLengths: Input. Pointer to a previously initialized list of the lengths of the timing steps in each batch, in GPU memory
  • costs: Output. Pointer to the computed costs of CTC
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor
  • gradients: Output. Pointer to the computed gradients of CTC. These computed gradient outputs are with respect to the unnormalized activation
  • workspace: Input. Pointer to GPU memory of a workspace needed to be able to execute the specified algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc. The inputLengths do not agree with the first dimension of probsDesc. The workSpaceSizeInBytes is not sufficient. The labelLengths is greater than 256.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnCTCLoss_v8.

func (Handle) CTCLossWorkspaceSize

func (h Handle) CTCLossWorkspaceSize(probsDesc TensorDescriptor, gradientsDesc TensorDescriptor, labels *int32, labelLengths *int32, inputLengths *int32, algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor) (int, error)

CTCLossWorkspaceSize returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.CTCLoss with the specified algorithm.

The workspace allocated will then be passed to the routine Handle.CTCLoss.

  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor
  • labels: Input. Pointer to a previously initialized labels list
  • labelLengths: Input. Pointer to a previously initialized lengths list, to walk the above labels list
  • inputLengths: Input. Pointer to a previously initialized list of the lengths of the timing steps in each batch
  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc The inputLengths do not agree with the first dimension of probsDesc The workSpaceSizeInBytes is not sufficient The labelLengths is greater than 256
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnGetCTCLossWorkspaceSize.

func (Handle) CTCLossWorkspaceSizeV1

func (h Handle) CTCLossWorkspaceSizeV1(probsDesc TensorDescriptor, gradientsDesc TensorDescriptor, labels *int32, labelLengths *int32, inputLengths *int32, algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor) (int, error)

CTCLossWorkspaceSizeV1 returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.CTCLoss with the specified algorithm.

The workspace allocated will then be passed to the routine Handle.CTCLoss.

  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor
  • labels: Input. Pointer to a previously initialized labels list
  • labelLengths: Input. Pointer to a previously initialized lengths list, to walk the above labels list
  • inputLengths: Input. Pointer to a previously initialized list of the lengths of the timing steps in each batch
  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc The inputLengths do not agree with the first dimension of probsDesc The workSpaceSizeInBytes is not sufficient The labelLengths is greater than 256
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnGetCTCLossWorkspaceSize.

func (Handle) CTCLossWorkspaceSizeV8

func (h Handle) CTCLossWorkspaceSizeV8(algo CTCLossAlgo, ctcLossDesc CTCLossDescriptor, probsDesc TensorDescriptor, gradientsDesc TensorDescriptor) (int, error)

CTCLossWorkspaceSizeV8 returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.CTCLossV8 with the specified algorithm.

The workspace allocated will then be passed to the routine Handle.CTCLossV8.

  • algo: Input. Enumerant that specifies the chosen CTC loss algorithm
  • ctcLossDesc: Input. Handle to the previously initialized CTC loss descriptor
  • probsDesc: Input. Handle to the previously initialized probabilities tensor descriptor
  • gradientsDesc: Input. Handle to a previously initialized gradient tensor descriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions of probsDesc do not match the dimensions of gradientsDesc
  • ErrNotSupported: A compute or data type other than FLOAT was chosen, or an unknown algorithm type was chosen.

Wraps cudnnGetCTCLossWorkspaceSize_v8.

func (*Handle) Close

func (h *Handle) Close() error

Close releases the resources used by the cuDNN handle.

This function is usually the last call made to cuDNN with a particular handle. Because Create allocates internal resources, the release of those resources by calling Handle.Close will implicitly call cudaDeviceSynchronize; therefore, the recommended best practice is to call Create or Handle.Close outside of performance-critical code paths.

A nil error means the cuDNN context destruction was successful.

If h is zero, Close returns nil. Otherwise Close sets h to zero when the call succeeds and leaves it unchanged when it fails. Only h is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroy.

func (Handle) ConvolutionBackwardBias deprecated

func (h Handle) ConvolutionBackwardBias(alpha unsafe.Pointer, dyDesc TensorDescriptor, dy driver.DevicePtr, beta unsafe.Pointer, dbDesc TensorDescriptor, db driver.DevicePtr) error

ConvolutionBackwardBias computes the convolution function gradient with respect to the bias, which is the sum of every element belonging to the same feature map across all of the images of the input tensor.

This function computes the convolution function gradient with respect to the bias, which is the sum of every element belonging to the same feature map across all of the images of the input tensor. Therefore, the number of elements produced is equal to the number of features maps of the input tensor.

  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dyDesc: Input. Handle to the previously initialized input tensor descriptor. For more information, refer to TensorDescriptor
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyDesc
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dbDesc: Input. Handle to the previously initialized output tensor descriptor
  • db: Output. Data pointer to GPU memory associated with the output tensor descriptor dbDesc

A nil error means the operation was launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters n, height, or width of the output tensor is not 1. The numbers of feature maps of the input tensor and output tensor differ. The dataType of the two tensor descriptors is different.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnConvolutionBackwardBias.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardData deprecated

func (h Handle) ConvolutionBackwardData(alpha unsafe.Pointer, wDesc FilterDescriptor, w driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, convDesc ConvolutionDescriptor, algo ConvolutionBwdDataAlgo, workSpace driver.DevicePtr, workSpaceSizeInBytes int, beta unsafe.Pointer, dxDesc TensorDescriptor, dx driver.DevicePtr) error

ConvolutionBackwardData computes the convolution data gradient of the tensor dy, where y is the output of the forward convolution in Handle.ConvolutionForward.

This function computes the convolution data gradient of the tensor dy, where y is the output of the forward convolution in Handle.ConvolutionForward. It uses the specified algo, and returns the results in the output tensor dx. Scaling factors alpha and beta can be used to scale the computed result or accumulate with the current dx. Supported Configurations This function supports the following combinations of data types for wDesc, dyDesc, convDesc, and dxDesc.

  • Data Type Configurations: TRUE_HALF_CONFIG (only supported on architectures with true FP16 support, meaning, compute capability 5.3 and later); wDesc, dyDesc, and dxDesc Data Type: DataHalf; convDesc Data Type: DataHalf
  • Data Type Configurations: PSEUDO_HALF_CONFIG; wDesc, dyDesc, and dxDesc Data Type: DataHalf; convDesc Data Type: DataFloat
  • Data Type Configurations: PSEUDO_BFLOAT16_CONFIG; wDesc, dyDesc, and dxDesc Data Type: DataBfloat16; convDesc Data Type: DataFloat
  • Data Type Configurations: FLOAT_CONFIG; wDesc, dyDesc, and dxDesc Data Type: DataFloat; convDesc Data Type: DataFloat
  • Data Type Configurations: DOUBLE_CONFIG; wDesc, dyDesc, and dxDesc Data Type: DataDouble; convDesc Data Type: DataDouble

Supported Algorithms Specifying a separate algorithm can cause changes in performance, support and computation determinism. Refer to the following list of algorithm options, and their respective supported parameters and deterministic behavior. The table below shows the list of the supported 2D and 3D convolutions. The 2D convolutions are described first, followed by the 3D convolutions. For brevity, the short-form versions followed by > are used in the table below:

  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • wDesc: Input. Handle to a previously initialized filter descriptor. For more information, refer to FilterDescriptor
  • w: Input. Data pointer to GPU memory associated with the filter descriptor wDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor. For more information, refer to TensorDescriptor
  • dy: Input. Data pointer to GPU memory associated with the input differential tensor descriptor dyDesc
  • convDesc: Input. Previously initialized convolution descriptor. For more information, refer to ConvolutionDescriptor
  • algo: Input. Enumerant that specifies which backward data convolution algorithm should be used to compute the results. For more information, refer to ConvolutionBwdDataAlgo
  • workSpace: Input. Data pointer to GPU memory to a workspace needed to be able to execute the specified algorithm. If no workspace is needed for a particular algorithm, that pointer can be NIL
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dxDesc: Input. Handle to the previously initialized output tensor descriptor
  • dx: Input/Output. Data pointer to GPU memory associated with the output tensor descriptor dxDesc that carries the result

A nil error means the operation was launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: At least one of the following is NULL: handle, dyDesc, wDesc, convDesc, dxDesc, dy, w, dx, alpha, and beta wDesc and dyDesc have a non-matching number of dimensions wDesc and dxDesc have a non-matching number of dimensions wDesc has fewer than three number of dimensions wDesc, dxDesc, and dyDesc have a non-matching data type wDesc and dxDesc have a non-matching number of input feature maps per image (or group in case of grouped convolutions) dyDesc spatial sizes do not match with the expected size as determined by ConvolutionDescriptor.ForwardOutputDims
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrMappingError: An error occurs during the texture binding of texture object creation associated with the filter data or the input differential tensor data.
  • ErrNotSupported: At least one of the following conditions are met: dyDesc or dxDesc have a negative tensor striding dyDesc, wDesc, or dxDesc has a number of dimensions that is not 4 or 5 The chosen algo does not support the parameters provided; refer to the above tables for an exhaustive list of parameters that support each algo. dyDesc or wDesc indicate an output channel count that isn’t a multiple of group count (if group count has been set in convDesc)

Wraps cudnnConvolutionBackwardData.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardDataAlgorithm deprecated

func (h Handle) ConvolutionBackwardDataAlgorithm(filterDesc FilterDescriptor, diffDesc TensorDescriptor, convDesc ConvolutionDescriptor, gradDesc TensorDescriptor, requestedAlgoCount int) ([]ConvolutionBwdDataAlgoPerf, error)

ConvolutionBackwardDataAlgorithm serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionBackwardData for the given layer specifications.

This function serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionBackwardData for the given layer specifications. This function will return all algorithms (including TensorOpMath and DefaultMath versions of algorithms where TensorOpMath may be available) sorted by expected (based on internal heuristic) relative performance with the fastest being index 0 of perfResults. For an exhaustive search for the fastest algorithm, use Handle.FindConvolutionBackwardDataAlgorithm. The total number of resulting algorithms can be queried through the returnedAlgoCount variable.

  • convDesc: Input. Previously initialized convolution descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters handle, wDesc, dyDesc, convDesc, dxDesc, perfResults, or returnedAlgoCount is NULL. The numbers of feature maps of the input tensor and output tensor differ. The dataType of the two tensor descriptors or the filters are different. requestedAlgoCount is less than or equal to 0.

Wraps cudnnGetConvolutionBackwardDataAlgorithm_v7.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardDataAlgorithmMaxCount deprecated

func (h Handle) ConvolutionBackwardDataAlgorithmMaxCount() (int32, error)

ConvolutionBackwardDataAlgorithmMaxCount returns the maximum number of algorithms which can be returned from Handle.FindConvolutionBackwardDataAlgorithm and Handle.ConvolutionForwardAlgorithm.

This function returns the maximum number of algorithms which can be returned from Handle.FindConvolutionBackwardDataAlgorithm and Handle.ConvolutionForwardAlgorithm. This is the sum of all algorithms plus the sum of all algorithms with Tensor Core operations supported for the current device.

Errors:

  • ErrBadParam: The provided handle is not allocated properly.

Wraps cudnnGetConvolutionBackwardDataAlgorithmMaxCount.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardDataWorkspaceSize deprecated

func (h Handle) ConvolutionBackwardDataWorkspaceSize(wDesc FilterDescriptor, dyDesc TensorDescriptor, convDesc ConvolutionDescriptor, dxDesc TensorDescriptor, algo ConvolutionBwdDataAlgo) (int, error)

ConvolutionBackwardDataWorkspaceSize returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionBackwardData with the specified algorithm.

This function returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionBackwardData with the specified algorithm. The workspace allocated will then be passed to the routine Handle.ConvolutionBackwardData. The specified algorithm can be the result of the call to Handle.ConvolutionBackwardDataAlgorithm or can be chosen arbitrarily by the user. Note that not every algorithm is available for every configuration of the input tensor and/or every configuration of the convolution descriptor.

  • wDesc: Input. Handle to a previously initialized filter descriptor
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • dxDesc: Input. Handle to the previously initialized output tensor descriptor
  • algo: Input. Enumerant that specifies the chosen convolution algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: The numbers of feature maps of the input tensor and output tensor differ. The dataType of the two tensor descriptors or the filter are different.
  • ErrNotSupported: The combination of the tensor descriptors, filter descriptor, and convolution descriptor is not supported for the specified algorithm.

Wraps cudnnGetConvolutionBackwardDataWorkspaceSize.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardFilter deprecated

func (h Handle) ConvolutionBackwardFilter(alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, convDesc ConvolutionDescriptor, algo ConvolutionBwdFilterAlgo, workSpace driver.DevicePtr, workSpaceSizeInBytes int, beta unsafe.Pointer, dwDesc FilterDescriptor, dw driver.DevicePtr) error

ConvolutionBackwardFilter computes the convolution weight (filter) gradient of the tensor dy, where y is the output of the forward convolution in Handle.ConvolutionForward.

This function computes the convolution weight (filter) gradient of the tensor dy, where y is the output of the forward convolution in Handle.ConvolutionForward. It uses the specified algo, and returns the results in the output tensor dw. Scaling factors alpha and beta can be used to scale the computed result or accumulate with the current dw. Supported Configurations This function supports the following combinations of data types for xDesc, dyDesc, convDesc, and dwDesc.

  • Data Type Configurations: TRUE_HALF_CONFIG (only supported on architectures with true FP16 support, meaning, compute capability 5.3 and later); xDesc, dyDesc, and dwDesc Data Type: DataHalf; convDesc Data Type: DataHalf
  • Data Type Configurations: PSEUDO_HALF_CONFIG; xDesc, dyDesc, and dwDesc Data Type: DataHalf; convDesc Data Type: DataFloat
  • Data Type Configurations: PSEUDO_BFLOAT16_CONFIG; xDesc, dyDesc, and dwDesc Data Type: DataBfloat16; convDesc Data Type: DataFloat
  • Data Type Configurations: FLOAT_CONFIG; xDesc, dyDesc, and dwDesc Data Type: DataFloat; convDesc Data Type: DataFloat
  • Data Type Configurations: DOUBLE_CONFIG; xDesc, dyDesc, and dwDesc Data Type: DataDouble; convDesc Data Type: DataDouble

Supported Algorithms Specifying a separate algorithm can cause changes in performance, support, and computation determinism. Refer to the following table for an exhaustive list of algorithm options and their respective supported parameters and deterministic behavior. The table below shows the list of the supported 2D and 3D convolutions. The 2D convolutions are described first, followed by the 3D convolutions. For the following terms, the short-form versions shown in parentheses are used in the table below, for brevity: For brevity, the short-form versions followed by > are used in the table below:

  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • dy: Input. Data pointer to GPU memory associated with the backpropagation gradient tensor descriptor dyDesc
  • convDesc: Input. Previously initialized convolution descriptor. For more information, refer to ConvolutionDescriptor
  • algo: Input. Enumerant that specifies which convolution algorithm should be used to compute the results. For more information, refer to ConvolutionBwdFilterAlgo
  • workSpace: Input. Data pointer to GPU memory to a workspace needed to be able to execute the specified algorithm. If no workspace is needed for a particular algorithm, that pointer can be NIL
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dwDesc: Input. Handle to a previously initialized filter gradient descriptor. For more information, refer to FilterDescriptor
  • dw: Input/Output. Data pointer to GPU memory associated with the filter gradient descriptor dwDesc that carries the result

A nil error means the operation was launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: At least one of the following is NULL: handle, xDesc, dyDesc, convDesc, dwDesc, xData, dyData, dwData, alpha, or beta xDesc and dyDesc have a non-matching number of dimensions xDesc and dwDesc have a non-matching number of dimensions xDesc has fewer than three number of dimensions xDesc, dyDesc, and dwDesc have a non-matching data type xDesc and dwDesc have a non-matching number of input feature maps per image (or group in case of grouped convolutions) yDesc or dwDesc indicate an output channel count that isn’t a multiple of group count (if group count has been set in convDesc)
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrMappingError: An error occurs during the texture object creation associated with the filter data.
  • ErrNotSupported: At least one of the following conditions are met: xDesc or dyDesc have negative tensor striding xDesc, dyDesc`,` or “dwDesc has a number of dimensions that is not 4 or 5 The chosen algo does not support the parameters provided; see above for an exhaustive list of parameter support for each algo

Wraps cudnnConvolutionBackwardFilter.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardFilterAlgorithm deprecated

func (h Handle) ConvolutionBackwardFilterAlgorithm(srcDesc TensorDescriptor, diffDesc TensorDescriptor, convDesc ConvolutionDescriptor, gradDesc FilterDescriptor, requestedAlgoCount int) ([]ConvolutionBwdFilterAlgoPerf, error)

ConvolutionBackwardFilterAlgorithm serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionBackwardFilter for the given layer specifications.

This function serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionBackwardFilter for the given layer specifications. This function will return all algorithms (including TensorOpMath and DefaultMath versions of algorithms where TensorOpMath may be available) sorted by expected (based on internal heuristic) relative performance with the fastest being index 0 of perfResults. For an exhaustive search for the fastest algorithm, use Handle.FindConvolutionBackwardFilterAlgorithm. The total number of resulting algorithms can be queried through the returnedAlgoCount variable.

  • convDesc: Input. Previously initialized convolution descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters handle, xDesc, dyDesc, convDesc, dwDesc, perfResults, or returnedAlgoCount is NULL. The numbers of feature maps of the input tensor and output tensor differ. The dataType of the two tensor descriptors or the filter are different. requestedAlgoCount is less than or equal to 0.

Wraps cudnnGetConvolutionBackwardFilterAlgorithm_v7.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardFilterAlgorithmMaxCount deprecated

func (h Handle) ConvolutionBackwardFilterAlgorithmMaxCount() (int32, error)

ConvolutionBackwardFilterAlgorithmMaxCount returns the maximum number of algorithms which can be returned from Handle.FindConvolutionBackwardFilterAlgorithm and Handle.ConvolutionForwardAlgorithm.

This function returns the maximum number of algorithms which can be returned from Handle.FindConvolutionBackwardFilterAlgorithm and Handle.ConvolutionForwardAlgorithm. This is the sum of all algorithms plus the sum of all algorithms with Tensor Core operations supported for the current device.

Errors:

  • ErrBadParam: The provided handle is not allocated properly.

Wraps cudnnGetConvolutionBackwardFilterAlgorithmMaxCount.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBackwardFilterWorkspaceSize deprecated

func (h Handle) ConvolutionBackwardFilterWorkspaceSize(xDesc TensorDescriptor, dyDesc TensorDescriptor, convDesc ConvolutionDescriptor, gradDesc FilterDescriptor, algo ConvolutionBwdFilterAlgo) (int, error)

ConvolutionBackwardFilterWorkspaceSize returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionBackwardFilter with the specified algorithm.

This function returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionBackwardFilter with the specified algorithm. The workspace allocated will then be passed to the routine Handle.ConvolutionBackwardFilter. The specified algorithm can be the result of the call to Handle.ConvolutionBackwardFilterAlgorithm or can be chosen arbitrarily by the user. Note that not every algorithm is available for every configuration of the input tensor and/or every configuration of the convolution descriptor.

  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • algo: Input. Enumerant that specifies the chosen convolution algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: The numbers of feature maps of the input tensor and output tensor differ. The dataType of the two tensor descriptors or the filter are different.
  • ErrNotSupported: The combination of the tensor descriptors, filter descriptor and convolution descriptor is not supported for the specified algorithm.

Wraps cudnnGetConvolutionBackwardFilterWorkspaceSize.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionBiasActivationForward deprecated

func (h Handle) ConvolutionBiasActivationForward(alpha1 unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, wDesc FilterDescriptor, w driver.DevicePtr, convDesc ConvolutionDescriptor, algo ConvolutionFwdAlgo, workSpace driver.DevicePtr, workSpaceSizeInBytes int, alpha2 unsafe.Pointer, zDesc TensorDescriptor, z driver.DevicePtr, biasDesc TensorDescriptor, bias driver.DevicePtr, activationDesc ActivationDescriptor, yDesc TensorDescriptor, y driver.DevicePtr) error

ConvolutionBiasActivationForward applies a bias and then an activation to the convolutions or cross-correlations of Handle.ConvolutionForward, returning results in y.

This function applies a bias and then an activation to the convolutions or cross-correlations of Handle.ConvolutionForward, returning results in y. The full computation follows the equation y = act (alpha1 * conv(x) + alpha2 * z + bias). The routine ConvolutionDescriptor.ForwardOutputDim2D or ConvolutionDescriptor.ForwardOutputDims can be used to determine the proper dimensions of the output tensor descriptor yDesc with respect to xDesc, convDesc, and wDesc. Only the ConvolutionFwdAlgoImplicitPrecompGemm algo is enabled with ActivationIdentity. In other words, in the ActivationDescriptor structure of the input activationDesc, if the mode of the ActivationMode field is set to the enum value ActivationIdentity, then the input ConvolutionFwdAlgo of this function Handle.ConvolutionBiasActivationForward must be set to the enum value ConvolutionFwdAlgoImplicitPrecompGemm. For more information, refer to ActivationDescriptor.Set. Device pointer z and y may be pointing to the same buffer, however, x cannot point to the same buffer as z or y.

x           w           convDesc  y and z     bias        alpha1 and alpha2
X_DOUBLE    X_DOUBLE    X_DOUBLE  X_DOUBLE    X_DOUBLE    X_DOUBLE
X_FLOAT     X_FLOAT     X_FLOAT   X_FLOAT     X_FLOAT     X_FLOAT
X_HALF      X_HALF      X_FLOAT   X_HALF      X_HALF      X_FLOAT
X_BFLOAT16  X_BFLOAT16  X_FLOAT   X_BFLOAT16  X_BFLOAT16  X_FLOAT
X_INT8      X_INT8      X_INT32   X_INT8      X_FLOAT     X_FLOAT
X_INT8      X_INT8      X_INT32   X_FLOAT     X_FLOAT     X_FLOAT
X_INT8x4    X_INT8x4    X_INT32   X_INT8x4    X_FLOAT     X_FLOAT
X_INT8x4    X_INT8x4    X_INT32   X_FLOAT     X_FLOAT     X_FLOAT
X_UINT8     X_INT8      X_INT32   X_INT8      X_FLOAT     X_FLOAT
X_UINT8     X_INT8      X_INT32   X_FLOAT     X_FLOAT     X_FLOAT
X_UINT8x4   X_INT8x4    X_INT32   X_INT8x4    X_FLOAT     X_FLOAT
X_UINT8x4   X_INT8x4    X_INT32   X_FLOAT     X_FLOAT     X_FLOAT
X_INT8x32   X_INT8x32   X_INT32   X_INT8x32   X_FLOAT     X_FLOAT

Parameters:

  • alpha1: Input. Pointers to scaling factors (in host memory) used to blend the computation result of convolution with z and bias as follows: y = act (alpha1 * conv(x) + alpha2 * z + bias). For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • wDesc: Input. Handle to a previously initialized filter descriptor. For more information, refer to FilterDescriptor
  • w: Input. Data pointer to GPU memory associated with the filter descriptor wDesc
  • convDesc: Input. Previously initialized convolution descriptor. For more information, refer to ConvolutionDescriptor
  • algo: Input. Enumerant that specifies which convolution algorithm should be used to compute the results. For more information, refer to ConvolutionFwdAlgo
  • workSpace: Input. Data pointer to GPU memory to a workspace needed to be able to execute the specified algorithm. If no workspace is needed for a particular algorithm, that pointer can be NIL
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace
  • alpha2: Input. Pointers to scaling factors (in host memory) used to blend the computation result of convolution with z and bias as follows: y = act (alpha1 * conv(x) + alpha2 * z + bias). For more information, refer to Scaling Parameters
  • zDesc: Input. Handle to a previously initialized tensor descriptor
  • z: Input. Data pointer to GPU memory associated with the tensor descriptor zDesc
  • biasDesc: Input. Handle to a previously initialized tensor descriptor
  • bias: Input. Data pointer to GPU memory associated with the tensor descriptor biasDesc
  • activationDesc: Input. Handle to a previously initialized activation descriptor. For more information, refer to ActivationDescriptor
  • yDesc: Input. Handle to a previously initialized tensor descriptor
  • y: Input/Output. Data pointer to GPU memory associated with the tensor descriptor yDesc that carries the result of the convolution. For the convolution step, this function supports the specific combinations of data types for xDesc, wDesc, convDesc, and yDesc as listed in the documentation of Handle.ConvolutionForward. The following table specifies the supported combinations of data types for x, y, z, bias, alpha1, and alpha2. Supported Combinations of Data Types (X = CUDNN_DATA) for Handle.ConvolutionBiasActivationForward

A nil error means the operation was launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: At least one of the following is NULL: handle, xDesc, wDesc, convDesc, yDesc, zDesc, biasDesc, activationDesc, xData, wData, yData, zData, bias, alpha1, and alpha2. The number of dimensions of xDesc, wDesc, yDesc, and zDesc is not equal to the array length of convDesc + 2.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples of non-supported configurations include: The mode of activationDesc is not ActivationRelu or ActivationIdentity. The reluNanOpt of activationDesc is not NotPropagateNan. The second stride of biasDesc is not equal to 1. The first dimension of biasDesc is not equal to 1. The second dimension of biasDesc and the first dimension of filterDesc are not equal. The data type of biasDesc does not correspond to the data type of yDesc as listed in the above data type tables. zDesc and destDesc do not match.

Wraps cudnnConvolutionBiasActivationForward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionForward deprecated

func (h Handle) ConvolutionForward(alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, wDesc FilterDescriptor, w driver.DevicePtr, convDesc ConvolutionDescriptor, algo ConvolutionFwdAlgo, workSpace driver.DevicePtr, workSpaceSizeInBytes int, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

ConvolutionForward executes convolutions or cross-correlations over x using filters specified with w, returning results in y.

This function executes convolutions or cross-correlations over x using filters specified with w, returning results in y. Scaling factors alpha and beta can be used to scale the input tensor and the output tensor respectively. The routine ConvolutionDescriptor.ForwardOutputDim2D or ConvolutionDescriptor.ForwardOutputDims can be used to determine the proper dimensions of the output tensor descriptor yDesc with respect to xDesc, convDesc, and wDesc. Supported Configurations This function supports the following combinations of data types for xDesc, wDesc, convDesc, and yDesc.

  • Data Type Configurations: TRUE_HALF_CONFIG (only supported on architectures with true FP16 support, meaning, compute capability 5.3 and later); xDesc and wDesc Data Type: DataHalf; convDesc Data Type: DataHalf; yDesc Data Type: DataHalf
  • Data Type Configurations: PSEUDO_HALF_CONFIG; xDesc and wDesc Data Type: DataHalf; convDesc Data Type: DataFloat; yDesc Data Type: DataHalf
  • Data Type Configurations: PSEUDO_BFLOAT16_CONFIG (only support on architecture with bfloat16 support, meaning, compute capability 8.0 and later); xDesc and wDesc Data Type: DataBfloat16; convDesc Data Type: DataFloat; yDesc Data Type: DataBfloat16
  • Data Type Configurations: FLOAT_CONFIG; xDesc and wDesc Data Type: DataFloat; convDesc Data Type: DataFloat; yDesc Data Type: DataFloat
  • Data Type Configurations: DOUBLE_CONFIG; xDesc and wDesc Data Type: DataDouble; convDesc Data Type: DataDouble; yDesc Data Type: DataDouble
  • Data Type Configurations: INT8_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: DataINT8; convDesc Data Type: DataInt32; yDesc Data Type: DataINT8
  • Data Type Configurations: INT8_EXT_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: DataINT8; convDesc Data Type: DataInt32; yDesc Data Type: DataFloat
  • Data Type Configurations: INT8x4_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: CUDNN_DATA_INT8x4; convDesc Data Type: DataInt32; yDesc Data Type: CUDNN_DATA_INT8x4
  • Data Type Configurations: INT8x4_EXT_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: CUDNN_DATA_INT8x4; convDesc Data Type: DataInt32; yDesc Data Type: DataFloat
  • Data Type Configurations: UINT8_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: xDesc: DataUint8 wDesc: DataINT8; convDesc Data Type: DataInt32; yDesc Data Type: DataINT8
  • Data Type Configurations: UINT8x4_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: xDesc: CUDNN_DATA_UINT8x4 wDesc: CUDNN_DATA_INT8x4; convDesc Data Type: DataInt32; yDesc Data Type: CUDNN_DATA_INT8x4
  • Data Type Configurations: UINT8_EXT_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: xDesc: DataUint8 wDesc: DataINT8; convDesc Data Type: DataInt32; yDesc Data Type: DataFloat
  • Data Type Configurations: UINT8x4_EXT_CONFIG (only supported on architectures with DP4A support, meaning, compute capability 6.1 and later); xDesc and wDesc Data Type: xDesc: CUDNN_DATA_UINT8x4 wDesc: CUDNN_DATA_INT8x4; convDesc Data Type: DataInt32; yDesc Data Type: DataFloat
  • Data Type Configurations: INT8x32_CONFIG (only supported on architectures with IMMA support, meaning compute capability 7.5 and later); xDesc and wDesc Data Type: CUDNN_DATA_INT8x32; convDesc Data Type: DataInt32; yDesc Data Type: CUDNN_DATA_INT8x32

Supported Algorithms For this function, all algorithms perform deterministic computations. Specifying a separate algorithm can cause changes in performance and support. The following table shows the list of the supported 2D and 3D convolutions. The 2D convolutions are described first, followed by the 3D convolutions. For brevity, the short-form versions followed by > are used in the table below: Tensors can be converted to and from TensorNchwVectC with Handle.TransformTensor.

  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • wDesc: Input. Handle to a previously initialized filter descriptor. For more information, refer to FilterDescriptor
  • w: Input. Data pointer to GPU memory associated with the filter descriptor wDesc
  • convDesc: Input. Previously initialized convolution descriptor. For more information, refer to ConvolutionDescriptor
  • algo: Input. Enumerant that specifies which convolution algorithm should be used to compute the results. For more information, refer to ConvolutionFwdAlgo
  • workSpace: Input. Data pointer to GPU memory to a workspace needed to be able to execute the specified algorithm. If no workspace is needed for a particular algorithm, that pointer can be NIL
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to a previously initialized tensor descriptor
  • y: Input/Output. Data pointer to GPU memory associated with the tensor descriptor yDesc that carries the result of the convolution

A nil error means the operation was launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: At least one of the following is NULL: handle, xDesc, wDesc, convDesc, yDesc, xData, w, yData, alpha, and beta xDesc and yDesc have a non-matching number of dimensions xDesc and wDesc have a non-matching number of dimensions xDesc has fewer than three number of dimensions xDesc number of dimensions is not equal to convDesc array length + 2 xDesc and wDesc have a non-matching number of input feature maps per image (or group in case of grouped convolutions) yDesc or wDesc indicate an output channel count that isn’t a multiple of group count (if group count has been set in convDesc) xDesc, wDesc, and yDesc have a non-matching data type For some spatial dimension, wDesc has a spatial size that is larger than the input spatial size (including zero-padding size)
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrMappingError: An error occurs during the texture object creation associated with the filter data.
  • ErrNotSupported: At least one of the following conditions are met: xDesc or yDesc have negative tensor striding xDesc, wDesc, or yDesc has a number of dimensions that is not 4 or 5 yDesc spatial sizes do not match with the expected size as determined by ConvolutionDescriptor.ForwardOutputDims The chosen algo does not support the parameters provided; see above for an exhaustive list of parameters supported for each algo

Wraps cudnnConvolutionForward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionForwardAlgorithm deprecated

func (h Handle) ConvolutionForwardAlgorithm(srcDesc TensorDescriptor, filterDesc FilterDescriptor, convDesc ConvolutionDescriptor, destDesc TensorDescriptor, requestedAlgoCount int) ([]ConvolutionFwdAlgoPerf, error)

ConvolutionForwardAlgorithm serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionForward for the given layer specifications.

This function serves as a heuristic for obtaining the best suited algorithm for Handle.ConvolutionForward for the given layer specifications. This function will return all algorithms (including TensorOpMath and DefaultMath versions of algorithms where TensorOpMath may be available) sorted by expected (based on internal heuristic) relative performance with the fastest being index 0 of perfResults. For an exhaustive search for the fastest algorithm, use Handle.FindConvolutionForwardAlgorithm. The total number of resulting algorithms can be queried through the returnedAlgoCount variable.

  • convDesc: Input. Previously initialized convolution descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters handle, xDesc, wDesc, convDesc, yDesc, perfResults, or returnedAlgoCount is NULL. Either yDesc or wDesc have different dimensions from xDesc. The data types of tensors xDesc, yDesc, or wDesc are not all the same. The number of feature maps in xDesc and wDesc differs. The tensor xDesc has a dimension smaller than 3. requestedAlgoCount is less than or equal to 0.

Wraps cudnnGetConvolutionForwardAlgorithm_v7.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionForwardAlgorithmMaxCount deprecated

func (h Handle) ConvolutionForwardAlgorithmMaxCount() (int32, error)

ConvolutionForwardAlgorithmMaxCount returns the maximum number of algorithms which can be returned from Handle.FindConvolutionForwardAlgorithm and Handle.ConvolutionForwardAlgorithm.

This function returns the maximum number of algorithms which can be returned from Handle.FindConvolutionForwardAlgorithm and Handle.ConvolutionForwardAlgorithm. This is the sum of all algorithms plus the sum of all algorithms with Tensor Core operations supported for the current device.

Errors:

  • ErrBadParam: The provided handle is not allocated properly.

Wraps cudnnGetConvolutionForwardAlgorithmMaxCount.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ConvolutionForwardWorkspaceSize deprecated

func (h Handle) ConvolutionForwardWorkspaceSize(xDesc TensorDescriptor, wDesc FilterDescriptor, convDesc ConvolutionDescriptor, yDesc TensorDescriptor, algo ConvolutionFwdAlgo) (int, error)

ConvolutionForwardWorkspaceSize returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionForward with the specified algorithm.

This function returns the amount of GPU memory workspace the user needs to allocate to be able to call Handle.ConvolutionForward with the specified algorithm. The workspace allocated will then be passed to the routine Handle.ConvolutionForward. The specified algorithm can be the result of the call to Handle.ConvolutionForwardAlgorithm or can be chosen arbitrarily by the user. Note that not every algorithm is available for every configuration of the input tensor and/or every configuration of the convolution descriptor.

  • xDesc: Input. Handle to the previously initialized x tensor descriptor
  • wDesc: Input. Handle to a previously initialized filter descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • yDesc: Input. Handle to the previously initialized y tensor descriptor
  • algo: Input. Enumerant that specifies the chosen convolution algorithm

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the parameters handle, xDesc, wDesc, convDesc, or yDesc is NULL. The tensor yDesc or wDesc are not of the same dimension as xDesc. The tensor xDesc, yDesc, or wDesc are not of the same data type. The numbers of feature maps of the tensor xDesc and wDesc differ. The tensor xDesc has a dimension smaller than 3.
  • ErrNotSupported: The combination of the tensor descriptors, filter descriptor, and convolution descriptor is not supported for the specified algorithm.

Wraps cudnnGetConvolutionForwardWorkspaceSize.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) Destroy deprecated

func (h Handle) Destroy() error

Destroy calls Close.

Deprecated: Use Handle.Close instead.

func (Handle) DivisiveNormalizationBackward

func (h Handle) DivisiveNormalizationBackward(normDesc LRNDescriptor, mode DivNormMode, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, means driver.DevicePtr, dy driver.DevicePtr, temp driver.DevicePtr, temp2 driver.DevicePtr, beta unsafe.Pointer, dXdMeansDesc TensorDescriptor, dx driver.DevicePtr, dMeans driver.DevicePtr) error

DivisiveNormalizationBackward performs the backward DivisiveNormalization layer computation.

Supported tensor formats are NCHW for 4D and NCDHW for 5D with any non-overlapping non-negative strides. Only 4D and 5D tensors are supported.

  • normDesc: Input. Handle to a previously initialized LRN parameter descriptor (this descriptor is used for both LRN and DivisiveNormalization layers)
  • mode: Input. DivisiveNormalization layer mode of operation. Currently only DivnormPrecomputedMeans is implemented. Normalization is performed using the means input tensor that is expected to be precomputed by the user
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptor and pointers in device memory for the layer’s x and means data. Note that the means tensor is expected to be precomputed by the user. It can also contain any valid values (not required to be actual means, and can be for instance a result of a convolution with a Gaussian kernel)
  • x: Input. Tensor descriptor and pointers in device memory for the layer’s x and means data. Note that the means tensor is expected to be precomputed by the user. It can also contain any valid values (not required to be actual means, and can be for instance a result of a convolution with a Gaussian kernel)
  • means: Input. Tensor descriptor and pointers in device memory for the layer’s x and means data. Note that the means tensor is expected to be precomputed by the user. It can also contain any valid values (not required to be actual means, and can be for instance a result of a convolution with a Gaussian kernel)
  • dy: Input. Tensor pointer in device memory for the layer’s dy cumulative loss differential data (error backpropagation)
  • temp: Workspace. Temporary tensors in device memory. These are used for computing intermediate values during the backward pass. These tensors do not have to be preserved from forward to backward pass. Both use xDesc as a descriptor
  • temp2: Workspace. Temporary tensors in device memory. These are used for computing intermediate values during the backward pass. These tensors do not have to be preserved from forward to backward pass. Both use xDesc as a descriptor
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dx: Output. Tensor pointers (in device memory) for the layers resulting in cumulative gradients dx and dMeans ( dLoss/dx and dLoss/dMeans). Both share the same descriptor
  • dMeans: Output. Tensor pointers (in device memory) for the layers resulting in cumulative gradients dx and dMeans ( dLoss/dx and dLoss/dMeans). Both share the same descriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the tensor pointers x, dx, temp, tmep2, and dy is NULL. Number of any of the input or output tensor dimensions is not within the [4,5] range. Either alpha or beta pointer is NULL. A mismatch in dimensions between xDesc and dxDesc. LRN descriptor parameters are outside of their valid ranges. Any of the tensor strides is negative.
  • CUDNN_STATUS_UNSUPPORTED: The function does not support the provided configuration, for example, any of the input and output tensor strides mismatch (for the same dimension) is a non-supported configuration.

Wraps cudnnDivisiveNormalizationBackward.

func (Handle) DivisiveNormalizationForward

func (h Handle) DivisiveNormalizationForward(normDesc LRNDescriptor, mode DivNormMode, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, means driver.DevicePtr, temp driver.DevicePtr, temp2 driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

DivisiveNormalizationForward performs the forward spatial DivisiveNormalization layer computation.

It divides every value in a layer by the standard deviation of its spatial neighbors. Note that DivisiveNormalization only implements the x/max(c, sigma_x) portion of the computation, where sigma_x is the variance over the spatial neighborhood of x. The full LCN (Local Contrastive Normalization) computation can be implemented as a two-step process: The x-mean(x) which is often referred to as “subtractive normalization” portion of the computation can be implemented using cuDNN average pooling layer followed by a call to addTensor. Supported tensor formats are NCHW for 4D and NCDHW for 5D with any non-overlapping non-negative strides. Only 4D and 5D tensors are supported.

  • normDesc: Input. Handle to a previously initialized LRN parameter descriptor. This descriptor is used for both LRN and DivisiveNormalization layers
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptor objects for the input and output tensors. Note that xDesc is shared between x, means, temp, and temp2 tensors
  • x: Input. Input tensor data pointer in device memory
  • means: Input. Input means tensor data pointer in device memory. Note that this tensor can be NULL (in that case its values are assumed to be zero during the computation). This tensor also doesn’t have to contain means, these can be any values, a frequently used variation is a result of convolution with a normalized positive kernel (such as Gaussian)
  • temp: Workspace. Temporary tensors in device memory. These are used for computing intermediate values during the forward pass. These tensors do not have to be preserved as inputs from forward to the backward pass. Both use xDesc as their descriptor
  • temp2: Workspace. Temporary tensors in device memory. These are used for computing intermediate values during the forward pass. These tensors do not have to be preserved as inputs from forward to the backward pass. Both use xDesc as their descriptor
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Tensor descriptor objects for the input and output tensors. Note that xDesc is shared between x, means, temp, and temp2 tensors
  • y: Output. Pointer in device memory to a tensor for the result of the forward DivisiveNormalization computation

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the tensor pointers x, y, temp, and temp2 is NULL. Number of input tensor or output tensor dimensions is outside of [4,5] range. A mismatch in dimensions between any two of the input or output tensors. For in-place computation when pointers x == y, a mismatch in strides between the input data and output data tensors. alpha or beta pointer is NULL. LRN descriptor parameters are outside of their valid ranges. Any of the tensor strides are negative.
  • CUDNN_STATUS_UNSUPPORTED: The function does not support the provided configuration, for example, any of the input and output tensor strides mismatch (for the same dimension) is a non-supported configuration.

Wraps cudnnDivisiveNormalizationForward.

func (Handle) DropoutBackward

func (h Handle) DropoutBackward(dropoutDesc DropoutDescriptor, dydesc TensorDescriptor, dy driver.DevicePtr, dxdesc TensorDescriptor, dx driver.DevicePtr, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int) error

DropoutBackward performs backward dropout operation over dy returning results in dx.

If during forward dropout operation value from x was propagated to y then during backward operation value from dy will be propagated to dx, otherwise, dx value will be set to 0. Better performance is obtained for fully packed tensors.

  • dropoutDesc: Input. Previously created dropout descriptor object
  • dydesc: Input. Handle to a previously initialized tensor descriptor
  • dy: Input. Pointer to data of the tensor described by the dyDesc descriptor
  • dxdesc: Input. Handle to a previously initialized tensor descriptor
  • dx: Output. Pointer to data of the tensor described by the dxDesc descriptor
  • reserveSpace: Input. Pointer to user-allocated GPU memory used by this function. It is expected that reserveSpace was populated during a call to Handle.DropoutForward and has not been changed
  • reserveSpaceSizeInBytes: Input. Specifies the size in bytes of the provided memory for the reserve space

Errors:

  • ErrBadParam: At least one of the following conditions are met: The number of elements of input tensor and output tensors differ. The datatype of the input tensor and output tensors differs. The strides of the input tensor and output tensors differ and in-place operation is used (meaning, x and y pointers are equal). The provided reserveSpaceSizeInBytes is less than the value returned by TensorDescriptor.DropoutGetReserveSpaceSize. DropoutDescriptor.Set has not been called on dropoutDesc with non- NULL states argument.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnDropoutBackward.

func (Handle) DropoutForward

func (h Handle) DropoutForward(dropoutDesc DropoutDescriptor, xdesc TensorDescriptor, x driver.DevicePtr, ydesc TensorDescriptor, y driver.DevicePtr, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int) error

DropoutForward performs forward dropout operation over x returning results in y.

If dropout was used as a parameter to DropoutDescriptor.Set, the approximate dropout fraction of x values will be replaced by a 0, and the rest will be scaled by 1/(1-dropout). This function should not be running concurrently with another Handle.DropoutForward function using the same states.

  • dropoutDesc: Input. Previously created dropout descriptor object
  • xdesc: Input. Handle to a previously initialized tensor descriptor
  • x: Input. Pointer to data of the tensor described by the xDesc descriptor
  • ydesc: Input. Handle to a previously initialized tensor descriptor
  • y: Output. Pointer to data of the tensor described by the yDesc descriptor
  • reserveSpace: Output. Pointer to user-allocated GPU memory used by this function. It is expected that the contents of reserveSpace does not change between Handle.DropoutForward and Handle.DropoutBackward calls
  • reserveSpaceSizeInBytes: Input. Specifies the size in bytes of the provided memory for the reserve space

Errors:

  • ErrBadParam: At least one of the following conditions are met: The number of elements of input tensor and output tensors differ. The datatype of the input tensor and output tensors differs. The strides of the input tensor and output tensors differ and in-place operation is used (meaning, x and y pointers are equal). The provided reserveSpaceSizeInBytes is less than the value returned by TensorDescriptor.DropoutGetReserveSpaceSize. DropoutDescriptor.Set has not been called on dropoutDesc with non- NULL states argument.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnDropoutForward.

func (Handle) DropoutGetStatesSize

func (h Handle) DropoutGetStatesSize() (int, error)

DropoutGetStatesSize is used to query the amount of space required to store the states of the random number generators used by the Handle.DropoutForward function.

Wraps cudnnDropoutGetStatesSize.

func (Handle) FindConvolutionBackwardDataAlgorithm deprecated

func (h Handle) FindConvolutionBackwardDataAlgorithm(wDesc FilterDescriptor, dyDesc TensorDescriptor, convDesc ConvolutionDescriptor, dxDesc TensorDescriptor, requestedAlgoCount int) ([]ConvolutionBwdDataAlgoPerf, error)

FindConvolutionBackwardDataAlgorithm attempts all algorithms available for Handle.ConvolutionBackwardData.

This function attempts all algorithms available for Handle.ConvolutionBackwardData. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionBwdDataAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionBackwardDataAlgorithmMaxCount.

  • wDesc: Input. Handle to a previously initialized filter descriptor
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • dxDesc: Input. Handle to the previously initialized output tensor descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrAllocFailed: This function was unable to allocate memory to store sample input, filters, and output.
  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly wDesc, dyDesc, or dxDesc is not allocated properly wDesc, dyDesc, or dxDesc has fewer than 1 dimension Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects The function was unable to deallocate necessary timing objects The function was unable to deallocate sample input, filters, and output

Wraps cudnnFindConvolutionBackwardDataAlgorithm.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FindConvolutionBackwardDataAlgorithmEx deprecated

func (h Handle) FindConvolutionBackwardDataAlgorithmEx(wDesc FilterDescriptor, w driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, convDesc ConvolutionDescriptor, dxDesc TensorDescriptor, dx driver.DevicePtr, requestedAlgoCount int, workSpace driver.DevicePtr, workSpaceSizeInBytes int) ([]ConvolutionBwdDataAlgoPerf, error)

FindConvolutionBackwardDataAlgorithmEx attempts all algorithms available for Handle.ConvolutionBackwardData.

This function attempts all algorithms available for Handle.ConvolutionBackwardData. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionBwdDataAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionBackwardDataAlgorithmMaxCount.

  • wDesc: Input. Handle to a previously initialized filter descriptor
  • w: Input. Data pointer to GPU memory associated with the filter descriptor wDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • dy: Input. Data pointer to GPU memory associated with the filter descriptor dyDesc
  • convDesc: Input. Previously initialized convolution descriptor
  • dxDesc: Input. Handle to the previously initialized output tensor descriptor
  • dx: Input/Output. Data pointer to GPU memory associated with the tensor descriptor dxDesc. The content of this tensor will be overwritten with arbitrary values
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults
  • workSpace: Input. Data pointer to GPU memory is a necessary workspace for some algorithms. The size of this workspace will determine the availability of algorithms. A NIL pointer is considered a workSpace of 0 bytes
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly wDesc, dyDesc, or dxDesc is not allocated properly wDesc, dyDesc, or dxDesc has fewer than 1 dimension Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects The function was unable to deallocate necessary timing objects The function was unable to deallocate sample input, filters, and output

Wraps cudnnFindConvolutionBackwardDataAlgorithmEx.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FindConvolutionBackwardFilterAlgorithm deprecated

func (h Handle) FindConvolutionBackwardFilterAlgorithm(xDesc TensorDescriptor, dyDesc TensorDescriptor, convDesc ConvolutionDescriptor, dwDesc FilterDescriptor, requestedAlgoCount int) ([]ConvolutionBwdFilterAlgoPerf, error)

FindConvolutionBackwardFilterAlgorithm attempts all algorithms available for Handle.ConvolutionBackwardFilter.

This function attempts all algorithms available for Handle.ConvolutionBackwardFilter. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionBwdFilterAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionBackwardFilterAlgorithmMaxCount.

  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • dwDesc: Input. Handle to a previously initialized filter descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrAllocFailed: This function was unable to allocate memory to store sample input, filters and output.
  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly xDesc, dyDesc, or dwDesc are not allocated properly xDesc, dyDesc, or dwDesc has fewer than 1 dimension Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects. The function was unable to deallocate necessary timing objects. The function was unable to deallocate sample input, filters, and output.

Wraps cudnnFindConvolutionBackwardFilterAlgorithm.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FindConvolutionBackwardFilterAlgorithmEx deprecated

func (h Handle) FindConvolutionBackwardFilterAlgorithmEx(xDesc TensorDescriptor, x driver.DevicePtr, dyDesc TensorDescriptor, y driver.DevicePtr, convDesc ConvolutionDescriptor, dwDesc FilterDescriptor, dw driver.DevicePtr, requestedAlgoCount int, workSpace driver.DevicePtr, workSpaceSizeInBytes int) ([]ConvolutionBwdFilterAlgoPerf, error)

FindConvolutionBackwardFilterAlgorithmEx attempts all algorithms available for Handle.ConvolutionBackwardFilter.

This function attempts all algorithms available for Handle.ConvolutionBackwardFilter. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionBwdFilterAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionBackwardFilterAlgorithmMaxCount.

  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the filter descriptor xDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • dwDesc: Input. Handle to a previously initialized filter descriptor
  • dw: Input/Output. Data pointer to GPU memory associated with the filter descriptor dwDesc. The content of this tensor will be overwritten with arbitrary values
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults
  • workSpace: Input. Data pointer to GPU memory is a necessary workspace for some algorithms. The size of this workspace will determine the availability of algorithms. A NIL pointer is considered a workSpace of 0 bytes
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly xDesc, dyDesc, or dwDesc are not allocated properly xDesc, dyDesc, or dwDesc has fewer than 1 dimension x, dy, or dw is NIL Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects. The function was unable to deallocate necessary timing objects. The function was unable to deallocate sample input, filters, and output.

Wraps cudnnFindConvolutionBackwardFilterAlgorithmEx.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FindConvolutionForwardAlgorithm deprecated

func (h Handle) FindConvolutionForwardAlgorithm(xDesc TensorDescriptor, wDesc FilterDescriptor, convDesc ConvolutionDescriptor, yDesc TensorDescriptor, requestedAlgoCount int) ([]ConvolutionFwdAlgoPerf, error)

FindConvolutionForwardAlgorithm attempts all algorithms available for Handle.ConvolutionForward.

This function attempts all algorithms available for Handle.ConvolutionForward. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionFwdAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionForwardAlgorithmMaxCount.

  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • wDesc: Input. Handle to a previously initialized filter descriptor
  • convDesc: Input. Previously initialized convolution descriptor
  • yDesc: Input. Handle to the previously initialized output tensor descriptor
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults

Errors:

  • ErrAllocFailed: This function was unable to allocate memory to store sample input, filters, and output.
  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly xDesc, dyDesc, or dwDesc are not allocated properly xDesc, dyDesc, or dwDesc has fewer than 1 dimension Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects. The function was unable to deallocate necessary timing objects. The function was unable to deallocate sample input, filters, and output.

Wraps cudnnFindConvolutionForwardAlgorithm.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FindConvolutionForwardAlgorithmEx deprecated

func (h Handle) FindConvolutionForwardAlgorithmEx(xDesc TensorDescriptor, x driver.DevicePtr, wDesc FilterDescriptor, w driver.DevicePtr, convDesc ConvolutionDescriptor, yDesc TensorDescriptor, y driver.DevicePtr, requestedAlgoCount int, workSpace driver.DevicePtr, workSpaceSizeInBytes int) ([]ConvolutionFwdAlgoPerf, error)

FindConvolutionForwardAlgorithmEx attempts all algorithms available for Handle.ConvolutionForward.

This function attempts all algorithms available for Handle.ConvolutionForward. It will attempt both the provided convDesc mathType and DefaultMath (assuming the two differ). Algorithms without the TensorOpMath availability will only be tried with DefaultMath, and returned as such. Memory is allocated via cudaMalloc(). The performance metrics are returned in the user-allocated array of ConvolutionFwdAlgoPerf. These metrics are written in a sorted fashion where the first element has the lowest compute time. The total number of resulting algorithms can be queried through the API Handle.ConvolutionForwardAlgorithmMaxCount.

  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • wDesc: Input. Handle to a previously initialized filter descriptor
  • w: Input. Data pointer to GPU memory associated with the filter descriptor wDesc
  • convDesc: Input. Previously initialized convolution descriptor
  • yDesc: Input. Handle to the previously initialized output tensor descriptor
  • y: Input/Output. Data pointer to GPU memory associated with the tensor descriptor yDesc. The content of this tensor will be overwritten with arbitrary values
  • requestedAlgoCount: Input. The maximum number of elements to be stored in perfResults
  • workSpace: Input. Data pointer to GPU memory is a necessary workspace for some algorithms. The size of this workspace will determine the availability of algorithms. A NIL pointer is considered a workSpace of 0 bytes
  • workSpaceSizeInBytes: Input. Specifies the size in bytes of the provided workSpace

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is not allocated properly xDesc, dyDesc, or dwDesc are not allocated properly xDesc, dyDesc, or dwDesc has fewer than 1 dimension x, w, or y is NIL Either returnedCount or perfResults is NIL requestedCount is less than 1
  • ErrInternalError: At least one of the following conditions are met: The function was unable to allocate necessary timing objects. The function was unable to deallocate necessary timing objects. The function was unable to deallocate sample input, filters, and output.

Wraps cudnnFindConvolutionForwardAlgorithmEx.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) FoldedConvBackwardDataDescriptors deprecated

func (h Handle) FoldedConvBackwardDataDescriptors(filterDesc FilterDescriptor, diffDesc TensorDescriptor, convDesc ConvolutionDescriptor, gradDesc TensorDescriptor, transformFormat TensorFormat, foldedFilterDesc FilterDescriptor, paddedDiffDesc TensorDescriptor, foldedConvDesc ConvolutionDescriptor, foldedGradDesc TensorDescriptor, filterFoldTransDesc TensorTransformDescriptor, diffPadTransDesc TensorTransformDescriptor, gradFoldTransDesc TensorTransformDescriptor, gradUnfoldTransDesc TensorTransformDescriptor) error

FoldedConvBackwardDataDescriptors calculates folding descriptors for backward data gradients.

It takes as input the data descriptors along with the convolution descriptor and computes the folded data descriptors and the folding transform descriptors. These can then be used to do the actual folding transform.

  • filterDesc: Input. Filter descriptor before folding
  • diffDesc: Input. Diff descriptor before folding
  • convDesc: Input. Convolution descriptor before folding
  • gradDesc: Input. Gradient descriptor before folding
  • transformFormat: Input. Transform format for folding
  • foldedFilterDesc: Output. Folded filter descriptor
  • paddedDiffDesc: Output. Padded Diff descriptor
  • foldedConvDesc: Output. Folded convolution descriptor
  • foldedGradDesc: Output. Folded gradient descriptor
  • filterFoldTransDesc: Output. Folding transform descriptor for filter
  • diffPadTransDesc: Output. Folding transform descriptor for Desc
  • gradFoldTransDesc: Output. Folding transform descriptor for gradient
  • gradUnfoldTransDesc: Output. Unfolding transform descriptor for folded gradient

A nil error means folded descriptors were computed successfully.

Errors:

  • ErrBadParam: If any of the input parameters is NULL or if the input tensor has more than 4 dimensions.
  • ErrExecutionFailed: Computing the folded descriptors failed.

Wraps cudnnGetFoldedConvBackwardDataDescriptors.

Deprecated: Deprecated by NVIDIA.

func (Handle) FusedOpsExecute deprecated

func (h Handle) FusedOpsExecute(plan FusedOpsPlan, varPack FusedOpsVariantParamPack) error

FusedOpsExecute executes the sequence of cudnnFusedOps operations.

  • plan: Input. Pointer to a previously-created and initialized plan descriptor
  • varPack: Input. Pointer to the descriptor to the variant parameters pack

Errors:

Wraps cudnnFusedOpsExecute.

Deprecated: Deprecated by NVIDIA.

func (Handle) Im2Col deprecated

func (h Handle) Im2Col(xDesc TensorDescriptor, x driver.DevicePtr, wDesc FilterDescriptor, convDesc ConvolutionDescriptor, colBuffer driver.DevicePtr) error

Im2Col constructs the A matrix necessary to perform a forward pass of GEMM convolution.

This function constructs the A matrix necessary to perform a forward pass of GEMM convolution. This A matrix has a height of batch_size*y_height*y_width and width of input_channels*filter_height*filter_width, where: The A matrix is stored in format HW fully-packed in GPU memory.

  • convDesc: Input. Handle to a previously initialized convolution descriptor
  • colBuffer: Output. Data pointer to GPU memory storing the output matrix

A nil error means the output data array is successfully generated.

Errors:

Wraps cudnnIm2Col.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) LRNCrossChannelBackward

func (h Handle) LRNCrossChannelBackward(normDesc LRNDescriptor, lrnMode LRNMode, alpha unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr, dyDesc TensorDescriptor, dy driver.DevicePtr, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, dxDesc TensorDescriptor, dx driver.DevicePtr) error

LRNCrossChannelBackward performs the backward LRN layer computation.

Supported formats are: positive-strided, NCHW and NHWC for 4D x and y, and only NCDHW DHW-packed for 5D (for both x and y). Only non-overlapping 4D and 5D tensors are supported. NCHW layout is preferred for performance.

  • normDesc: Input. Handle to a previously initialized LRN parameter descriptor
  • lrnMode: Input. LRN layer mode of operation. Currently only LrnCrossChannelDIM1 is implemented. Normalization is performed along the tensor’s dimA[1]
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Tensor descriptor and pointer in device memory for the layer’s y data
  • y: Input. Tensor descriptor and pointer in device memory for the layer’s y data
  • dyDesc: Input. Tensor descriptor and pointer in device memory for the layer’s input cumulative loss differential data dy (including error backpropagation)
  • dy: Input. Tensor descriptor and pointer in device memory for the layer’s input cumulative loss differential data dy (including error backpropagation)
  • xDesc: Input. Tensor descriptor and pointer in device memory for the layer’s x data. Note that these values are not modified during backpropagation
  • x: Input. Tensor descriptor and pointer in device memory for the layer’s x data. Note that these values are not modified during backpropagation
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dxDesc: Output. Tensor descriptor and pointer in device memory for the layer’s resulting cumulative loss differential data dx (including error backpropagation)
  • dx: Output. Tensor descriptor and pointer in device memory for the layer’s resulting cumulative loss differential data dx (including error backpropagation)

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the tensor pointers x, y is NULL. Number of input tensor dimensions is 2 or less. LRN descriptor parameters are outside of their valid ranges. One of the tensor parameters is 5D but is not in NCDHW DHW-packed format.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: Any of the input tensor datatypes is not the same as any of the output tensor datatype. Any pairwise tensor dimensions mismatch for x, y, dx, or dy. Any tensor parameters strides are negative.

Wraps cudnnLRNCrossChannelBackward.

func (Handle) LRNCrossChannelForward

func (h Handle) LRNCrossChannelForward(normDesc LRNDescriptor, lrnMode LRNMode, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

LRNCrossChannelForward performs the forward LRN layer computation.

Supported formats are: positive-strided, NCHW and NHWC for 4D x and y, and only NCDHW DHW-packed for 5D (for both x and y). Only non-overlapping 4D and 5D tensors are supported. NCHW layout is preferred for performance.

  • normDesc: Input. Handle to a previously initialized LRN parameter descriptor
  • lrnMode: Input. LRN layer mode of operation. Currently only LrnCrossChannelDIM1 is implemented. Normalization is performed along the tensor’s dimA[1]
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptor objects for the input and output tensors
  • x: Input. Input tensor data pointer in device memory
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Tensor descriptor objects for the input and output tensors
  • y: Output. Output tensor data pointer in device memory

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the tensor pointers x, y is NULL. Number of input tensor dimensions is 2 or less. LRN descriptor parameters are outside of their valid ranges. One of the tensor parameters is 5D but is not in NCDHW DHW-packed format.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: Any of the input tensor datatypes is not the same as any of the output tensor datatype. x and y tensor dimensions mismatch. Any tensor parameters strides are negative.

Wraps cudnnLRNCrossChannelForward.

func (Handle) MakeFusedOpsPlan deprecated

func (h Handle) MakeFusedOpsPlan(plan FusedOpsPlan, constPack FusedOpsConstParamPack) (int, error)

MakeFusedOpsPlan determines the optimum kernel to execute, and the workspace size the user should allocate, prior to the actual execution of the fused operations by Handle.FusedOpsExecute.

This function determines the optimum kernel to execute, and the workspace size the user should allocate, prior to the actual execution of the fused operations by Handle.FusedOpsExecute.

  • plan: Input. Pointer to a previously-created and initialized plan descriptor
  • constPack: Input. Pointer to the descriptor to the const parameters pack

Errors:

  • ErrBadParam: If any of the inputs is NULL, or if the type of FusedOps in the constPack descriptor is unsupported.

Wraps cudnnMakeFusedOpsPlan.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) MultiHeadAttnBackwardData deprecated

func (h Handle) MultiHeadAttnBackwardData(attnDesc AttnDescriptor, loWinIdx *int32, hiWinIdx *int32, devSeqLengthsDQDO driver.DevicePtr, devSeqLengthsDKDV driver.DevicePtr, doDesc SeqDataDescriptor, dout driver.DevicePtr, dqDesc SeqDataDescriptor, dqueries driver.DevicePtr, queries driver.DevicePtr, dkDesc SeqDataDescriptor, dkeys driver.DevicePtr, keys driver.DevicePtr, dvDesc SeqDataDescriptor, dvalues driver.DevicePtr, values driver.DevicePtr, weightSizeInBytes int, weights driver.DevicePtr, workSpaceSizeInBytes int, workSpace driver.DevicePtr, reserveSpaceSizeInBytes int, reserveSpace driver.DevicePtr) error

MultiHeadAttnBackwardData computes exact, first-order derivatives of the multihead attention block with respect to its inputs: Q, K, V.

This function computes exact, first-order derivatives of the multihead attention block with respect to its inputs: Q, K, V. If y=F(w) is a vector-valued function that represents the multihead attention layer and it takes some vector χϵRⁿ as an input (with all other parameters and inputs constant), and outputs vector χϵRᵐ, then Handle.MultiHeadAttnBackwardData computes the result of (∂yᵢ/∂xⱼ)ᵀδₒᵤₜ where δₒᵤₜ is the mx1 gradient of the loss function with respect to multihead attention outputs. The δₒᵤₜ gradient is back propagated through prior layers of the deep learning model. ∂yᵢ/∂xⱼ is the mxn Jacobian matrix of F(x). The input is supplied via the dout argument and gradient results for Q, K, V are written to the dqueries, dkeys, and dvalues buffers. The Handle.MultiHeadAttnBackwardData function does not output partial derivatives for residual connections because this result is equal to δₒᵤₜ. If the multihead attention model enables residual connections sourced directly from Q, then the dout tensor needs to be added to dqueries to obtain the correct result of the latter. This operation is demonstrated in the cuDNN multiHeadAttention sample code. The Handle.MultiHeadAttnBackwardData function must be invoked after Handle.MultiHeadAttnForward. The loWinIdx[], hiWinIdx[], queries, keys, values, weights, and reserveSpace arguments should be the same as in the Handle.MultiHeadAttnForward call. devSeqLengthsDQDO[] and devSeqLengthsDKDV[] device arrays should contain the same start and end attention window indices as devSeqLengthsQO[] and devSeqLengthsKV[] arrays in the forward function invocation.

  • attnDesc: Input. A previously initialized attention descriptor
  • loWinIdx: Input. Two host integer arrays specifying the start and end indices of the attention window for each Q time-step. The start index in K, V sets is inclusive, and the end index is exclusive
  • hiWinIdx: Input. Two host integer arrays specifying the start and end indices of the attention window for each Q time-step. The start index in K, V sets is inclusive, and the end index is exclusive
  • devSeqLengthsDQDO: Input. Device array containing a copy of the sequence length array from the dqDesc or doDesc sequence data descriptor
  • devSeqLengthsDKDV: Input. Device array containing a copy of the sequence length array from the dkDesc or dvDesc sequence data descriptor
  • doDesc: Input. Descriptor for the δₒᵤₜ gradients (vectors of partial derivatives of the loss function with respect to the multihead attention outputs)
  • dout: Input. Pointer to the δₒᵤₜ gradient data in the device memory
  • dqDesc: Input. Descriptor for queries and dqueries sequence data
  • dqueries: Output. Device pointer to gradients of the loss function computed with respect to queries vectors
  • queries: Input. Pointer to queries data in the device memory. This is the same input as in Handle.MultiHeadAttnForward
  • dkDesc: Input. Descriptor for keys and dkeys sequence data
  • dkeys: Output. Device pointer to gradients of the loss function computed with respect to keys vectors
  • keys: Input. Pointer to keys data in the device memory. This is the same input as in Handle.MultiHeadAttnForward
  • dvDesc: Input. Descriptor for values and dvalues sequence data
  • dvalues: Output. Device pointer to gradients of the loss function computed with respect to values vectors
  • values: Input. Pointer to values data in the device memory. This is the same input as in Handle.MultiHeadAttnForward
  • weightSizeInBytes: Input. Size of the weight buffer in bytes where all multihead attention trainable parameters are stored
  • weights: Input. Address of the weight buffer in the device memory
  • workSpaceSizeInBytes: Input. Size of the workspace buffer in bytes used for temporary API storage
  • workSpace: Input/Output. Address of the workspace buffer in the device memory
  • reserveSpaceSizeInBytes: Input. Size of the reserve-space buffer in bytes used for data exchange between forward and backward (gradient) API calls
  • reserveSpace: Input/Output. Address to the reserve-space buffer in the device memory

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrAllocFailed: Insufficient amount of shared memory to launch a GPU kernel.
  • ErrBadParam: An invalid or incompatible input argument was encountered.
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrInternalError: An inconsistent internal state was encountered.
  • ErrNotSupported: A requested option or a combination of input arguments is not supported.

Wraps cudnnMultiHeadAttnBackwardData.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) MultiHeadAttnBackwardWeights deprecated

func (h Handle) MultiHeadAttnBackwardWeights(attnDesc AttnDescriptor, addGrad WgradMode, qDesc SeqDataDescriptor, queries driver.DevicePtr, kDesc SeqDataDescriptor, keys driver.DevicePtr, vDesc SeqDataDescriptor, values driver.DevicePtr, doDesc SeqDataDescriptor, dout driver.DevicePtr, weightSizeInBytes int, weights driver.DevicePtr, dweights driver.DevicePtr, workSpaceSizeInBytes int, workSpace driver.DevicePtr, reserveSpaceSizeInBytes int, reserveSpace driver.DevicePtr) error

MultiHeadAttnBackwardWeights computes exact, first-order derivatives of the multihead attention block with respect to its trainable parameters: projection weights and projection biases.

This function computes exact, first-order derivatives of the multihead attention block with respect to its trainable parameters: projection weights and projection biases. If y=F(w) is a vector-valued function that represents the multihead attention layer and it takes some vector χϵRⁿ of “flatten” weights or biases as an input (with all other parameters and inputs fixed), and outputs vector χϵRᵐ, then Handle.MultiHeadAttnBackwardWeights computes the result of (∂yᵢ/∂wⱼ)ᵀδₒᵤₜ where δₒᵤₜ is the mx1 gradient of the loss function with respect to multihead attention outputs. The δₒᵤₜ gradient is back propagated through prior layers of the deep learning model. ∂yᵢ/∂wⱼ is the mxn Jacobian matrix of F(w). The δₒᵤₜ input is supplied via the dout argument. All gradient results with respect to weights and biases are written to the dweights buffer. The size and the organization of the dweights buffer is the same as the weights buffer that holds multihead attention weights and biases. The cuDNN multiHeadAttention sample code demonstrates how to access those weights. Gradient of the loss function with respect to weights or biases is typically computed over multiple batches. In such a case, partial results computed for each batch should be summed together. The addGrad argument specifies if the gradients from the current batch should be added to previously computed results or the dweights buffer should be overwritten with the new results. The Handle.MultiHeadAttnBackwardWeights function should be invoked after Handle.MultiHeadAttnBackwardData. The queries, keys, values, weights, and reserveSpace arguments should be the same as in Handle.MultiHeadAttnForward and Handle.MultiHeadAttnBackwardData calls. The dout argument should be the same as in Handle.MultiHeadAttnBackwardData.

  • attnDesc: Input. A previously initialized attention descriptor
  • addGrad: Input. Weight gradient output mode
  • qDesc: Input. Descriptor for the query sequence data
  • queries: Input. Pointer to queries sequence data in the device memory
  • kDesc: Input. Descriptor for the keys sequence data
  • keys: Input. Pointer to keys sequence data in the device memory
  • vDesc: Input. Descriptor for the values sequence data
  • values: Input. Pointer to values sequence data in the device memory
  • doDesc: Input. Descriptor for the δₒᵤₜ gradients (vectors of partial derivatives of the loss function with respect to the multihead attention outputs)
  • dout: Input. Pointer to the δₒᵤₜ gradient vectors in the device memory
  • weightSizeInBytes: Input. Size of the weights and dweights buffers in bytes
  • weights: Input. Address of the weight buffer in the device memory
  • dweights: Output. Address of the weight gradient buffer in the device memory
  • workSpaceSizeInBytes: Input. Size of the workspace buffer in bytes used for temporary API storage
  • workSpace: Input/Output. Address of the workspace buffer in the device memory
  • reserveSpaceSizeInBytes: Input. Size of the reserve-space buffer in bytes used for data exchange between forward and backward (gradient) API calls
  • reserveSpace: Input/Output. Address to the reserve-space buffer in the device memory

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrBadParam: An invalid or incompatible input argument was encountered.
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrInternalError: An inconsistent internal state was encountered.
  • ErrNotSupported: A requested option or a combination of input arguments is not supported.

Wraps cudnnMultiHeadAttnBackwardWeights.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) MultiHeadAttnBuffers deprecated

func (h Handle) MultiHeadAttnBuffers(attnDesc AttnDescriptor) (int, int, int, error)

MultiHeadAttnBuffers computes weight, work, and reserve space buffer sizes used by the following functions: Handle.MultiHeadAttnForward, Handle.MultiHeadAttnBackwardData, and Handle.MultiHeadAttnBackwardWeights.

This function computes weight, work, and reserve space buffer sizes used by the following functions: Handle.MultiHeadAttnForward, Handle.MultiHeadAttnBackwardData, and Handle.MultiHeadAttnBackwardWeights. Assigning NULL to the reserveSpaceSizeInBytes argument indicates that the user does not plan to invoke multihead attention gradient functions: Handle.MultiHeadAttnBackwardData and Handle.MultiHeadAttnBackwardWeights. This situation occurs in the inference mode. The user must allocate weight, work, and reserve space buffer sizes in the GPU memory using cudaMalloc() with the reported buffer sizes. The buffers can be also carved out from a larger chunk of allocated memory but the buffer addresses must be at least 16B aligned. The workspace buffer is used for temporary storage. Its content can be discarded or modified after all GPU kernels launched by the corresponding API complete. The reserve-space buffer is used to transfer intermediate results from Handle.MultiHeadAttnForward to Handle.MultiHeadAttnBackwardData, and from Handle.MultiHeadAttnBackwardData to Handle.MultiHeadAttnBackwardWeights. The content of the reserve-space buffer cannot be modified until all GPU kernels launched by the above three multihead attention API functions finish. All multihead attention weight and bias tensors are stored in a single weight buffer. For speed optimizations, the cuDNN API may change tensor layouts and their relative locations in the weight buffer based on the provided attention parameters. Use the Handle.MultiHeadAttnWeights function to obtain the start address and the shape of each weight or bias tensor.

  • attnDesc: Input. Pointer to a previously initialized attention descriptor

A nil error means the requested buffer sizes were computed successfully.

Errors:

Wraps cudnnGetMultiHeadAttnBuffers.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) MultiHeadAttnForward deprecated

func (h Handle) MultiHeadAttnForward(attnDesc AttnDescriptor, currIdx int32, loWinIdx *int32, hiWinIdx *int32, devSeqLengthsQO driver.DevicePtr, devSeqLengthsKV driver.DevicePtr, qDesc SeqDataDescriptor, queries driver.DevicePtr, residuals driver.DevicePtr, kDesc SeqDataDescriptor, keys driver.DevicePtr, vDesc SeqDataDescriptor, values driver.DevicePtr, oDesc SeqDataDescriptor, out driver.DevicePtr, weightSizeInBytes int, weights driver.DevicePtr, workSpaceSizeInBytes int, workSpace driver.DevicePtr, reserveSpaceSizeInBytes int, reserveSpace driver.DevicePtr) error

MultiHeadAttnForward computes the forward responses of the multihead attention layer.

When reserveSpaceSizeInBytes=0 and reserveSpace=NULL, the function operates in the inference mode in which backward (gradient) functions are not invoked, otherwise, the training mode is assumed. In the training mode, the reserve space is used to pass intermediate results from Handle.MultiHeadAttnForward to Handle.MultiHeadAttnBackwardData and from Handle.MultiHeadAttnBackwardData to Handle.MultiHeadAttnBackwardWeights. In the inference mode, the currIdx specifies the time-step or sequence index of the embedding vectors to be processed. In this mode, the user can perform one iteration for time-step zero ( currIdx=0), then update Q, K, V vectors and the attention window, and execute the next step ( currIdx=1). The iterative process can be repeated for all time-steps. When all Q time-steps are available (for example, in the training mode or in the inference mode on the encoder side in self-attention), the user can assign a negative value to currIdx and the Handle.MultiHeadAttnForward API will automatically sweep through all Q time-steps. The loWinIdx[] and hiWinIdx[] host arrays specify the attention window size for each Q time-step. In a typical self-attention case, the user must include all previously visited embedding vectors but not the current or future vectors. In this situation, the user should set: When currIdx is negative in Handle.MultiHeadAttnForward, the loWinIdx[] and hiWinIdx[] arrays must be fully initialized for all time-steps. When Handle.MultiHeadAttnForward is invoked with currIdx=0, currIdx=1, currIdx=2, and so on, then the user can update loWinIdx[currIdx] and hiWinIdx[currIdx] elements only before invoking the forward response function. All other elements in the loWinIdx[] and hiWinIdx[] arrays will not be accessed. Any adaptive attention window scheme can be implemented that way. Use the following settings when the attention window should be the maximum size, for example, in cross-attention: The maxSeqLenK value above should be equal to or larger than dimA[SeqdataTimeDim] in the kDesc descriptor. A good choice is to use maxSeqLenK=INT_MAX from limits.h. devSeqLengthsQO[] and devSeqLengthsKV[] are pointers to device (not host) arrays with Q, O, and K, V sequence lengths. Note that the same information is also passed in the corresponding descriptors of type SeqDataDescriptor on the host side. The need for extra device arrays comes from the asynchronous nature of cuDNN calls and limited size of the constant memory dedicated to GPU kernel arguments. When the Handle.MultiHeadAttnForward API returns, the sequence length arrays stored in the descriptors can be immediately modified for the next iteration. However, the GPU kernels launched by the forward call may not have started at this point. For this reason, copies of sequence arrays are needed on the device side to be accessed directly by GPU kernels. Those copies cannot be created inside the Handle.MultiHeadAttnForward function for very large K, V inputs without the device memory allocation and CUDA stream synchronization. To reduce the Handle.MultiHeadAttnForward API overhead, devSeqLengthsQO[] and devSeqLengthsKV[] device arrays are not validated to contain the same settings as seqLengthArray[] in the sequence data descriptors. Sequence lengths in the kDesc and vDesc descriptors should be the same. Similarly, sequence lengths in the qDesc and oDesc descriptors should match. The user can define six different data layouts in the qDesc, kDesc, vDesc, and oDesc descriptors. Refer to the SeqDataDescriptor.Set function for the discussion of those layouts. All multihead attention API calls require that the same layout is used in all sequence data descriptors. In the transformer model, the multihead attention block is tightly coupled with the layer normalization and residual connections. Handle.MultiHeadAttnForward does not encompass the layer normalization but it can be used to handle residual connections as depicted in the following figure. Multihead Attention Block is Tightly Coupled with the Layer Normalization and Residual Connections Queries and residuals share the same qDesc descriptor in Handle.MultiHeadAttnForward. When residual connections are disabled, the residuals pointer should be NULL. When residual connections are enabled, the vector length in qDesc should match the vector length specified in the oDesc descriptor, so that a vector addition is feasible. The queries, keys, and values pointers are not allowed to be NULL, even when K and V are the same inputs or Q, K, V are the same inputs.

  • attnDesc: Input. A previously initialized attention descriptor
  • currIdx: Input. Time-step in queries to process. When the currIdx argument is negative, all Q time-steps are processed. When currIdx is zero or positive, the forward response is computed for the selected time-step only. The latter input can be used in inference mode only, to process one time-step while updating the next attention window and Q, R, K, V inputs in-between calls
  • loWinIdx: Input. Two host integer arrays specifying the start and end indices of the attention window for each Q time-step. The start index in K, V sets is inclusive, and the end index is exclusive
  • hiWinIdx: Input. Two host integer arrays specifying the start and end indices of the attention window for each Q time-step. The start index in K, V sets is inclusive, and the end index is exclusive
  • devSeqLengthsQO: Input. Device array specifying sequence lengths of query, residual, and output sequence data
  • devSeqLengthsKV: Input. Device array specifying sequence lengths of key and value input data
  • qDesc: Input. Descriptor for the query and residual sequence data
  • queries: Input. Pointer to queries data in the device memory
  • residuals: Input. Pointer to residual data in device memory. Set this argument to NULL if no residual connections are required
  • kDesc: Input. Descriptor for the keys sequence data
  • keys: Input. Pointer to keys data in the device memory
  • vDesc: Input. Descriptor for the values sequence data
  • values: Input. Pointer to values data in the device memory
  • oDesc: Input. Descriptor for the multihead attention output sequence data
  • out: Output. Pointer to device memory where the output response should be written
  • weightSizeInBytes: Input. Size of the weight buffer in bytes where all multihead attention trainable parameters are stored
  • weights: Input. Pointer to the weight buffer in device memory
  • workSpaceSizeInBytes: Input. Size of the workspace buffer in bytes used for temporary API storage
  • workSpace: Input/Output. Pointer to the workspace buffer in device memory
  • reserveSpaceSizeInBytes: Input. Size of the reserve-space buffer in bytes used for data exchange between forward and backward (gradient) API calls. This parameter should be zero in the inference mode and non-zero in the training mode
  • reserveSpace: Input/Output. Pointer to the reserve-space buffer in device memory. This argument should be NULL in inference mode and non-NULL in the training mode

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrAllocFailed: Insufficient amount of shared memory to launch a GPU kernel.
  • ErrBadParam: An invalid or incompatible input argument was encountered. Some examples include: a required input pointer was NULL currIdx was out of bound the descriptor value for attention, query, key, value, and output were incompatible with one another
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrInternalError: An inconsistent internal state was encountered.
  • ErrNotSupported: A requested option or a combination of input arguments is not supported.

Wraps cudnnMultiHeadAttnForward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) MultiHeadAttnWeights deprecated

func (h Handle) MultiHeadAttnWeights(attnDesc AttnDescriptor, wKind MultiHeadAttnWeightKind, weightSizeInBytes int, weights driver.DevicePtr, wDesc TensorDescriptor) (uintptr, error)

MultiHeadAttnWeights obtains the shape of the weight or bias tensor.

This function obtains the shape of the weight or bias tensor. It also retrieves the start address of tensor data located in the weight buffer. Use the wKind argument to select a particular tensor. For more information, refer to MultiHeadAttnWeightKind for the description of the enumerant type. Biases are used in the input and output projections when the CUDNN_ATTN_ENABLE_PROJ_BIASES flag is set in the attention descriptor. Refer to AttnDescriptor.Set for the description of flags to control projection biases. When the corresponding weight or bias tensor does not exist, the function returns NULL and returns zeros in the wDesc tensor descriptor. The return status of the Handle.MultiHeadAttnWeights function is Success in this case. The cuDNN multiHeadAttention sample code demonstrates how to access multihead attention weights. Although the buffer with weights and biases should be allocated in the GPU memory, the user can copy it to the host memory and invoke the Handle.MultiHeadAttnWeights function with the host weights address to obtain tensor pointers in the host memory. This scheme allows the user to inspect trainable parameters directly in the CPU memory.

  • attnDesc: Input. A previously configured attention descriptor
  • wKind: Input. Enumerant type to specify which weight or bias tensor should be retrieved
  • weightSizeInBytes: Input. Buffer size that stores all multihead attention weights and biases
  • weights: Input. Pointer to the weight buffer in the host or device memory
  • wDesc: Output. The descriptor specifying weight or bias tensor shape. For weights, the wDesc.dimA[] array has three elements: [nHeads, projected size, original size]. For biases, the wDesc.dimA[] array also has three elements: [nHeads, projected size, 1]. The wDesc.strideA[] array describes how tensor elements are arranged in memory

A nil error means the weight tensor descriptor and the address of data in the device memory were successfully retrieved.

Errors:

  • ErrBadParam: An invalid or incompatible input argument was encountered. For example, wKind did not have a valid value or weightSizeInBytes was too small.

Wraps cudnnGetMultiHeadAttnWeights.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) NormalizationBackward deprecated

func (h Handle) NormalizationBackward(mode NormMode, normOps NormOps, algo NormAlgo, alphaDataDiff unsafe.Pointer, betaDataDiff unsafe.Pointer, alphaParamDiff unsafe.Pointer, betaParamDiff unsafe.Pointer, xDesc TensorDescriptor, xData driver.DevicePtr, yDesc TensorDescriptor, yData driver.DevicePtr, dyDesc TensorDescriptor, dyData driver.DevicePtr, dzDesc TensorDescriptor, dzData driver.DevicePtr, dxDesc TensorDescriptor, dxData driver.DevicePtr, dNormScaleBiasDesc TensorDescriptor, normScaleData driver.DevicePtr, normBiasData driver.DevicePtr, dNormScaleData driver.DevicePtr, dNormBiasData driver.DevicePtr, epsilon float64, normMeanVarDesc TensorDescriptor, savedMean driver.DevicePtr, savedInvVariance driver.DevicePtr, activationDesc ActivationDescriptor, workSpace driver.DevicePtr, workSpaceSizeInBytes int, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int, groupCnt int32) error

NormalizationBackward performs backward normalization layer computation that is specified by mode.

This function performs backward normalization layer computation that is specified by mode. Per-channel normalization layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The epsilon value has to be the same during training, backpropagation, and inference. This workspace is not required to be clean. Moreover, the workspace does not have to remain unchanged between the forward and backward pass, as it is not used for passing any information. This function can accept a *workspace pointer to the GPU workspace, and workSpaceSizeInBytes, the size of the workspace, from the user. The normOps input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation. When the tensor layout is NCHW, higher performance can be obtained when HW-packed tensors are used for x, dy, dx. Higher performance for NormPerChannel mode can be obtained when the following conditions are true:

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • alphaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaDataDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient output dx with a prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • alphaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dNormScaleData and dNormBiasData with prior values in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • betaParamDiff: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dNormScaleData and dNormBiasData with prior values in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • xData: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • yData: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • dyDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • dyData: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, backpropagated gradient input dy, the original forward output y data. yDesc and yData are not needed if normOps is set to NormOpsNorm, users may pass NULL. For more information, refer to TensorDescriptor
  • dzDesc: Input. Tensor descriptors and pointers in the device memory for the computed gradient output dz and dx. dzDesc is not needed when normOps is NormOpsNorm or NormOpsNormActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dzData: Output. Tensor descriptors and pointers in the device memory for the computed gradient output dz and dx. *dzData is not needed when normOps is NormOpsNorm or NormOpsNormActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dxDesc: Input. Tensor descriptors and pointers in the device memory for the computed gradient output dz and dx. dzDesc is not needed when normOps is NormOpsNorm or NormOpsNormActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dxData: Output. Tensor descriptors and pointers in the device memory for the computed gradient output dz and dx. *dzData is not needed when normOps is NormOpsNorm or NormOpsNormActivation, users may pass NULL. For more information, refer to TensorDescriptor
  • dNormScaleBiasDesc: Input. Shared tensor descriptor for the following six tensors: normScaleData, normBiasData, dNormScaleData, and dNormBiasData. The dimensions for this tensor descriptor are dependent on normalization mode. The data type of this tensor descriptor must be float for FP16 and FP32 input tensors and double for FP64 input tensors. For more information, refer to TensorDescriptor
  • normScaleData: Input. Pointer in the device memory for the normalization scale parameter (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, the quantity scale is referred to as gamma)
  • normBiasData: Input. Pointers in the device memory for the normalization bias parameter (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta). This parameter is used only when activation should be performed
  • dNormScaleData: Output. Pointers in the device memory for the gradients of normScaleData and normBiasData, respectively
  • dNormBiasData: Output. Pointers in the device memory for the gradients of normScaleData and normBiasData, respectively
  • epsilon: Input. Epsilon value used in normalization formula. Its value should be equal to or greater than zero. The same epsilon value should be used in forward and backward functions
  • normMeanVarDesc: Input. Shared tensor descriptor for the following tensors: savedMean and savedInvVariance. The dimensions for this tensor descriptor are dependent on normalization mode. The data type of this tensor descriptor must be float for FP16 and FP32 input tensors and double for FP64 input tensors. For more information, refer to TensorDescriptor
  • savedMean: Input. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and normScaleData, normBiasData data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • savedInvVariance: Input. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and normScaleData, normBiasData data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • activationDesc: Input. Descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation then this activation is used, otherwise the user may pass NULL
  • workSpace: Input. Pointer to the GPU workspace
  • workSpaceSizeInBytes: Input. The size of the workspace. It must be large enough to trigger the fast NHWC semi-persistent kernel by this function
  • reserveSpace: Input. Pointer to the GPU workspace for the reserveSpace
  • reserveSpaceSizeInBytes: Input. The size of the reserveSpace. It must be equal or larger than the amount required by Handle.NormalizationTrainingReserveSpaceSize

Errors:

  • ErrBadParam: At least one of the following conditions are met: Any of the pointers alphaDataDiff, betaDataDiff, alphaParamDiff, betaParamDiff, xData, dyData, dxData, normScaleData, dNormScaleData, and dNormBiasData is NULL. The number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). dNormScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for per-channel, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of savedMean, savedInvVariance pointers is NULL. epsilon value is less than zero. Dimensions or data types mismatch for any pair of xDesc, dyDesc, dxDesc, dNormScaleBiasDesc, or normMeanVarDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnNormalizationBackward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) NormalizationBackwardWorkspaceSize deprecated

func (h Handle) NormalizationBackwardWorkspaceSize(mode NormMode, normOps NormOps, algo NormAlgo, xDesc TensorDescriptor, yDesc TensorDescriptor, dyDesc TensorDescriptor, dzDesc TensorDescriptor, dxDesc TensorDescriptor, dNormScaleBiasDesc TensorDescriptor, activationDesc ActivationDescriptor, normMeanVarDesc TensorDescriptor, groupCnt int32) (int, error)

NormalizationBackwardWorkspaceSize returns the amount of GPU memory workspace the user should allocate to be able to call Handle.NormalizationBackward function for the specified normOps and algo input setting.

The workspace allocated will then be passed to the function Handle.NormalizationBackward.

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dyDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dzDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dxDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • dNormScaleBiasDesc: Input. Shared tensor descriptor for the following four tensors: normScaleData, normBiasData, dNormScaleData, dNormBiasData. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors
  • activationDesc: Input. Descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation, then this activation is used, otherwise the user may pass NULL
  • normMeanVarDesc: Input. Shared tensor descriptor for the following tensors: savedMean and savedInvVariance. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors

Errors:

  • ErrBadParam: At least one of the following conditions are met: Number of xDesc, yDesc, or dxDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). dNormScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for per-channel, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Dimensions or data types mismatch for any pair of xDesc, dyDesc, or dxDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetNormalizationBackwardWorkspaceSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) NormalizationForwardInference deprecated

func (h Handle) NormalizationForwardInference(mode NormMode, normOps NormOps, algo NormAlgo, alpha unsafe.Pointer, beta unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, normScaleBiasDesc TensorDescriptor, normScale driver.DevicePtr, normBias driver.DevicePtr, normMeanVarDesc TensorDescriptor, estimatedMean driver.DevicePtr, estimatedVariance driver.DevicePtr, zDesc TensorDescriptor, z driver.DevicePtr, activationDesc ActivationDescriptor, yDesc TensorDescriptor, y driver.DevicePtr, epsilon float64, groupCnt int32) error

NormalizationForwardInference performs the forward normalization layer computation for the inference phase.

This function performs the forward normalization layer computation for the inference phase. Per-channel normalization layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The input transformation performed by this function is defined as: The epsilon value has to be the same during training, backpropagation, and inference. For the training phase, refer to Handle.NormalizationForwardTraining. Higher performance can be obtained when HW-packed tensors are used for all of x and y.

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handles to the previously initialized tensor descriptors
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc, for the layer’s x input data
  • normScaleBiasDesc: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • normScale: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • normBias: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma)
  • normMeanVarDesc: Input. Mean and variance tensors and their tensor descriptors. The estimatedMean and estimatedVariance inputs, accumulated during the training phase from the Handle.NormalizationForwardTraining call, should be passed as inputs here
  • estimatedMean: Input. Mean and variance tensors and their tensor descriptors. The estimatedMean and estimatedVariance inputs, accumulated during the training phase from the Handle.NormalizationForwardTraining call, should be passed as inputs here
  • estimatedVariance: Input. Mean and variance tensors and their tensor descriptors. The estimatedMean and estimatedVariance inputs, accumulated during the training phase from the Handle.NormalizationForwardTraining call, should be passed as inputs here
  • zDesc: Input. Tensor descriptors and pointers in device memory for residual addition to the result of the normalization operation, prior to the activation. zDesc and *z are optional and are only used when normOps is NormOpsNormAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor. Since normOps is only supported for NormOpsNorm, we can set these to NULL for now
  • z: Input. Tensor descriptors and pointers in device memory for residual addition to the result of the normalization operation, prior to the activation. zDesc and *z are optional and are only used when normOps is NormOpsNormAddActivation, otherwise users may pass NULL. When in use, z should have exactly the same dimension as x and the final output y. For more information, refer to TensorDescriptor. Since normOps is only supported for NormOpsNorm, we can set these to NULL for now
  • activationDesc: Input. Descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation then this activation is used, otherwise the user may pass NULL. Since normOps is only supported for NormOpsNorm, we can set these to NULL for now
  • yDesc: Input. Handles to the previously initialized tensor descriptors
  • y: Output. Data pointer to GPU memory associated with the tensor descriptor yDesc, for the y output of the normalization layer
  • epsilon: Input. Epsilon value used in the normalization formula. Its value should be equal to or greater than zero

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the pointers alpha, beta, x, y, normScale, normBias, estimatedMean, and estimatedInvVariance is NULL. The number of xDesc or yDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). normScaleBiasDesc and normMeanVarDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for per-channel, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. epsilon value is less than zero. Dimensions or data types mismatch for xDesc and yDesc.
  • ErrNotSupported: A compute or data type other than what is supported was chosen, or an unknown algorithm type was chosen.

Wraps cudnnNormalizationForwardInference.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) NormalizationForwardTraining deprecated

func (h Handle) NormalizationForwardTraining(mode NormMode, normOps NormOps, algo NormAlgo, alpha unsafe.Pointer, beta unsafe.Pointer, xDesc TensorDescriptor, xData driver.DevicePtr, normScaleBiasDesc TensorDescriptor, normScale driver.DevicePtr, normBias driver.DevicePtr, exponentialAverageFactor float64, normMeanVarDesc TensorDescriptor, resultRunningMean driver.DevicePtr, resultRunningVariance driver.DevicePtr, epsilon float64, resultSaveMean driver.DevicePtr, resultSaveInvVariance driver.DevicePtr, activationDesc ActivationDescriptor, zDesc TensorDescriptor, zData driver.DevicePtr, yDesc TensorDescriptor, yData driver.DevicePtr, workspace driver.DevicePtr, workSpaceSizeInBytes int, reserveSpace driver.DevicePtr, reserveSpaceSizeInBytes int, groupCnt int32) error

NormalizationForwardTraining performs the forward normalization layer computation for the training phase.

This function performs the forward normalization layer computation for the training phase. Depending on mode, different normalization operations will be performed. Per-channel layer is based on the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper. Only 4D and 5D tensors are supported. The epsilon value has to be the same during training, back propagation, and inference. For the inference phase, refer to Handle.NormalizationForwardInference. Higher performance can be obtained when HW-packed tensors are used for both x and y. This API will trigger the new semi-persistent NHWC kernel when the following conditions are true: This workspace is not required to be clean. Moreover, the workspace does not have to remain unchanged between the forward and backward pass, as it is not used for passing any information. This extended function can accept a *workspace pointer to the GPU workspace, and workSpaceSizeInBytes, the size of the workspace, from the user. The normOps input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation. Only 4D and 5D tensors are supported. The epsilon value has to be the same during the training, the backpropagation, and the inference. When the tensor layout is NCHW, higher performance can be obtained when HW-packed tensors are used for xData, yData.

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the layer output value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handles to the previously initialized tensor descriptors
  • xData: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc, for the layer’s x input data
  • normScaleBiasDesc: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma). The dimensions for the tensor descriptor are dependent on the normalization mode
  • normScale: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma). The dimensions for the tensor descriptor are dependent on the normalization mode
  • normBias: Input. Tensor descriptors and pointers in device memory for the normalization scale and bias parameters (in the Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift paper, bias is referred to as beta and scale as gamma). The dimensions for the tensor descriptor are dependent on the normalization mode
  • exponentialAverageFactor: Input. Factor used in the moving average computation as follows: runningMean = runningMean*(1-factor) + newMean*factor. Use a factor=1/(1+n) at N-th call to the function to get Cumulative Moving Average (CMA) behavior such that: CMA[n] = (x[1]+...+x[n])/n. This is proved below:
  • normMeanVarDesc: Input. Tensor descriptor used for following tensors: resultRunningMean, resultRunningVariance, resultSaveMean, resultSaveInvVariance
  • resultRunningMean: Input/Output. Pointers to the running mean and running variance data. Both these pointers can be NULL but only at the same time. The value stored in resultRunningVariance (or passed as an input in inference mode) is the sample variance and is the moving average of variance[x] where the variance is computed either over batch or spatial+batch dimensions depending on the mode. If these pointers are not NULL, the tensors should be initialized to some reasonable values or to 0
  • resultRunningVariance: Input/Output. Pointers to the running mean and running variance data. Both these pointers can be NULL but only at the same time. The value stored in resultRunningVariance (or passed as an input in inference mode) is the sample variance and is the moving average of variance[x] where the variance is computed either over batch or spatial+batch dimensions depending on the mode. If these pointers are not NULL, the tensors should be initialized to some reasonable values or to 0
  • epsilon: Input. Epsilon value used in the normalization formula. Its value should be equal to or greater than zero
  • resultSaveMean: Output. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and normScale, normBias data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • resultSaveInvVariance: Output. Optional cache parameters containing saved intermediate results computed during the forward pass. For this to work correctly, the layer’s x and normScale, normBias data has to remain unchanged until this backward function is called. Note that both these parameters can be NULL but only at the same time. It is recommended to use this cache since the memory overhead is relatively small
  • activationDesc: Input. The tensor descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation then this activation is used, otherwise the user may pass NULL
  • zDesc: Input. Tensor descriptors and pointers in device memory for residual addition to the result of the normalization operation, prior to the activation. zDesc and *zData are optional and are only used when normOps is NormOpsNormAddActivation, otherwise the user may pass NULL. When in use, z should have exactly the same dimension as xData and the final output yData. For more information, refer to TensorDescriptor
  • zData: Input. Tensor descriptors and pointers in device memory for residual addition to the result of the normalization operation, prior to the activation. zDesc and *zData are optional and are only used when normOps is NormOpsNormAddActivation, otherwise the user may pass NULL. When in use, z should have exactly the same dimension as xData and the final output yData. For more information, refer to TensorDescriptor
  • yDesc: Input. Handles to the previously initialized tensor descriptors
  • yData: Output. Data pointer to GPU memory associated with the tensor descriptor yDesc, for the y output of the normalization layer
  • workspace: Input. *workspace is a pointer to the GPU workspace, and workSpaceSizeInBytes is the size of the workspace. When *workspace is not NULL and *workSpaceSizeInBytes is large enough, and the tensor layout is NHWC and the data type configuration is supported, then this function will trigger a semi-persistent NHWC kernel for normalization. The workspace is not required to be clean. Also, the workspace does not need to remain unchanged between the forward and backward passes
  • workSpaceSizeInBytes: Input. *workspace is a pointer to the GPU workspace, and workSpaceSizeInBytes is the size of the workspace. When *workspace is not NULL and *workSpaceSizeInBytes is large enough, and the tensor layout is NHWC and the data type configuration is supported, then this function will trigger a semi-persistent NHWC kernel for normalization. The workspace is not required to be clean. Also, the workspace does not need to remain unchanged between the forward and backward passes
  • reserveSpace: Input. Pointer to the GPU workspace for the reserveSpace
  • reserveSpaceSizeInBytes: Input. The size of the reserveSpace. Must be equal or larger than the amount required by Handle.NormalizationTrainingReserveSpaceSize

Errors:

  • ErrBadParam: At least one of the following conditions are met: One of the pointers alpha, beta, xData, yData, normScale, and normBias is NULL. The number of xDesc or yDesc tensor descriptor dimensions is not within the [4,5] range (only 4D and 5D tensors are supported). normScaleBiasDesc dimensions are not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for per-channel mode, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Exactly one of resultSaveMean, resultSaveInvVariance pointers are NULL. Exactly one of resultRunningMean, resultRunningInvVariance pointers are NULL. epsilon value is less than zero. Dimensions or data types mismatch for xDesc or yDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnNormalizationForwardTraining.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) NormalizationForwardTrainingWorkspaceSize deprecated

func (h Handle) NormalizationForwardTrainingWorkspaceSize(mode NormMode, normOps NormOps, algo NormAlgo, xDesc TensorDescriptor, zDesc TensorDescriptor, yDesc TensorDescriptor, normScaleBiasDesc TensorDescriptor, activationDesc ActivationDescriptor, normMeanVarDesc TensorDescriptor, groupCnt int32) (int, error)

NormalizationForwardTrainingWorkspaceSize returns the amount of GPU memory workspace the user should allocate to be able to call Handle.NormalizationForwardTraining function for the specified normOps and algo input setting.

The workspace allocated should then be passed by the user to the function Handle.NormalizationForwardTraining.

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • xDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • zDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • yDesc: Input. Tensor descriptors and pointers in the device memory for the layer’s x data, back propagated differential dy (inputs), the optional y input data, the optional dz output, and the dx output, which is the resulting differential with respect to x. For more information, refer to TensorDescriptor
  • normScaleBiasDesc: Input. Shared tensor descriptor for the following four tensors: normScaleData and normBiasData. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors
  • activationDesc: Input. Descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation, then this activation is used, otherwise the user may pass NULL
  • normMeanVarDesc: Input. Shared tensor descriptor for the following tensors: savedMean and savedInvVariance. The dimensions for this tensor descriptor are dependent on normalization mode. Note that the data type of this tensor descriptor must be float for FP16 and FP32 input tensors, and double for FP64 input tensors

Errors:

  • ErrBadParam: At least one of the following conditions are met: Number of xDesc, yDesc, or zDesc tensor descriptor dimensions is not within the range of [4,5] (only 4D and 5D tensors are supported). normScaleBiasDesc dimensions not 1xCx1x1 for 4D and 1xCx1x1x1 for 5D for per-channel, and are not 1xCxHxW for 4D and 1xCxDxHxW for 5D for per-activation mode. Dimensions or data types mismatch for any pair of xDesc or yDesc.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetNormalizationForwardTrainingWorkspaceSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) NormalizationTrainingReserveSpaceSize deprecated

func (h Handle) NormalizationTrainingReserveSpaceSize(mode NormMode, normOps NormOps, algo NormAlgo, activationDesc ActivationDescriptor, xDesc TensorDescriptor, groupCnt int32) (int, error)

NormalizationTrainingReserveSpaceSize returns the amount of reserve GPU memory workspace the user should allocate for the normalization operation, for the specified normOps input setting.

In contrast to the workspace, the reserved space should be preserved between the forward and backward calls, and the data should not be altered.

  • mode: Input. Mode of operation (per-channel or per-activation). For more information, refer to NormMode
  • normOps: Input. Mode of post-operative. Currently NormOpsNormActivation and NormOpsNormAddActivation are only supported in the NHWC layout. For more information, refer to NormOps. This input can be used to set this function to perform either only the normalization, or normalization followed by activation, or normalization followed by element-wise addition and then activation
  • algo: Input. Algorithm to be performed. For more information, refer to NormAlgo
  • activationDesc: Input. Descriptor for the activation operation. When the normOps input is set to either NormOpsNormActivation or NormOpsNormAddActivation, then this activation is used, otherwise the user may pass NULL
  • xDesc: Input. Tensor descriptors for the layer’s x data. For more information, refer to TensorDescriptor

Errors:

  • ErrBadParam: At least one of the following conditions are met: The xDesc tensor descriptor dimension is not within the [4,5] range (only 4D and 5D tensors are supported).
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnGetNormalizationTrainingReserveSpaceSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) OpTensor deprecated

OpTensor implements the equation C = op(alpha1[0] * A, alpha2[0] * B) + beta[0] * C, given the tensors A, B, and C and the scaling factors alpha1, alpha2, and beta.

This function implements the equation C = op(alpha1[0] * A, alpha2[0] * B) + beta[0] * C, given the tensors A, B, and C and the scaling factors alpha1, alpha2, and beta. The op to use is indicated by the descriptor OpTensorDescriptor, meaning, the type of opTensorDesc. Currently-supported ops are listed by the OpTensorOp enum. The following restrictions on the input and destination tensors apply:

opTensorCompType in opTensorDesc  Tensor A  Tensor B  Destination Tensor C
FLOAT                             FLOAT     FLOAT     FLOAT
FLOAT                             INT8      INT8      FLOAT
FLOAT                             HALF      HALF      FLOAT
FLOAT                             BFLOAT16  BFLOAT16  FLOAT
DOUBLE                            DOUBLE    DOUBLE    DOUBLE
FLOAT                             FLOAT     FLOAT     HALF
FLOAT                             HALF      HALF      HALF
FLOAT                             INT8      INT8      INT8
FLOAT                             FLOAT     FLOAT     INT8
FLOAT                             FLOAT     FLOAT     BFLOAT16
FLOAT                             BFLOAT16  BFLOAT16  BFLOAT16

TensorNchwVectC is not supported as input tensor format. All tensors up to dimension five (5) are supported. This routine does not support tensor formats beyond these dimensions.

  • opTensorDesc: Input. Handle to a previously initialized op tensor descriptor
  • alpha1: Input. Pointers to scaling factors (in host memory) used to blend the source value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • aDesc: Input. Handle to a previously initialized tensor descriptor
  • a: Input. Pointer to data of the tensors described by the aDesc and bDesc descriptors, respectively
  • alpha2: Input. Pointers to scaling factors (in host memory) used to blend the source value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • bDesc: Input. Handle to a previously initialized tensor descriptor
  • b: Input. Pointer to data of the tensors described by the aDesc and bDesc descriptors, respectively
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the source value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • cDesc: Input. Handle to a previously initialized tensor descriptor
  • c: Input/Output. Pointer to data of the tensor described by the cDesc descriptor

Errors:

  • ErrBadParam: The data type of the destination tensor C is unrecognized, or the restrictions on the input and destination tensors, stated above, are not met.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: The dimensions of the bias tensor and the output tensor dimensions are above 5. opTensorCompType is not set as stated above.

Wraps cudnnOpTensor.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) PoolingBackward deprecated

PoolingBackward computes the gradient of a pooling operation.

This function computes the gradient of a pooling operation. As of cuDNN version 6.0, a deterministic algorithm is implemented for max backwards pooling. This algorithm can be chosen via the pooling mode enum of poolingDesc. The deterministic algorithm has been measured to be up to 50% slower than the legacy max backwards pooling algorithm, or up to 20% faster, depending upon the use case. Tensor vectorization is not supported for any tensor descriptor arguments in this function. Best performance is expected when using HW-packed tensors. Only 2 and 3 spatial dimensions are supported.

  • poolingDesc: Input. Handle to the previously initialized pooling descriptor
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized input tensor descriptor. Can be NULL for avg pooling
  • y: Input. Data pointer to GPU memory associated with the tensor descriptor yDesc. Can be NULL for avg pooling
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor. Must be of type FLOAT, DOUBLE, HALF, or BFLOAT16. For more information, refer to DataType
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyData
  • xDesc: Input. Handle to the previously initialized output tensor descriptor. Can be NULL for avg pooling
  • x: Input. Data pointer to GPU memory associated with the output tensor descriptor xDesc. Can be NULL for avg pooling
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dxDesc: Input. Handle to the previously initialized output differential tensor descriptor. Must be of type FLOAT, DOUBLE, HALF, or BFLOAT16. For more information, refer to DataType
  • dx: Output. Data pointer to GPU memory associated with the output tensor descriptor dxDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions n, c, h, w of the yDesc and dyDesc tensors differ. The strides nStride, cStride, hStride, wStride of the yDesc and dyDesc tensors differ. The dimensions n, c, h, w of the dxDesc and dxDesc tensors differ. The strides nStride, cStride, hStride, wStride of the xDesc and dxDesc tensors differ. The datatype of the four tensors differ.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples includes: The wStride of input tensor or output tensor is not 1.

Wraps cudnnPoolingBackward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) PoolingForward deprecated

func (h Handle) PoolingForward(poolingDesc PoolingDescriptor, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

PoolingForward computes pooling of input values (meaning, the maximum or average of several adjacent values) to produce an output with smaller height and/or width.

This function computes pooling of input values (meaning, the maximum or average of several adjacent values) to produce an output with smaller height and/or width. All tensor formats are supported, best performance is expected when using HW-packed tensors. Only 2 and 3 spatial dimensions are allowed. Vectorized tensors are only supported if they have 2 spatial dimensions. The dimensions of the output tensor yDesc can be smaller or bigger than the dimensions advised by the routine PoolingDescriptor.ForwardOutputDim2D or PoolingDescriptor.ForwardOutputDims. For average pooling, the compute type is float even for integer input and output data type. Output round is nearest-even and clamp to the most negative or most positive value of type if out of range.

  • poolingDesc: Input. Handle to a previously initialized pooling descriptor
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to the previously initialized input tensor descriptor. Must be of type FLOAT, DOUBLE, HALF, INT8, INT8x4, INT8x32, or BFLOAT16. For more information, refer to DataType
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized output tensor descriptor. Must be of type FLOAT, DOUBLE, HALF, INT8, INT8x4, INT8x32, or BFLOAT16. For more information, refer to DataType
  • y: Output. Data pointer to GPU memory associated with the output tensor descriptor yDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions n, c of the input tensor and output tensors differ. The datatype of the input tensor and output tensors differs.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnPoolingForward.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) QueryRuntimeError deprecated

func (h Handle) QueryRuntimeError(mode ErrQueryMode, tag *RuntimeTag) (Result, error)

QueryRuntimeError cuDNN library functions perform extensive input argument checking before launching GPU kernels.

The last step is to verify that the GPU kernel actually started. When a kernel fails to start, ErrExecutionFailed is returned by the corresponding API call. Typically, after a GPU kernel starts, no runtime checks are performed by the kernel itself - numerical results are simply written to output buffers. When the BatchnormSpatialPersistent mode is selected in Handle.BatchNormalizationForwardTraining or Handle.BatchNormalizationBackward, the algorithm may encounter numerical overflows where BatchnormSpatial performs just fine albeit at a slower speed. The user can invoke Handle.QueryRuntimeError to make sure numerical overflows did not occur during the kernel execution. Those issues are reported by the kernel that performs computations. Handle.QueryRuntimeError can be used in polling and blocking software control flows. There are two polling modes ( ErrqueryRawcode and ErrqueryNonblocking) and one blocking mode ErrqueryBlocking. ErrqueryRawcode reads the error storage location regardless of the kernel completion status. The kernel might not even start and the error storage (allocated per cuDNN handle) might be used by an earlier call. ErrqueryNonblocking checks if all tasks in the user stream are completed. The Handle.QueryRuntimeError function will return immediately and report ErrRuntimeInProgress in rstatus if some tasks in the user stream are pending. Otherwise, the function will copy the remote kernel error code to rstatus. In the blocking mode ( ErrqueryBlocking), the function waits for all tasks to drain in the user stream before reporting the remote kernel error code. The blocking flavor can be further adjusted by calling cudaSetDeviceFlags with the cudaDeviceScheduleSpin, cudaDeviceScheduleYield, or cudaDeviceScheduleBlockingSync flag. ErrqueryNonblocking and ErrqueryBlocking modes should not be used when the user stream is changed in the cuDNN handle, meaning, Handle.SetStream is invoked between functions that report runtime kernel errors and the Handle.QueryRuntimeError function. The remote error status reported in rstatus can be set to: Success, ErrRuntimeInProgress, or ErrRuntimeFpOverflow. The remote kernel error is automatically cleared by Handle.QueryRuntimeError. The Handle.QueryRuntimeError function should be used in conjunction with Handle.BatchNormalizationForwardTraining and Handle.BatchNormalizationBackward when the BatchNormMode argument is BatchnormSpatialPersistent.

  • mode: Input. Remote error query mode
  • tag: Input/Output. Currently, this argument should be NULL

A nil error means no errors detected ( rstatus holds a valid value).

Errors:

  • ErrBadParam: Invalid input argument.
  • ErrInternalError: A stream blocking synchronization or a non-blocking stream query failed.
  • ErrMappingError: The device cannot access zero-copy memory to report kernel errors.

Wraps cudnnQueryRuntimeError.

Deprecated: Deprecated by NVIDIA.

func (Handle) RNNBackwardData

func (h Handle) RNNBackwardData(rnnDesc RNNDescriptor, devSeqLengths driver.DevicePtr, yDesc RNNDataDescriptor, y driver.DevicePtr, dy driver.DevicePtr, xDesc RNNDataDescriptor, dx driver.DevicePtr, hDesc TensorDescriptor, hx driver.DevicePtr, dhy driver.DevicePtr, dhx driver.DevicePtr, cDesc TensorDescriptor, cx driver.DevicePtr, dcy driver.DevicePtr, dcx driver.DevicePtr, weightSpaceSize int, weightSpace driver.DevicePtr, workSpaceSize int, workSpace driver.DevicePtr, reserveSpaceSize int, reserveSpace driver.DevicePtr) error

RNNBackwardData computes exact, first-order derivatives of the RNN model with respect to its inputs: x, hx and for the LSTM cell type also cx.

If o = [y, hy, cy] = F(x, hx, cx) = F(z) is a vector-valued function that represents the entire RNN model and it takes vectors x (for all time-steps) and vectors hx, cx (for all layers) as inputs, concatenated into zϵRⁿ (network weights and biases are assumed constant), and outputs vectors y, hy, cy concatenated into a vector oϵRᵐ, then Handle.RNNBackwardData computes the result of (∂oᵢ/∂zⱼ)ᵀδₒᵤₜ where δₒᵤₜ is the mx1 gradient of the loss function with respect to all RNN outputs. The δₒᵤₜ gradient is back propagated through prior layers of the deep learning model, starting from the model output. ∂oᵢ/∂zⱼ is the mxn Jacobian matrix of F(z). The δₒᵤₜ input is supplied via the dy, dhy, and dcy arguments and gradient results (∂oᵢ/∂zⱼ)ᵀδₒᵤₜ are written to the dx, dhx, and dcx buffers. Locations of x, y, hx, cx, hy, cy, dx, dy, dhx, dcx, dhy, and dcy signals a multi-layer RNN model are shown in the following figure. Note that internal RNN signals (between time-steps and between layers) are not exposed by the Handle.RNNBackwardData function. Locations of x, y, hx, cx, hy, cy, dx, dy, dhx, dcx, dhy, and dcy Signals a Multi-Layer RNN Model Memory addresses to the primary RNN output y, the initial hidden state hx, and the initial cell state cx (for LSTM only) should point to the same data as in the preceding Handle.RNNForward call. The dy and dx pointers cannot be NULL. The Handle.RNNBackwardData function accepts any combination of dhy, dhx, dcy, dcx buffer addresses being NULL. When dhy or dcy are NULL, it is assumed that those inputs are zero. When dhx or dcx pointers are NULL, then the corresponding results are not written by Handle.RNNBackwardData. When all hx, dhy, dhx pointers are NULL, then the corresponding tensor descriptor hDesc can be NULL too. The same rule applies to the cx, dcy, dcx pointers and the cDesc tensor descriptor. The Handle.RNNBackwardData function allows the user to use padded layouts for inputs y, dy, and output dx. In padded or unpacked layouts ( RnnDataLayoutSeqMajorUnpacked, RnnDataLayoutBatchMajorUnpacked) each sequence of vectors in a mini-batch has a fixed length defined by the maxSeqLength argument in the RNNDataDescriptor.Set function. The term “unpacked” refers here to the presence of padding vectors, and not unused address ranges between contiguous vectors. Each padded, fixed-length sequence starts from a segment of valid vectors. The valid vector count is stored in seqLengthArray passed to RNNDataDescriptor.Set, such that 0 < seqLengthArray[i] <= maxSeqLength for all sequences in a mini-batch, that is, for i=0..batchSize-1. The remaining, padding vectors make the combined sequence length equal to maxSeqLength. Both sequence-major and batch-major padded layouts are supported. In addition, a packed sequence-major layout is supported: RnnDataLayoutSeqMajorPacked. In the latter layout, sequences of vectors in a mini-batch are sorted in the descending order according to the sequence lengths. First all vectors for time step zero are stored. They are followed by all vectors for time step one, and so on. This layout uses no padding vectors. The same layout type must be specified in xDesc and yDesc descriptors. Two host arrays named seqLengthArray in xDesc and yDesc RNN data descriptors must be the same. In addition, a copy of seqLengthArray in the device memory must be passed via the devSeqLengths argument. This array is supplied directly to GPU kernels. Starting in cuDNN 8.9.1, the devSeqLengths parameter is no longer required and can be set to NULL. The variable sequence length array is transferred automatically to GPU memory by the Handle.RNNBackwardData function. The Handle.RNNBackwardData function does not verify that sequence lengths stored in devSeqLengths in GPU memory are the same as in xDesc and yDesc descriptors in CPU memory. Sequence length arrays from xDesc and yDesc descriptors are checked for consistency, however. The Handle.RNNBackwardData function must be called after Handle.RNNForward. The Handle.RNNForward function should be invoked with the fwdMode argument of type ForwardMode set to FwdModeTraining.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • devSeqLengths: Input. A copy of seqLengthArray from xDesc or yDesc RNN data descriptors. The devSeqLengths array must be stored in GPU memory as it is accessed asynchronously by GPU kernels, possibly after the Handle.RNNBackwardData function exists. In cuDNN 8.9.1 and later versions, devSeqLengths should be NULL
  • yDesc: Input. A previously initialized descriptor corresponding to the RNN model primary output. The dataType, layout, maxSeqLength, batchSize, and seqLengthArray need to match that of xDesc
  • y: Input. Data pointers to GPU buffers holding the RNN model primary output and gradient deltas (gradient of the loss function with respect to y). The y output should be produced by the preceding Handle.RNNForward call. The y and dy vectors are expected to be laid out in memory according to the layout specified by yDesc. The elements in the tensor (including elements in padding vectors) must be densely packed. The y and dy arguments cannot be NULL
  • dy: Input. Data pointers to GPU buffers holding the RNN model primary output and gradient deltas (gradient of the loss function with respect to y). The y output should be produced by the preceding Handle.RNNForward call. The y and dy vectors are expected to be laid out in memory according to the layout specified by yDesc. The elements in the tensor (including elements in padding vectors) must be densely packed. The y and dy arguments cannot be NULL
  • xDesc: Input. A previously initialized RNN data descriptor corresponding to the gradient of the loss function with respect to the RNN primary model input. The dataType, layout, maxSeqLength, batchSize, and seqLengthArray must match that of yDesc. The parameter vectorSize must match the inputSize argument passed to the RNNDescriptor.Set function
  • dx: Output. Data pointer to GPU memory where back-propagated gradients of the loss function with respect to the RNN primary input x should be stored. The vectors are expected to be arranged in memory according to the layout specified by xDesc. The elements in the tensor (including padding vectors) must be densely packed. This argument cannot be NULL
  • hDesc: Input. A tensor descriptor describing the initial RNN hidden state hx and gradients of the loss function with respect to the initial of the final hidden state. Hidden state data and the corresponding gradients are fully packed. The first dimension of the tensor depends on the dirMode argument passed to the RNNDescriptor.Set function. If dirMode is Unidirectional, then the first dimension should match the numLayers argument passed to RNNDescriptor.Set. If dirMode is Bidirectional, then the first dimension should be double the numLayers argument passed to RNNDescriptor.Set. The second dimension must match the batchSize parameter described in xDesc. The third dimension depends on whether RNN mode is Lstm and whether the LSTM projection is enabled. Specifically: If RNN mode is Lstm and LSTM projection is enabled, the third dimension must match the projSize argument. Otherwise, the third dimension must match the hiddenSize argument
  • hx: Input. Addresses of GPU buffers with the RNN initial hidden state hx and gradient deltas dhy. Data dimensions are described by the hDesc tensor descriptor. If a NULL pointer is passed in hx or dhy arguments, the corresponding buffer is assumed to contain all zeros
  • dhy: Input. Addresses of GPU buffers with the RNN initial hidden state hx and gradient deltas dhy. Data dimensions are described by the hDesc tensor descriptor. If a NULL pointer is passed in hx or dhy arguments, the corresponding buffer is assumed to contain all zeros
  • dhx: Output. Pointer to the GPU buffer where first-order derivatives corresponding to initial hidden state variables should be stored. Data dimensions are described by the hDesc tensor descriptor. If a NULL pointer is assigned to dhx, the back-propagated derivatives are not saved
  • cDesc: Input. For LSTM networks only. A tensor descriptor describing the initial cell state cx and gradients of the loss function with respect to the initial of the final cell state. Cell state data are fully packed. The first dimension of the tensor depends on the dirMode argument passed to the RNNDescriptor.Set call. If dirMode is Unidirectional, then the first dimension should match the numLayers argument passed to RNNDescriptor.Set. If dirMode is Bidirectional, then the first dimension should be double the numLayers argument passed to RNNDescriptor.Set. The second tensor dimension must match the batchSize parameter in xDesc. The third dimension must match the hiddenSize argument passed to the RNNDescriptor.Set call
  • cx: Input. For LSTM networks only. Addresses of GPU buffers with the initial LSTM state data and gradient deltas dcy. Data dimensions are described by the cDesc tensor descriptor. If a NULL pointer is passed in cx or dcy arguments, the corresponding buffer is assumed to contain all zeros
  • dcy: Input. For LSTM networks only. Addresses of GPU buffers with the initial LSTM state data and gradient deltas dcy. Data dimensions are described by the cDesc tensor descriptor. If a NULL pointer is passed in cx or dcy arguments, the corresponding buffer is assumed to contain all zeros
  • dcx: Output. For LSTM networks only. Pointer to the GPU buffer where first-order derivatives corresponding to initial LSTM state variables should be stored. Data dimensions are described by the cDesc tensor descriptor. If a NULL pointer is assigned to dcx, the back-propagated derivatives are not saved
  • weightSpaceSize: Input. Specifies the size in bytes of the provided weight space buffer
  • weightSpace: Input. Address of the weight space buffer in GPU memory
  • workSpaceSize: Input. Specifies the size in bytes of the provided workspace buffer
  • workSpace: Input/Output. Address of the workspace buffer in GPU memory to store temporary data
  • reserveSpaceSize: Input. Specifies the size in bytes of the reserve-space buffer
  • reserveSpace: Input/Output. Address of the reserve-space buffer in GPU memory

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrAllocFailed: The function was unable to allocate CPU memory.
  • ErrBadParam: An invalid or incompatible input argument was encountered. Some examples include: some descriptors or data buffer addresses are NULL settings in rnnDesc, xDesc, yDesc, hDesc, or cDesc descriptors are invalid weightSpaceSize, workSpaceSize, or reserveSpaceSize is too small
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrMappingError: A GPU/CUDA resource, such as a texture object, shared memory, or zero-copy memory is not available in the required size or there is a mismatch between the user resource and cuDNN internal resources. A resource mismatch may occur, for example, when calling Handle.SetStream. There could be a mismatch between the user provided CUDA stream and the internal CUDA events instantiated in the cuDNN handle when Create was invoked. This error status may not be correctable when it is related to texture dimensions, shared memory size, or zero-copy memory availability. If ErrMappingError is returned by Handle.SetStream, then it is typically correctable, however, it means that the cuDNN handle was created on one GPU and the user stream passed to this function is associated with another GPU.
  • ErrNotSupported: At least one of the following conditions are met: variable sequence length input is passed while RnnAlgoPersistStatic or RnnAlgoPersistDynamic is specified RnnAlgoPersistStatic or RnnAlgoPersistDynamic is requested on pre-Pascal devices the ‘double’ floating point type is used for input/output and the RnnAlgoPersistStatic algo

Wraps cudnnRNNBackwardData_v8.

func (Handle) RNNBackwardWeights

func (h Handle) RNNBackwardWeights(rnnDesc RNNDescriptor, addGrad WgradMode, devSeqLengths driver.DevicePtr, xDesc RNNDataDescriptor, x driver.DevicePtr, hDesc TensorDescriptor, hx driver.DevicePtr, yDesc RNNDataDescriptor, y driver.DevicePtr, weightSpaceSize int, dweightSpace driver.DevicePtr, workSpaceSize int, workSpace driver.DevicePtr, reserveSpaceSize int, reserveSpace driver.DevicePtr) error

RNNBackwardWeights computes exact, first-order derivatives of the RNN model with respect to all trainable parameters: weights and biases.

If o = [y, hy, cy] = F(w) is a vector-valued function that represents the multi-layer RNN model and it takes some vector wϵRⁿ of “flatten” weights or biases as input (with all other data inputs constant), and outputs vector oϵRᵐ, then Handle.RNNBackwardWeights computes the result of (∂oᵢ/∂wⱼ)ᵀδₒᵤₜ where δₒᵤₜ is the mx1 gradient of the loss function with respect to all RNN outputs. The δₒᵤₜ gradient is back propagated through prior layers of the deep learning model, starting from the model output. ∂oᵢ/∂wⱼ is the mxn Jacobian matrix of F(w). The δₒᵤₜ input is supplied via the dy, dhy, and dcy arguments in the Handle.RNNBackwardData function. All gradient results (∂oᵢ/∂wⱼ)ᵀδₒᵤₜ with respect to weights and biases are written to the dweightSpace buffer. The size and the organization of the dweightSpace buffer is the same as the weightSpace buffer that holds RNN weights and biases. Gradient of the loss function with respect to weights and biases is typically computed over multiple mini-batches. In such a case, partial results computed for each mini-batch should be aggregated. The addGrad argument specifies if gradients from the current mini-batch should be added to previously computed results ( WgradModeAdd) or the dweightSpace buffer should be overwritten with the new results ( WgradModeSet). Currently, the Handle.RNNBackwardWeights function supports the WgradModeAdd mode only so the dweightSpace buffer should be zeroed by the user before invoking the routine for the first time. The same sequence lengths must be specified in the xDesc descriptor and in the device array devSeqLengths. Starting in cuDNN 8.9.1, the devSeqLengths parameter is no longer required and can be set to NULL. The variable sequence length array is transferred automatically to GPU memory by the Handle.RNNBackwardWeights function. The Handle.RNNBackwardWeights function should be invoked after Handle.RNNBackwardData.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • addGrad: Input. Weight gradient output mode. For more details, refer to the description of the WgradMode enumerated type. Currently, only the WgradModeAdd mode is supported by the Handle.RNNBackwardWeights function
  • devSeqLengths: Input. A copy of seqLengthArray from the xDesc RNN data descriptor. The devSeqLengths array must be stored in GPU memory as it is accessed asynchronously by GPU kernels, possibly after the Handle.RNNBackwardWeights function exists. In cuDNN 8.9.1 and later versions, devSeqLengths should be NULL
  • xDesc: Input. A previously initialized descriptor corresponding to the RNN model input data. This is the same RNN data descriptor as used in the preceding Handle.RNNForward and Handle.RNNBackwardData calls
  • x: Input. Pointer to the GPU buffer with the primary RNN input. The same buffer address x should be provided in prior Handle.RNNForward and Handle.RNNBackwardData calls
  • hDesc: Input. A tensor descriptor describing the initial RNN hidden state. Hidden state data are fully packed. This is the same tensor descriptor as used in prior Handle.RNNForward and Handle.RNNBackwardData calls
  • hx: Input. Pointer to the GPU buffer with the RNN initial hidden state. The same buffer address hx should be provided in prior Handle.RNNForward and Handle.RNNBackwardData calls
  • yDesc: Input. A previously initialized descriptor corresponding to the RNN model output data. This is the same RNN data descriptor as used in prior Handle.RNNForward and Handle.RNNBackwardData calls
  • y: Output. Pointer to the GPU buffer with the primary RNN output as generated by the prior Handle.RNNForward call. Data in the y buffer are described by the yDesc descriptor. Elements in the y tensor (including elements in padding vectors) must be densely packed
  • weightSpaceSize: Input. Specifies the size in bytes of the provided weight space buffer
  • dweightSpace: Output. Address of the weight space buffer in GPU memory
  • workSpaceSize: Input. Specifies the size in bytes of the provided workspace buffer
  • workSpace: Input/Output. Address of the workspace buffer in GPU memory to store temporary data
  • reserveSpaceSize: Input. Specifies the size in bytes of the reserve-space buffer
  • reserveSpace: Input/Output. Address of the reserve-space buffer in GPU memory

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrAllocFailed: The function was unable to allocate CPU memory
  • ErrBadParam: An invalid or incompatible input argument was encountered. Some examples include: some descriptors or data buffer addresses are NULL settings in rnnDesc, xDesc, yDesc, or hDesc descriptors are invalid weightSpaceSize, workSpaceSize, or reserveSpaceSize values are too small the addGrad argument is not equal to WgradModeAdd
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnRNNBackwardWeights_v8.

func (Handle) RNNForward

func (h Handle) RNNForward(rnnDesc RNNDescriptor, fwdMode ForwardMode, devSeqLengths driver.DevicePtr, xDesc RNNDataDescriptor, x driver.DevicePtr, yDesc RNNDataDescriptor, y driver.DevicePtr, hDesc TensorDescriptor, hx driver.DevicePtr, hy driver.DevicePtr, cDesc TensorDescriptor, cx driver.DevicePtr, cy driver.DevicePtr, weightSpaceSize int, weightSpace driver.DevicePtr, workSpaceSize int, workSpace driver.DevicePtr, reserveSpaceSize int, reserveSpace driver.DevicePtr) error

RNNForward computes the forward response of the recurrent neural network described by rnnDesc with inputs in x, hx, cx, and weights/biases in the weightSpace buffer.

RNN outputs are written to y, hy, and cy buffers. Locations of x, y, hx, cx, hy, and cy signals in the multi-layer RNN model are shown in the following figure. Note that internal RNN signals between time-steps and between layers are not exposed to the user. Locations of x, y, hx, cx, hy, and cy signals in the multi-layer RNN model The next figure depicts data flow when the RNN model is bidirectional. In this mode, each RNN physical layer consists of two consecutive pseudo-layers, each with its own weights, biases, the initial hidden state hx, and for LSTM, also the initial cell state cx. Even pseudo-layers 0, 2, 4 process input vectors from left to right or in the forward ( F) direction. Odd pseudo-layers 1, 3, 5 process input vectors from right to left or in the reverse ( R) direction. Two successive pseudo-layers operate on the same input vectors, just in a different order. Pseudo-layers 0 and 1 access the original sequences stored in the x buffer. Outputs of F and R cells are concatenated so vectors fed to the next two pseudo-layers have lengths of 2x hiddenSize or 2x projSize. Input GEMMs in subsequent pseudo-layers adjust vector lengths to 1x hiddenSize. Data flow when the RNN model is bidirectional When the fwdMode parameter is set to FwdModeTraining, the Handle.RNNForward function stores intermediate data required to compute first order derivatives in the reserve space buffer. Work and reserve space buffer sizes should be computed by the Handle.RNNTempSpaceSizes function with the same fwdMode setting as used in the Handle.RNNForward call. The same layout type must be specified in xDesc and yDesc descriptors. The same sequence lengths must be configured in xDesc, yDesc and in the device array devSeqLengths. Starting in cuDNN 8.9.1, the devSeqLengths parameter is no longer required and can be set to NULL. The variable sequence length array is transferred automatically to GPU memory by the Handle.RNNForward function. The Handle.RNNForward function does not verify that sequence lengths stored in devSeqLengths in GPU memory are the same as in xDesc and yDesc descriptors in CPU memory. Sequence length arrays from xDesc and yDesc descriptors are checked for consistency, however.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • fwdMode: Input. Specifies inference or training mode ( FwdModeInference and FwdModeTraining). In the training mode, additional data is stored in the reserve space buffer. This information is used in the backward pass to compute derivatives
  • devSeqLengths: Input. A copy of seqLengthArray from xDesc or yDesc RNN data descriptor. The devSeqLengths array must be stored in GPU memory as it is accessed asynchronously by GPU kernels, possibly after the Handle.RNNForward function exists. In cuDNN 8.9.1 and later versions, devSeqLengths should be NULL
  • xDesc: Input. A previously initialized descriptor corresponding to the RNN model primary input. The dataType, layout, maxSeqLength, batchSize, and seqLengthArray must match that of yDesc. The parameter vectorSize must match the inputSize argument passed to the RNNDescriptor.Set function
  • x: Input. Data pointer to the GPU memory associated with the RNN data descriptor xDesc. The vectors are expected to be arranged in memory according to the layout specified by xDesc. The elements in the tensor (including padding vectors) must be densely packed
  • yDesc: Input. A previously initialized RNN data descriptor. The dataType, layout, maxSeqLength, batchSize, and seqLengthArray must match that of xDesc. The parameter vectorSize depends on whether LSTM projection is enabled and whether the network is bidirectional. Specifically: For unidirectional models, the parameter vectorSize must match the hiddenSize argument passed to RNNDescriptor.Set. If the LSTM projection is enabled, the vectorSize must be the same as the projSize argument passed to RNNDescriptor.Set. For bidirectional models, if the RNN cellMode is Lstm and the projection feature is enabled, the parameter vectorSize must be 2x the projSize argument passed to RNNDescriptor.Set. Otherwise, it should be 2x the hiddenSize value
  • y: Output. Data pointer to the GPU memory associated with the RNN data descriptor yDesc. The vectors are expected to be laid out in memory according to the layout specified by yDesc. The elements in the tensor (including elements in the padding vector) must be densely packed, and no strides are supported
  • hDesc: Input. A tensor descriptor describing the initial or final hidden state of RNN. Hidden state data are fully packed. The first dimension of the tensor depends on the dirMode argument passed to the RNNDescriptor.Set function. If dirMode is Unidirectional, then the first dimension should match the numLayers argument passed to RNNDescriptor.Set. If dirMode is Bidirectional, then the first dimension should be double the numLayers argument passed to RNNDescriptor.Set. The second dimension must match the batchSize parameter described in xDesc. The third dimension depends on whether RNN mode is Lstm and whether the LSTM projection is enabled. Specifically: If RNN mode is Lstm and LSTM projection is enabled, the third dimension must match the projSize argument. Otherwise, the third dimension must match the hiddenSize argument passed to the RNNDescriptor.Set call used to initialize rnnDesc
  • hx: Input. Pointer to the GPU buffer with the RNN initial hidden state. Data dimensions are described by the hDesc tensor descriptor. If a NULL pointer is passed, the initial hidden state of the network will be initialized to zero
  • hy: Output. Pointer to the GPU buffer where the final RNN hidden state should be stored. Data dimensions are described by the hDesc tensor descriptor. If a NULL pointer is passed, the final hidden state of the network will not be saved
  • cDesc: Input. For LSTM networks only. A tensor descriptor describing the initial or final cell state for LSTM networks only. Cell state data are fully packed. The first dimension of the tensor depends on the dirMode argument passed to the RNNDescriptor.Set call. If dirMode is Unidirectional the first dimension should match the numLayers argument passed to RNNDescriptor.Set. If dirMode is Bidirectional the first dimension should match double the numLayers argument passed to RNNDescriptor.Set. The second tensor dimension must match the batchSize parameter in xDesc. The third dimension must match the hiddenSize argument passed to the RNNDescriptor.Set call
  • cx: Input. For LSTM networks only. Pointer to the GPU buffer with the initial LSTM state data. Data dimensions are described by the cDesc tensor descriptor. If a NULL pointer is passed, the initial cell state of the network will be initialized to zero
  • cy: Output. For LSTM networks only. Pointer to the GPU buffer where final LSTM state data should be stored. Data dimensions are described by the cDesc tensor descriptor. If a NULL pointer is passed, the final LSTM cell state will not be saved
  • weightSpaceSize: Input. Specifies the size in bytes of the provided weight space buffer
  • weightSpace: Input. Address of the weight space buffer in GPU memory
  • workSpaceSize: Input. Specifies the size in bytes of the provided workspace buffer
  • workSpace: Input/Output. Address of the workspace buffer in GPU memory to store temporary data
  • reserveSpaceSize: Input. Specifies the size in bytes of the reserve-space buffer
  • reserveSpace: Input/Output. Address of the reserve-space buffer in GPU memory

A nil error means no errors were detected while processing API input arguments and launching GPU kernels.

Errors:

  • ErrAllocFailed: The function was unable to allocate CPU memory.
  • ErrBadParam: An invalid or incompatible input argument was encountered. Some examples include: some input descriptors are NULL at least one of the settings in rnnDesc, xDesc, yDesc, hDesc, or cDesc descriptors is invalid weightSpaceSize, workSpaceSize, or reserveSpaceSize is too small
  • ErrExecutionFailed: The process of launching a GPU kernel returned an error, or an earlier kernel did not complete successfully.
  • ErrNotSupported: At least one of the following conditions are met: variable sequence length input is passed while RnnAlgoPersistStatic or RnnAlgoPersistDynamic is specified RnnAlgoPersistStatic or RnnAlgoPersistDynamic is requested on pre-Pascal devices the ‘double’ floating point type is used for input/output and the RnnAlgoPersistStatic algo

Wraps cudnnRNNForward.

func (Handle) RNNTempSpaceSizes

func (h Handle) RNNTempSpaceSizes(rnnDesc RNNDescriptor, fwdMode ForwardMode, xDesc RNNDataDescriptor) (int, int, error)

RNNTempSpaceSizes computes the work and reserve space buffer sizes based on the RNN network geometry stored in rnnDesc, designated usage (inference or training) defined by the fMode argument, and the current RNN data dimensions ( maxSeqLength, batchSize) retrieved from xDesc.

When RNN data dimensions change, the Handle.RNNTempSpaceSizes must be called again because RNN temporary buffer sizes are not monotonic. The user can assign NULL to workSpaceSize or reserveSpaceSize pointers when the corresponding value is not needed.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • xDesc: Input. A single RNN data descriptor that specifies current RNN data dimensions: maxSeqLength and batchSize

A nil error means RNN temporary buffer sizes were computed successfully.

Errors:

  • ErrBadParam: An invalid input argument was detected.
  • ErrNotSupported: An incompatible or unsupported combination of input arguments was detected.

Wraps cudnnGetRNNTempSpaceSizes.

func (Handle) RNNWeightParams

func (h Handle) RNNWeightParams(rnnDesc RNNDescriptor, pseudoLayer int32, weightSpaceSize int, weightSpace driver.DevicePtr, linLayerID int32, mDesc TensorDescriptor, bDesc TensorDescriptor) (uintptr, uintptr, error)

RNNWeightParams is used to obtain the start address and shape of every RNN weight matrix and bias vector in each pseudo-layer within the recurrent neural network model.

  • rnnDesc: Input. A previously initialized RNN descriptor
  • pseudoLayer: Input. The pseudo-layer to query. In unidirectional RNNs, a pseudo-layer is the same as a physical layer ( pseudoLayer=0 is the RNN input layer, pseudoLayer=1 is the first hidden layer). In bidirectional RNNs, there are twice as many pseudo-layers in comparison to physical layers: pseudoLayer=0 refers to the forward direction sub-layer of the physical input layer pseudoLayer=1 refers to the backward direction sub-layer of the physical input layer pseudoLayer=2 is the forward direction sub-layer of the first hidden layer, and so on
  • weightSpaceSize: Input. Address of the weight space buffer. Starting from cuDNN version 9.1, this parameter can be NULL. This allows you to retrieve weight/bias offsets instead of the actual pointers within the buffer. For best performance, the recommended alignment of the weight space buffer should be 256 B or the same as returned by cudaMalloc()
  • weightSpace: Input. Pointer to the weight space buffer
  • linLayerID: Input. Weight matrix or bias vector linear ID index. If cellMode in rnnDesc was set to RnnRelu or RnnTanh: Value 0 references the weight matrix or bias vector used in conjunction with the input from the previous layer or input to the RNN model. Value 1 references the weight matrix or bias vector used in conjunction with the hidden state from the previous time step or the initial hidden state. If cellMode in rnnDesc was set to Lstm: Values 0, 1, 2, and 3 reference weight matrices or bias vectors used in conjunction with the input from the previous layer or input to the RNN model. Values 4, 5, 6, and 7 reference weight matrices or bias vectors used in conjunction with the hidden state from the previous time step or the initial hidden state. Value 8 corresponds to the projection matrix, if enabled (there is no bias in this operation). Values and their LSTM gates: If cellMode in rnnDesc was set to Gru: Values 0, 1, and 2 reference weight matrices or bias vectors used in conjunction with the input from the previous layer or input to the RNN model. Values 3, 4, and 5 reference weight matrices or bias vectors used in conjunction with the hidden state from the previous time step or the initial hidden state. Values and their GRU gates: For more information on modes and bias modes, refer to RNNMode
  • mDesc: Output. Handle to a previously created tensor descriptor. The shape of the corresponding weight matrix is returned in this descriptor in the following format: dimA[3] = {1, rows, cols}. The reported number of tensor dimensions is zero when the weight matrix does not exist. This situation occurs for input GEMM matrices of the first layer when SkipInput is selected or for the LSTM projection matrix when the feature is disabled
  • bDesc: Output. Handle to a previously created tensor descriptor. The shape of the corresponding bias vector is returned in this descriptor in the following format: dimA[3] = {1, rows, 1}. The reported number of tensor dimensions is zero when the bias vector does not exist

A nil error means the query was completed successfully.

Errors:

  • ErrBadParam: An invalid input argument was encountered. For example, the value of pseudoLayer is out of range or linLayerID is negative or larger than 8.
  • ErrInvalidValue: Some weight/bias elements are outside the weight space buffer boundaries.
  • ErrNotInitialized: The cuDNN library was not initialized properly.

Wraps cudnnGetRNNWeightParams.

func (Handle) RNNWeightSpaceSize

func (h Handle) RNNWeightSpaceSize(rnnDesc RNNDescriptor) (int, error)

RNNWeightSpaceSize reports the required size of the weight space buffer in bytes.

The weight space buffer holds all RNN weight matrices and bias vectors.

  • rnnDesc: Input. A previously initialized RNN descriptor

Errors:

  • ErrBadParam: An invalid input argument was encountered. For example, any input argument was NULL.
  • ErrNotInitialized: The cuDNN library was not initialized properly.

Wraps cudnnGetRNNWeightSpaceSize.

func (Handle) ReduceTensor deprecated

func (h Handle) ReduceTensor(reduceTensorDesc ReduceTensorDescriptor, indices driver.DevicePtr, indicesSizeInBytes int, workspace driver.DevicePtr, workspaceSizeInBytes int, alpha unsafe.Pointer, aDesc TensorDescriptor, A driver.DevicePtr, beta unsafe.Pointer, cDesc TensorDescriptor, C driver.DevicePtr) error

ReduceTensor reduces tensor A by implementing the equation C = alpha * reduce op ( A ) + beta * C, given tensors A and C and scaling factors alpha and beta.

This function reduces tensor A by implementing the equation C = alpha * reduce op ( A ) + beta * C, given tensors A and C and scaling factors alpha and beta. The reduction op to use is indicated by the descriptor reduceTensorDesc. Currently-supported ops are listed by the ReduceTensorOp enum. Each dimension of the output tensor C must match the corresponding dimension of the input tensor A or must be equal to 1. The dimensions equal to 1 indicate the dimensions of A to be reduced. The implementation will generate indices for the min and max ops only, as indicated by the ReduceTensorIndices enum of the reduceTensorDesc. Requesting indices for the other reduction ops results in an error. The data type of the indices is indicated by the IndicesType enum; currently only the 32-bit (unsigned int) type is supported. The indices returned by the implementation are not absolute indices but relative to the dimensions being reduced. The indices are also flattened, meaning, not coordinate tuples. The data types of the tensors A and C must match if of type double. In this case, alpha and beta and the computation enum of reduceTensorDesc are all assumed to be of type double. The HALF and INT8 data types may be mixed with the FLOAT data types. In these cases, the computation enum of reduceTensorDesc is required to be of type FLOAT. Up to dimension 8, all tensor formats are supported. Beyond those dimensions, this routine is not supported.

  • reduceTensorDesc: Input. Handle to a previously initialized reduce tensor descriptor
  • indices: Output. Handle to a previously allocated space for writing indices
  • indicesSizeInBytes: Input. Size of the above previously allocated space
  • workspace: Input. Handle to a previously allocated space for the reduction implementation
  • workspaceSizeInBytes: Input. Size of the above previously allocated space
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the source value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • aDesc: Input. Handle to a previously initialized tensor descriptor
  • a: Input. Pointer to data of the tensor described by the aDesc descriptor
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the source value with prior value in the destination tensor as follows: dstValue = alpha[0]*resultValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • cDesc: Input. Handle to a previously initialized tensor descriptor
  • c: Input/Output. Pointer to data of the tensor described by the cDesc descriptor

Errors:

  • CUDNN_INVALID_VALUE: The allocations for the indices or workspace are insufficient.
  • ErrBadParam: The corresponding dimensions of the input and output tensors all match, or the conditions in the above paragraphs are unmet.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: The dimensions of the input tensor and the output tensor are above 8. reduceTensorCompType is not set as stated above.

Wraps cudnnReduceTensor.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ReductionIndicesSize deprecated

func (h Handle) ReductionIndicesSize(reduceTensorDesc ReduceTensorDescriptor, aDesc TensorDescriptor, cDesc TensorDescriptor) (int, error)

ReductionIndicesSize is a helper function to return the minimum size of the index space to be passed to the reduction given the input and output tensors.

  • aDesc: Input. Pointer to the input tensor descriptor
  • cDesc: Input. Pointer to the output tensor descriptor

A nil error means the index space size is returned successfully.

Wraps cudnnGetReductionIndicesSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) ReductionWorkspaceSize deprecated

func (h Handle) ReductionWorkspaceSize(reduceTensorDesc ReduceTensorDescriptor, aDesc TensorDescriptor, cDesc TensorDescriptor) (int, error)

ReductionWorkspaceSize is a helper function to return the minimum size of the workspace to be passed to the reduction given the input and output tensors.

  • aDesc: Input. Pointer to the input tensor descriptor
  • cDesc: Input. Pointer to the output tensor descriptor

A nil error means the workspace size is returned successfully.

Wraps cudnnGetReductionWorkspaceSize.

Deprecated: Deprecated by NVIDIA.

func (Handle) ReorderFilterAndBias deprecated

func (h Handle) ReorderFilterAndBias(filterDesc FilterDescriptor, reorderType ReorderType, filterData driver.DevicePtr, reorderedFilterData driver.DevicePtr, reorderBias int32, biasData driver.DevicePtr, reorderedBiasData driver.DevicePtr) error

ReorderFilterAndBias reorders the filter and bias values for tensors with data type CUDNN_DATA_INT8x32 and tensor format TensorNchwVectC.

This function reorders the filter and bias values for tensors with data type CUDNN_DATA_INT8x32 and tensor format TensorNchwVectC. It can be used to enhance the inference time by separating the reordering operation from convolution. Filter and bias tensors with data type CUDNN_DATA_INT8x32 (also implying tensor format TensorNchwVectC) requires permutation of output channel axes in order to take advantage of the Tensor Core IMMA instruction. This is done in every Handle.ConvolutionForward and Handle.ConvolutionBiasActivationForward call when the reorder type attribute of the convolution descriptor is set to DefaultReorder. Users can avoid the repeated reordering kernel call by first using this call to reorder the filter and bias tensor and call the convolution forward APIs with reorder type set to NoReorder. For example, convolutions in a neural network of multiple layers can require reordering of kernels at every layer, which can take up a significant fraction of the total inference time. Using this function, the reordering can be done one time on the filter and bias data. This is followed by the convolution operations at the multiple layers, which enhance the inference time.

  • filterDesc: Input. Descriptor for the kernel dataset
  • reorderType: Input. Setting to either perform reordering or not. For more information, refer to ReorderType
  • filterData: Input. Pointer to the filter (kernel) data location in the device memory
  • reorderedFilterData: Output. Pointer to the location in the device memory where the reordered filter data will be written to, by this function. This tensor has the same dimensions as filterData
  • reorderBias: Input. If > 0, then reorders the biasData also. If <= 0 then does not perform reordering operations on the biasData
  • biasData: Input. Pointer to the bias data location in the device memory
  • reorderedBiasData: Output. Pointer to the location in the device memory where the reordered biasData will be written to, by this function. This tensor has the same dimensions as biasData

A nil error means reordering was successful.

Errors:

  • ErrBadParam: The handle, filter descriptor, filter data, or reordered data is NULL. Or, if the bias reordering is requested ( reorderBias > 0), the biasData or reordered biasData is NULL. This status can also be returned if the filter dimension size is not 4.
  • ErrExecutionFailed: Either the reordering of the filter data or of the biasData failed.
  • ErrNotSupported: Filter descriptor data type is not CUDNN_DATA_INT8x32; the filter descriptor tensor is not in a vectorized layout ( TensorNchwVectC).

Wraps cudnnReorderFilterAndBias.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) ScaleTensor deprecated

func (h Handle) ScaleTensor(yDesc TensorDescriptor, y driver.DevicePtr, alpha unsafe.Pointer) error

ScaleTensor scales all the elements of a tensor by a given factor.

This function scales all the elements of a tensor by a given factor.

  • yDesc: Input. Handle to a previously initialized tensor descriptor
  • y: Input/Output. Pointer to data of the tensor described by the yDesc descriptor
  • alpha: Input. Pointer in Host memory to a single value that all elements of the tensor will be scaled with. For more information, refer to Scaling Parameters

A nil error means the function launched successfully.

Errors:

Wraps cudnnScaleTensor.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) SetStream

func (h Handle) SetStream(streamId driver.Stream) error

SetStream sets the user’s CUDA stream in the cuDNN handle.

The new stream will be used to launch cuDNN GPU kernels or to synchronize to this stream when cuDNN kernels are launched in the internal streams. If the cuDNN library stream is not set, all kernels use the default ( NULL) stream. Setting the user stream in the cuDNN handle guarantees the issue-order execution of cuDNN calls and other GPU kernels launched in the same stream. With CUDA 11.x or later, internal streams have the same priority as the stream set by the last call to this function. In CUDA graph capture mode, CUDA 11.8 or later is required in order for the stream priorities to match.

  • streamId: Input. New CUDA stream to be written to the cuDNN handle

A nil error means the new stream was set successfully.

Errors:

Wraps cudnnSetStream.

func (Handle) SetTensor

func (h Handle) SetTensor(yDesc TensorDescriptor, y driver.DevicePtr, valuePtr unsafe.Pointer) error

SetTensor sets all the elements of a tensor to a given value.

  • yDesc: Input. Handle to a previously initialized tensor descriptor
  • y: Input/Output. Pointer to data of the tensor described by the yDesc descriptor
  • valuePtr: Input. Pointer in host memory to a single value. All elements of the y tensor will be set to value[0]. The data type of the element in value[0] has to match the data type of tensor y

A nil error means the function launched successfully.

Errors:

Wraps cudnnSetTensor.

func (Handle) SoftmaxBackward

SoftmaxBackward computes the gradient of the softmax function.

In-place operation is allowed for this routine; meaning, dy and dx pointers may be equal. However, this requires dyDesc and dxDesc descriptors to be identical (particularly, the strides of the input and output must match for in-place operation to be allowed). All tensor formats are supported for all modes and algorithms with 4 and 5D tensors. Performance is expected to be highest with NCHW fully-packed tensors. For more than 5 dimensions tensors must be packed in their spatial dimensions.

  • mode: Input. Enumerant to specify the softmax mode
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized input tensor descriptor
  • y: Input. Data pointer to GPU memory associated with the tensor descriptor yDesc
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyData
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dxDesc: Input. Handle to the previously initialized output differential tensor descriptor
  • dx: Output. Data pointer to GPU memory associated with the output tensor descriptor dxDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions n, c, h, w of the yDesc, dyDesc and dxDesc tensors differ. The strides nStride, cStride, hStride, wStride of the yDesc and dyDesc tensors differ. The datatype of the three tensors differs.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnSoftmaxBackward.

func (Handle) SoftmaxForward

func (h Handle) SoftmaxForward(algo SoftmaxAlgorithm, mode SoftmaxMode, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

SoftmaxForward computes the softmax function.

In-place operation is allowed for this routine; meaning, x and y pointers may be equal. However, this requires xDesc and yDesc descriptors to be identical (particularly, the strides of the input and output must match for in-place operation to be allowed). All tensor formats are supported for all modes and algorithms with 4 and 5D tensors. Performance is expected to be highest with NCHW fully-packed tensors. For more than 5 dimensions tensors must be packed in their spatial dimensions.

  • mode: Input. Enumerant to specify the softmax mode
  • alpha: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • beta: Input. Pointers to scaling factors (in host memory) used to blend the computation result with prior value in the output layer as follows: dstValue = alpha[0]*result + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized output tensor descriptor
  • y: Output. Data pointer to GPU memory associated with the output tensor descriptor yDesc

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: The dimensions n, c, h, w of the input tensor and output tensors differ. The datatype of the input tensor and output tensors differ. The parameters algorithm or mode have an invalid enumerant value.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnSoftmaxForward.

func (Handle) SpatialTfGridGeneratorBackward

func (h Handle) SpatialTfGridGeneratorBackward(stDesc SpatialTransformerDescriptor, dgrid driver.DevicePtr, dtheta driver.DevicePtr) error

SpatialTfGridGeneratorBackward computes the gradient of a grid generation operation.

Only 2D transformation is supported.

  • stDesc: Input. Previously created spatial transformer descriptor object
  • dgrid: Input. Data pointer to GPU memory contains the input differential data
  • dtheta: Output. Data pointer to GPU memory contains the output differential data

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is NULL. One of the parameters dgrid or dtheta is NULL.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples incldue: The dimension of the transformed tensor specified in stDesc > 4.

Wraps cudnnSpatialTfGridGeneratorBackward.

func (Handle) SpatialTfGridGeneratorForward

func (h Handle) SpatialTfGridGeneratorForward(stDesc SpatialTransformerDescriptor, theta driver.DevicePtr, grid driver.DevicePtr) error

SpatialTfGridGeneratorForward generates a grid of coordinates in the input tensor corresponding to each pixel from the output tensor.

Only 2D transformation is supported.

  • stDesc: Input. Previously created spatial transformer descriptor object
  • theta: Input. Affine transformation matrix. It should be of size n*2*3 for a 2D transformation, where n is the number of images specified in stDesc
  • grid: Output. A grid of coordinates. It is of size n*h*w*2 for a 2D transformation, where n, h, w is specified in stDesc. In the 4th dimension, the first coordinate is x, and the second coordinate is y

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is NULL. One of the parameters grid or theta is NULL.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: The dimension of the transformed tensor specified in stDesc > 4.

Wraps cudnnSpatialTfGridGeneratorForward.

func (Handle) SpatialTfSamplerBackward

func (h Handle) SpatialTfSamplerBackward(stDesc SpatialTransformerDescriptor, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, dxDesc TensorDescriptor, dx driver.DevicePtr, alphaDgrid unsafe.Pointer, dyDesc TensorDescriptor, dy driver.DevicePtr, grid driver.DevicePtr, betaDgrid unsafe.Pointer, dgrid driver.DevicePtr) error

SpatialTfSamplerBackward computes the gradient of a sampling operation.

Only 2D transformation is supported.

  • stDesc: Input. Previously created spatial transformer descriptor object
  • alpha: Input. Pointers 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. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • beta: Input. Pointers 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. For more information, refer to Scaling Parameters
  • dxDesc: Input. Handle to the previously initialized output differential tensor descriptor
  • dx: Output. Data pointer to GPU memory associated with the output tensor descriptor dxDesc
  • alphaDgrid: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dgrid with prior value in the destination pointer as follows: dstValue = alpha[0]*srcValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dyDesc: Input. Handle to the previously initialized input differential tensor descriptor
  • dy: Input. Data pointer to GPU memory associated with the tensor descriptor dyDesc
  • grid: Input. A grid of coordinates generated by Handle.SpatialTfGridGeneratorForward
  • betaDgrid: Input. Pointers to scaling factors (in host memory) used to blend the gradient outputs dgrid with prior value in the destination pointer as follows: dstValue = alpha[0]*srcValue + beta[0]*priorDstValue. For more information, refer to Scaling Parameters
  • dgrid: Output. Data pointer to GPU memory contains the output differential data

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is NULL. One of the parameters x, dx, y, dy, grid, and dgrid is NULL. The dimension of dy differs from those specified in stDesc.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: The dimension of transformed tensor > 4.

Wraps cudnnSpatialTfSamplerBackward.

func (Handle) SpatialTfSamplerForward

func (h Handle) SpatialTfSamplerForward(stDesc SpatialTransformerDescriptor, alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, grid driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

SpatialTfSamplerForward performs a sampler operation and generates the output tensor using the grid given by the grid generator.

Only 2D transformation is supported.

  • stDesc: Input. Previously created spatial transformer descriptor object
  • alpha: Input. Pointers 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. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to the previously initialized input tensor descriptor
  • x: Input. Data pointer to GPU memory associated with the tensor descriptor xDesc
  • grid: Input. A grid of coordinates generated by Handle.SpatialTfGridGeneratorForward
  • beta: Input. Pointers 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. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to the previously initialized output tensor descriptor
  • y: Output. Data pointer to GPU memory associated with the output tensor descriptor yDesc

Errors:

  • ErrBadParam: At least one of the following conditions are met: handle is NULL. One of the parameters x, y, or grid is NULL. The dimension of dy differs from those specified in stDesc.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Some examples include: The dimension of transformed tensor > 4.

Wraps cudnnSpatialTfSamplerForward.

func (Handle) Stream

func (h Handle) Stream() (driver.Stream, error)

Stream retrieves the user CUDA stream programmed in the cuDNN handle.

When the user’s CUDA stream is not set in the cuDNN handle, this function reports the null-stream.

A nil error means the stream identifier was retrieved successfully.

Errors:

Wraps cudnnGetStream.

func (Handle) TransformFilter deprecated

func (h Handle) TransformFilter(transDesc TensorTransformDescriptor, alpha unsafe.Pointer, srcDesc FilterDescriptor, srcData driver.DevicePtr, beta unsafe.Pointer, destDesc FilterDescriptor, destData driver.DevicePtr) error

TransformFilter converts the filter between different formats, data types, or dimensions based on the described transformation.

This function converts the filter between different formats, data types, or dimensions based on the described transformation. It can be used to convert a filter with an unsupported layout format to a filter with a supported layout format. This function copies the scaled data from the input filter srcDesc to the output tensor destDesc with a different layout. If the filter descriptors of srcDesc and destDesc have different dimensions, they must be consistent with folding and padding amount and order specified in transDesc. The srcDesc and destDesc tensors must not overlap in any way (meaning, tensors cannot be transformed in place). When performing a folding transform or a zero-padding transform, the scaling factors ( alpha, beta) should be set to (1, 0). However, unfolding transforms support any ( alpha, beta) values. This function is thread safe.

  • transDesc: Input. A descriptor containing the details of the requested filter transformation. For more information, refer to TensorTransformDescriptor
  • alpha: Input. Pointers, in the host memory, to the scaling factors used to scale the data in the input tensor srcDesc. beta is used to scale the destination tensor, while alpha is used to scale the source tensor. For more information, refer to Scaling Parameters. The beta scaling value is not honored in the folding and zero-padding cases. Unfolding supports any ( alpha, beta)
  • srcDesc: Input. Handles to the previously initiated filter descriptors. srcDesc and destDesc must not overlap. For more information, refer to TensorDescriptor
  • srcData: Input. Pointers, in the host memory, to the data of the tensor described by srcDesc and destDesc respectively
  • beta: Input. Pointers, in the host memory, to the scaling factors used to scale the data in the input tensor srcDesc. beta is used to scale the destination tensor, while alpha is used to scale the source tensor. For more information, refer to Scaling Parameters. The beta scaling value is not honored in the folding and zero-padding cases. Unfolding supports any ( alpha, beta)
  • destDesc: Input. Handles to the previously initiated filter descriptors. srcDesc and destDesc must not overlap. For more information, refer to TensorDescriptor
  • destData: Input. Pointers, in the host memory, to the data of the tensor described by srcDesc and destDesc respectively

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: A parameter is uninitialized or initialized incorrectly, or the number of dimensions is different between srcDesc and destDesc.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration. Also, in the folding and padding paths, any value other than A=1 and B=0 will result in a ErrNotSupported.

Wraps cudnnTransformFilter.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) TransformTensor deprecated

func (h Handle) TransformTensor(alpha unsafe.Pointer, xDesc TensorDescriptor, x driver.DevicePtr, beta unsafe.Pointer, yDesc TensorDescriptor, y driver.DevicePtr) error

TransformTensor 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. 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 (meaning, tensors cannot be transformed in place). This function can be used to convert a tensor with an unsupported format to a supported one.

  • alpha: Input. Pointers 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. For more information, refer to Scaling Parameters
  • xDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • x: Input. Pointer to data of the tensor described by the xDesc descriptor
  • beta: Input. Pointers 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. For more information, refer to Scaling Parameters
  • yDesc: Input. Handle to a previously initialized tensor descriptor. For more information, refer to TensorDescriptor
  • y: Output. Pointer to data of the tensor described by the yDesc descriptor

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: The dimensions n, c, h, w or the dataType of the two tensor descriptors are different.
  • ErrExecutionFailed: The function failed to launch on the GPU.
  • ErrNotSupported: The function does not support the provided configuration.

Wraps cudnnTransformTensor.

Deprecated: Deprecated in cuDNN 9.0.

func (Handle) TransformTensorEx deprecated

func (h Handle) TransformTensorEx(transDesc TensorTransformDescriptor, alpha unsafe.Pointer, srcDesc TensorDescriptor, srcData driver.DevicePtr, beta unsafe.Pointer, destDesc TensorDescriptor, destData driver.DevicePtr) error

TransformTensorEx converts the tensor layouts between different formats.

This function converts the tensor layouts between different formats. It can be used to convert a tensor with an unsupported layout format to a tensor with a supported layout format. This function copies the scaled data from the input tensor srcDesc to the output tensor destDesc with a different layout. The tensor descriptors of srcDesc and destDesc should have the same dimensions but need not have the same strides. The srcDesc and destDesc tensors must not overlap in any way (meaning, tensors cannot be transformed in place). When performing a folding transform or a zero-padding transform, the scaling factors ( alpha, beta) should be set to (1, 0). However, unfolding transforms support any ( alpha, beta) values. This function is thread safe.

  • transDesc: Input. A descriptor containing the details of the requested tensor transformation. For more information, refer to TensorTransformDescriptor
  • alpha: Input. Pointers, in the host memory, to the scaling factors used to scale the data in the input tensor srcDesc. beta is used to scale the destination tensor, while alpha is used to scale the source tensor. For more information, refer to Scaling Parameters. The beta scaling value is not honored in the folding and zero-padding cases. Unfolding supports any ( alpha, beta)
  • srcDesc: Input. Handles to the previously initiated tensor descriptors. srcDesc and destDesc must not overlap. For more information, refer to TensorDescriptor
  • srcData: Input. Pointers, in the host memory, to the data of the tensor described by srcDesc and destDesc respectively
  • beta: Input. Pointers, in the host memory, to the scaling factors used to scale the data in the input tensor srcDesc. beta is used to scale the destination tensor, while alpha is used to scale the source tensor. For more information, refer to Scaling Parameters. The beta scaling value is not honored in the folding and zero-padding cases. Unfolding supports any ( alpha, beta)
  • destDesc: Input. Handles to the previously initiated tensor descriptors. srcDesc and destDesc must not overlap. For more information, refer to TensorDescriptor
  • destData: Input. Pointers, in the host memory, to the data of the tensor described by srcDesc and destDesc respectively

A nil error means the function was launched successfully.

Errors:

  • ErrBadParam: A parameter is uninitialized or initialized incorrectly, or the number of dimensions is different between srcDesc and destDesc.
  • ErrExecutionFailed: Function failed to launch on the GPU.
  • ErrNotSupported: Function does not support the provided configuration. Also, in the folding and padding paths, any value other than A=1 and B=0 will result in a ErrNotSupported.

Wraps cudnnTransformTensorEx.

Deprecated: Deprecated in cuDNN 9.0.

type IndicesType deprecated

type IndicesType int32

IndicesType is an enumerated type used to indicate the data type for the indices to be computed by the Handle.ReduceTensor routine. This enumerated type is used as a field for the ReduceTensorDescriptor descriptor.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	N32bitIndices IndicesType = 0 // Compute unsigned int indices.
	N64bitIndices IndicesType = 1 // Compute unsigned long indices.
	N16bitIndices IndicesType = 2 // Compute unsigned short indices.
	N8BITIndices  IndicesType = 3 // Compute unsigned char indices.
)

func (IndicesType) String

func (e IndicesType) String() string

String returns the constant name, or a numeric representation for unknown values.

type LRNDescriptor

type LRNDescriptor uintptr

LRNDescriptor is a pointer to an opaque structure holding the parameters of a local response normalization.

CreateLRNDescriptor is used to create one instance, and the routine LRNDescriptor.Set must be used to initialize this instance.

func CreateLRNDescriptor

func CreateLRNDescriptor() (LRNDescriptor, error)

CreateLRNDescriptor allocates the memory needed to hold the data needed for LRN and DivisiveNormalization layers operation and returns a descriptor used with subsequent layer forward and backward calls.

Errors:

Wraps cudnnCreateLRNDescriptor.

func (*LRNDescriptor) Close

func (l *LRNDescriptor) Close() error

Close destroys a previously created LRN descriptor object.

If l is zero, Close returns nil. Otherwise Close sets l to zero when the call succeeds and leaves it unchanged when it fails. Only l is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyLRNDescriptor.

func (LRNDescriptor) Destroy deprecated

func (l LRNDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use LRNDescriptor.Close instead.

func (LRNDescriptor) Get

Get retrieves values stored in the previously initialized LRN descriptor object.

A nil error means function completed successfully.

Wraps cudnnGetLRNDescriptor.

func (LRNDescriptor) Set

func (l LRNDescriptor) Set(lrnN uint32, lrnAlpha float64, lrnBeta float64, lrnK float64) error

Set initializes a previously created LRN descriptor object.

  • lrnN: Input. Normalization window width in elements. The LRN layer uses a window [center-lookBehind, center+lookAhead], where lookBehind = floor( (lrnN-1)/2 ), lookAhead = lrnN-lookBehind-1. So for n=10, the window is [k-4...k...k+5] with a total of 10 samples. For the DivisiveNormalization layer, the window has the same extent as above in all spatial dimensions ( dimA[2], dimA[3], dimA[4]). By default, lrnN is set to 5 in CreateLRNDescriptor
  • lrnAlpha: Input. Value of the alpha variance scaling parameter in the normalization formula. Inside the library code, this value is divided by the window width for LRN and by (window width)^#spatialDimensions for DivisiveNormalization. By default, this value is set to 1e-4 in CreateLRNDescriptor
  • lrnBeta: Input. Value of the beta power parameter in the normalization formula. By default, this value is set to 0.75 in CreateLRNDescriptor
  • lrnK: Input. Value of the k parameter in the normalization formula. By default, this value is set to 2.0

Errors:

  • ErrBadParam: One of the input parameters was out of valid range as described above.

Wraps cudnnSetLRNDescriptor.

type LRNMode

type LRNMode int32

LRNMode is an enumerated type used to specify the mode of operation in Handle.LRNCrossChannelForward and Handle.LRNCrossChannelBackward.

const (
	LrnCrossChannelDIM1 LRNMode = 0 // LRN computation is performed across the tensor’s dimension dimA[1].
)

func (LRNMode) String

func (e LRNMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type LibraryAttempt

type LibraryAttempt struct {
	Name string // path or soname passed to dlopen
	Err  error
}

LibraryAttempt records one failed attempt to open the shared library.

type LibraryConflictError

type LibraryConflictError struct {
	Loaded    string
	Requested string

	// Implicit reports that the loaded library was opened lazily and no
	// successful Load has since acknowledged it. A
	// caller that sees this called some
	// other function first, and that call took the default search list.
	Implicit bool
}

LibraryConflictError reports a Load call naming a different library than the one already loaded. Only one library is loaded per process.

func (*LibraryConflictError) Error

func (e *LibraryConflictError) Error() string

Error reports the conflicting library paths, and whether the library that is already loaded got there without a Load call.

type LibraryError

type LibraryError struct {
	Library  string
	Env      string
	Path     string
	Attempts []LibraryAttempt
	Hint     string
}

LibraryError reports that libcudnn could not be opened. Attempts lists every name tried in order. Path is set when an explicit path, from Load or CUDNN_LIB_PATH, was requested and failed. Hint reports pkg-config discovery results and query failures, when discovery ran.

func (*LibraryError) Error

func (e *LibraryError) Error() string

Error describes the library load attempts and their errors.

func (*LibraryError) Unwrap

func (e *LibraryError) Unwrap() []error

Unwrap returns the error from each attempt.

type LibraryPropertyType

type LibraryPropertyType int32

LibraryPropertyType identifies a library property to query.

const (
	MajorVersion LibraryPropertyType = 0
	MinorVersion LibraryPropertyType = 1
	PatchLevel   LibraryPropertyType = 2
)

LibraryPropertyType constants.

type LossNormalizationMode

type LossNormalizationMode int32

LossNormalizationMode is an enumerated type that controls the input normalization mode for a loss function.

This type can be used with CTCLossDescriptor.SetEx.

const (
	LossNormalizationNone    LossNormalizationMode = 0 // The input probs of the [Handle.CTCLoss] function is expected to be the normalized probability, and the output gradients is the gradient of loss with respect to the unnormalized probability.
	LossNormalizationSoftmax LossNormalizationMode = 1 // The input probs of the [Handle.CTCLoss] function is expected to be the unnormalized activation from the previous layer, and the output gradients is the gradient with respect to the activation. Internally the probability is computed by softmax normalization.
)

func (LossNormalizationMode) String

func (e LossNormalizationMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type MathType

type MathType int32

MathType is an enumerated type used to indicate if the use of Tensor Core operations is permitted in a given library routine.

const (
	DefaultMath                 MathType = 0 // Tensor Core operations are not used on pre-NVIDIA A100 GPU devices. On A100 GPU architecture devices, Tensor Core TF32 operation is permitted.
	TensorOpMath                MathType = 1 // The use of Tensor Core operations is permitted but will not actively perform datatype down conversion on tensors in order to utilize Tensor Cores.
	TensorOpMathAllowConversion MathType = 2 // The use of Tensor Core operations is permitted and will actively perform datatype down conversion on tensors in order to utilize Tensor Cores.
	FmaMath                     MathType = 3 // Restricted to only kernels that use FMA instructions. On pre-NVIDIA A100 GPU devices, [DefaultMath] and [FmaMath] have the same behavior: Tensor Core kernels will not be selected. With NVIDIA Ampere architecture and CUDA toolkit 11, [DefaultMath] permits TF32 Tensor Core operation and [FmaMath] does not. The TF32 behavior for [DefaultMath] and the other Tensor Core math types can be explicitly disabled by the environment variable NVIDIA_TF32_OVERRIDE=0.
)

func (MathType) String

func (e MathType) String() string

String returns the constant name, or a numeric representation for unknown values.

type MoeGroupedMatmulMode

type MoeGroupedMatmulMode int32

MoeGroupedMatmulMode specifies the moe grouped matmul mode (cudnnMoeGroupedMatmulMode_t).

const (
	MoeGroupedMatmulModeNone    MoeGroupedMatmulMode = 0
	MoeGroupedMatmulModeGather  MoeGroupedMatmulMode = 1
	MoeGroupedMatmulModeScatter MoeGroupedMatmulMode = 2
)

func (MoeGroupedMatmulMode) String

func (e MoeGroupedMatmulMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type MultiHeadAttnWeightKind

type MultiHeadAttnWeightKind int32

MultiHeadAttnWeightKind is an enumerated type that specifies a group of weights or biases in the Handle.MultiHeadAttnWeights function.

const (
	MhAttnQWeights MultiHeadAttnWeightKind = 0 // Selects the input projection weights for queries.
	MhAttnKWeights MultiHeadAttnWeightKind = 1 // Selects the input projection weights for keys.
	MhAttnVWeights MultiHeadAttnWeightKind = 2 // Selects the input projection weights for values.
	MhAttnOWeights MultiHeadAttnWeightKind = 3 // Selects the output projection weights.
	MhAttnQBiases  MultiHeadAttnWeightKind = 4 // Selects the input projection biases for queries.
	MhAttnKBiases  MultiHeadAttnWeightKind = 5 // Selects the input projection biases for keys.
	MhAttnVBiases  MultiHeadAttnWeightKind = 6 // Selects the input projection biases for values.
	MhAttnOBiases  MultiHeadAttnWeightKind = 7 // Selects the output projection biases.
)

func (MultiHeadAttnWeightKind) String

func (e MultiHeadAttnWeightKind) String() string

String returns the constant name, or a numeric representation for unknown values.

type NanPropagation deprecated

type NanPropagation int32

NanPropagation is an enumerated type used to indicate if a given routine should propagate Nan numbers.

This enumerated type is used as a field for the ActivationDescriptor descriptor and PoolingDescriptor descriptor.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	// NotPropagateNan: NAN numbers are not propagated.
	//
	// Deprecated: Deprecated by NVIDIA.
	NotPropagateNan NanPropagation = 0
	// PropagateNan: NAN numbers are propagated.
	//
	// Deprecated: Deprecated by NVIDIA.
	PropagateNan NanPropagation = 1
)

func (NanPropagation) String

func (e NanPropagation) String() string

String returns the constant name, or a numeric representation for unknown values.

type NormAlgo deprecated

type NormAlgo int32

NormAlgo is an enumerated type used to specify the algorithm to execute the normalization operation.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	NormAlgoStandard NormAlgo = 0 // Standard normalization is performed.
	NormAlgoPersist  NormAlgo = 1 // This mode is similar to [NormAlgoStandard], however it only supports [NormPerChannel] and can be faster for some tasks. An optimized path may be selected for [DataFloat] and [DataHalf] types, compute capability 6.0 or higher for the following two normalization API calls: [Handle.NormalizationForwardTraining] and [Handle.NormalizationBackward]. In the case of [Handle.NormalizationBackward], the savedMean and savedInvVariance arguments should not be NULL. NCHW Mode Only This mode may use a scaled atomic integer reduction that is deterministic but imposes more restrictions on the input data range. When a numerical overflow occurs, the algorithm may produce NaN-s or Inf-s (infinity) in output buffers. When Inf-s/NaN-s are present in the input data, the output in this mode is the same as from a pure floating-point implementation. For finite but very large input values, the algorithm may encounter overflows more frequently due to a lower dynamic range and emit Inf-s/NaN-s while [NormAlgoStandard] will produce finite results. The user can invoke [Handle.QueryRuntimeError] to check if a numerical overflow occurred in this mode.
)

func (NormAlgo) String

func (e NormAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type NormMode deprecated

type NormMode int32

NormMode is an enumerated type used to specify the mode of operation in Handle.NormalizationForwardInference, Handle.NormalizationForwardTraining, Handle.BatchNormalizationBackward, Handle.NormalizationForwardTrainingWorkspaceSize, Handle.NormalizationBackwardWorkspaceSize, and Handle.NormalizationTrainingReserveSpaceSize routines.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	NormPerActivation NormMode = 0 // Normalization is performed per-activation. This mode is intended to be used after the non-convolutional network layers. In this mode, the tensor dimensions of normBias and normScale and the parameters used in the cudnnNormalization* functions are 1xCxHxW.
	NormPerChannel    NormMode = 1 // Normalization is performed per-channel over N+spatial dimensions. This mode is intended for use after convolutional layers (where spatial invariance is desired). In this mode, the normBias and normScale tensor dimensions are 1xCx1x1.
)

func (NormMode) String

func (e NormMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type NormOps deprecated

type NormOps int32

NormOps is an enumerated type used to specify the mode of operation in Handle.NormalizationForwardTrainingWorkspaceSize, Handle.NormalizationForwardTraining, Handle.NormalizationBackwardWorkspaceSize, Handle.NormalizationBackward, and Handle.NormalizationTrainingReserveSpaceSize functions.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	NormOpsNorm              NormOps = 0 // Only normalization is performed.
	NormOpsNormActivation    NormOps = 1 // First, the normalization is performed, then the activation is performed.
	NormOpsNormAddActivation NormOps = 2 // Performs the normalization, then element-wise addition, followed by the activation operation.
)

func (NormOps) String

func (e NormOps) String() string

String returns the constant name, or a numeric representation for unknown values.

type OpTensorDescriptor deprecated

type OpTensorDescriptor uintptr

OpTensorDescriptor is a pointer to an opaque structure holding the description of a Tensor Core operation, used as a parameter to Handle.OpTensor. CreateOpTensorDescriptor is used to create one instance, and OpTensorDescriptor.Set must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateOpTensorDescriptor deprecated

func CreateOpTensorDescriptor() (OpTensorDescriptor, error)

CreateOpTensorDescriptor creates a tensor pointwise math descriptor.

For more information, refer to OpTensorDescriptor.

Errors:

  • ErrAllocFailed: Memory allocation for this tensor pointwise math descriptor failed.
  • ErrBadParam: Tensor pointwise math descriptor passed to the function is invalid.

Wraps cudnnCreateOpTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (*OpTensorDescriptor) Close deprecated

func (o *OpTensorDescriptor) Close() error

Close deletes a tensor pointwise math descriptor object.

If o is zero, Close returns nil. Otherwise Close sets o to zero when the call succeeds and leaves it unchanged when it fails. Only o is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyOpTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (OpTensorDescriptor) Destroy deprecated

func (o OpTensorDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use OpTensorDescriptor.Close instead.

func (OpTensorDescriptor) Get deprecated

Get returns the configuration of the passed tensor pointwise math descriptor.

Errors:

  • ErrBadParam: Input tensor pointwise math descriptor passed is invalid.

Wraps cudnnGetOpTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (OpTensorDescriptor) Set deprecated

func (o OpTensorDescriptor) Set(opTensorOp OpTensorOp, opTensorCompType DataType, opTensorNanOpt NanPropagation) error

Set initializes a tensor pointwise math descriptor.

  • opTensorOp: Input. Tensor pointwise math operation for this tensor pointwise math descriptor
  • opTensorCompType: Input. Computation datatype for this tensor pointwise math descriptor
  • opTensorNanOpt: Input. NAN propagation policy

Errors:

  • ErrBadParam: At least one of the input parameters passed is invalid.

Wraps cudnnSetOpTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

type OpTensorOp

type OpTensorOp int32

OpTensorOp is an enumerated type used to indicate the Tensor Core operation to be used by the Handle.OpTensor routine. This enumerated type is used as a field for the OpTensorDescriptor descriptor.

const (
	OpTensorAdd  OpTensorOp = 0 // The operation to be performed is addition.
	OpTensorMul  OpTensorOp = 1 // The operation to be performed is multiplication.
	OpTensorMin  OpTensorOp = 2 // The operation to be performed is a minimum comparison.
	OpTensorMax  OpTensorOp = 3 // The operation to be performed is a maximum comparison.
	OpTensorSqrt OpTensorOp = 4 // The operation to be performed is square root, performed on only the A tensor.
	OpTensorNot  OpTensorOp = 5 // The operation to be performed is negation, performed on only the A tensor.
)

func (OpTensorOp) String

func (e OpTensorOp) String() string

String returns the constant name, or a numeric representation for unknown values.

type PaddingMode

type PaddingMode int32

PaddingMode is an enumerated type to indicate the padding mode in the backend resample operations.

const (
	ZeroPad    PaddingMode = 0
	NegInfPad  PaddingMode = 1
	EdgeValPad PaddingMode = 2
)

func (PaddingMode) String

func (e PaddingMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type PointwiseMode

type PointwiseMode int32

PointwiseMode is an enumerated type to indicate the intended pointwise math operation in the backend pointwise operation descriptor.

const (
	PointwiseAdd               PointwiseMode = 0  // A pointwise addition between two tensors is computed.
	PointwiseAddSquare         PointwiseMode = 5  // A pointwise addition between the first tensor and the square of the second tensor is computed.
	PointwiseDiv               PointwiseMode = 6  // A pointwise true division of the first tensor by second tensor is computed.
	PointwiseMax               PointwiseMode = 3  // A pointwise maximum is taken between two tensors.
	PointwiseMin               PointwiseMode = 2  // A pointwise minimum is taken between two tensors.
	PointwiseMod               PointwiseMode = 7  // A pointwise floating-point remainder of the first tensor’s division by the second tensor is computed.
	PointwiseMul               PointwiseMode = 1  // A pointwise multiplication between two tensors is computed.
	PointwisePow               PointwiseMode = 8  // A pointwise value from the first tensor to the power of the second tensor is computed.
	PointwiseSub               PointwiseMode = 9  // A pointwise subtraction between two tensors is computed.
	PointwiseAbs               PointwiseMode = 10 // A pointwise absolute value of the input tensor is computed.
	PointwiseCeil              PointwiseMode = 11 // A pointwise ceiling of the input tensor is computed.
	PointwiseCos               PointwiseMode = 12 // A pointwise trigonometric cosine of the input tensor is computed.
	PointwiseExp               PointwiseMode = 13 // A pointwise exponential of the input tensor is computed.
	PointwiseFloor             PointwiseMode = 14 // A pointwise floor of the input tensor is computed.
	PointwiseLog               PointwiseMode = 15 // A pointwise natural logarithm of the input tensor is computed.
	PointwiseNeg               PointwiseMode = 16 // A pointwise numerical negative of the input tensor is computed.
	PointwiseRsqrt             PointwiseMode = 17 // A pointwise reciprocal of the square root of the input tensor is computed.
	PointwiseSin               PointwiseMode = 18 // A pointwise trigonometric sine of the input tensor is computed.
	PointwiseSqrt              PointwiseMode = 4  // A pointwise square root of the input tensor is computed.
	PointwiseTan               PointwiseMode = 19 // A pointwise trigonometric tangent of the input tensor is computed.
	PointwiseErf               PointwiseMode = 20 // A pointwise Error Function is computed.
	PointwiseIdentity          PointwiseMode = 21 // No computation is performed. As with other pointwise modes, this mode provides implicit conversions by specifying the data type of the input tensor as one type, and the data type of the output tensor as another.
	PointwiseReciprocal        PointwiseMode = 22 // A pointwise reciprocal of the input tensor is computed. In other words, for every element x in the input tensor, 1/x is computed.
	PointwiseAtan2             PointwiseMode = 23
	PointwiseReluFwd           PointwiseMode = 100 // A pointwise rectified linear activation function of the input tensor is computed.
	PointwiseTanhFwd           PointwiseMode = 101 // A pointwise tanh activation function of the input tensor is computed.
	PointwiseSigmoidFwd        PointwiseMode = 102 // A pointwise sigmoid activation function of the input tensor is computed.
	PointwiseEluFwd            PointwiseMode = 103 // A pointwise Exponential Linear Unit activation function of the input tensor is computed.
	PointwiseGeluFwd           PointwiseMode = 104 // A pointwise Gaussian Error Linear Unit activation function of the input tensor is computed.
	PointwiseSoftplusFwd       PointwiseMode = 105 // A pointwise softplus activation function of the input tensor is computed.
	PointwiseSwishFwd          PointwiseMode = 106 // A pointwise swish activation function of the input tensor is computed.
	PointwiseGeluApproxTanhFwd PointwiseMode = 107 // A pointwise tanh approximation of the Gaussian Error Linear Unit activation function of the input tensor is computed. The tanh GELU approximation is computed as 0.5x(1+tanh⁡[2/π(x+0.044715x³)]). For more information, refer to the GAUSSIAN ERROR LINEAR UNIT (GELUS) paper.
	PointwiseReluBwd           PointwiseMode = 200 // A pointwise first derivative of rectified linear activation of the input tensor is computed.
	PointwiseTanhBwd           PointwiseMode = 201 // A pointwise first derivative of tanh activation of the input tensor is computed.
	PointwiseSigmoidBwd        PointwiseMode = 202 // A pointwise first derivative of sigmoid activation of the input tensor is computed.
	PointwiseEluBwd            PointwiseMode = 203 // A pointwise first derivative of Exponential Linear Unit activation of the input tensor is computed.
	PointwiseGeluBwd           PointwiseMode = 204 // A pointwise first derivative of Gaussian Error Linear Unit activation of the input tensor is computed.
	PointwiseSoftplusBwd       PointwiseMode = 205 // A pointwise first derivative of softplus activation of the input tensor is computed.
	PointwiseSwishBwd          PointwiseMode = 206 // A pointwise first derivative of swish activation of the input tensor is computed.
	PointwiseGeluApproxTanhBwd PointwiseMode = 207 // A pointwise first derivative of the tanh approximation of the Gaussian Error Linear Unit activation of the input tensor is computed. This is computed as 0.5(1+tanh⁡(b(x+cx³))+bxsech²(b(cx³+x))(3cx²+1)dy) where b is 2/π and c is 0.044715.
	PointwiseCmpEq             PointwiseMode = 300 // A pointwise truth value of the first tensor equal to the second tensor is computed.
	PointwiseCmpNeq            PointwiseMode = 301 // A pointwise truth value of the first tensor not equal to the second tensor is computed.
	PointwiseCmpGt             PointwiseMode = 302 // A pointwise truth value of the first tensor greater than the second tensor is computed.
	PointwiseCmpGe             PointwiseMode = 303 // A pointwise truth value of the first tensor greater than equal to the second tensor is computed.
	PointwiseCmpLt             PointwiseMode = 304 // A pointwise truth value of the first tensor less than the second tensor is computed.
	PointwiseCmpLe             PointwiseMode = 305 // A pointwise truth value of the first tensor less than equal to the second tensor is computed.
	PointwiseLogicalAnd        PointwiseMode = 400 // A pointwise truth value of the first tensor logical AND second tensor is computed.
	PointwiseLogicalOr         PointwiseMode = 401 // A pointwise truth value of the first tensor logical OR second tensor is computed.
	PointwiseLogicalNot        PointwiseMode = 402 // A pointwise truth value of input tensors logical NOT is computed.
	PointwiseGenIndex          PointwiseMode = 501 // A pointwise index value of the input tensor is generated along a given axis.
	PointwiseBinarySelect      PointwiseMode = 601 // A pointwise value is selected amongst two input tensors based on a given predicate tensor.
)

func (PointwiseMode) String

func (e PointwiseMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type Pooling2DConfig

type Pooling2DConfig struct {
	// Enumerant to specify the pooling mode.
	Mode PoolingMode
	// Enumerant to specify the Nan propagation mode.
	MaxpoolingNanOpt NanPropagation
	// Height of the pooling window.
	WindowHeight int32
	// Width of the pooling window.
	WindowWidth int32
	// Size of vertical padding.
	VerticalPadding int32
	// Size of horizontal padding.
	HorizontalPadding int32
	// Pooling vertical stride.
	VerticalStride int32
	// Pooling horizontal stride.
	HorizontalStride int32
}

Pooling2DConfig holds the settings PoolingDescriptor.Get2D reports.

type PoolingConfig

type PoolingConfig struct {
	// Enumerant to specify the pooling mode.
	Mode PoolingMode
	// Input. Enumerant to specify the Nan propagation mode.
	MaxpoolingNanOpt NanPropagation
	// Array of dimension of at least nbDimsRequested that will be filled with the window parameters from the provided pooling descriptor.
	WindowDimA []int32
	// Array of dimension of at least nbDimsRequested that will be filled with the padding parameters from the provided pooling descriptor.
	PaddingA []int32
	// Array of dimension at least nbDimsRequested that will be filled with the stride parameters from the provided pooling descriptor.
	StrideA []int32
}

PoolingConfig holds the settings PoolingDescriptor.Get reports.

type PoolingDescriptor deprecated

type PoolingDescriptor uintptr

PoolingDescriptor is a pointer to an opaque structure holding the description of a pooling operation.

CreatePoolingDescriptor is used to create one instance, and PoolingDescriptor.Set or PoolingDescriptor.Set2D must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreatePoolingDescriptor deprecated

func CreatePoolingDescriptor() (PoolingDescriptor, error)

CreatePoolingDescriptor creates a pooling descriptor object by allocating the memory needed to hold its opaque structure.

Errors:

Wraps cudnnCreatePoolingDescriptor.

Deprecated: Deprecated by NVIDIA.

func (*PoolingDescriptor) Close deprecated

func (p *PoolingDescriptor) Close() error

Close destroys a previously created pooling descriptor object.

If p is zero, Close returns nil. Otherwise Close sets p to zero when the call succeeds and leaves it unchanged when it fails. Only p is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyPoolingDescriptor.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) Destroy deprecated

func (p PoolingDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use PoolingDescriptor.Close instead.

func (PoolingDescriptor) ForwardOutputDim2D deprecated

func (p PoolingDescriptor) ForwardOutputDim2D(inputTensorDesc TensorDescriptor) (int32, int32, int32, int32, error)

ForwardOutputDim2D provides the output dimensions of a tensor after Pooling2d has been applied.

Each dimension h and w of the output images is computed as follows:

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: poolingDesc has not been initialized. poolingDesc or inputDesc has an invalid number of dimensions (2 and 4 respectively are required).

Wraps cudnnGetPooling2dForwardOutputDim.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) ForwardOutputDims deprecated

func (p PoolingDescriptor) ForwardOutputDims(inputTensorDesc TensorDescriptor, nbDims int) ([]int32, error)

ForwardOutputDims provides the output dimensions of a tensor after PoolingNd has been applied.

Each dimension of the (nbDims-2)-D images of the output tensor is computed as follows:

  • nbDims: Input. Number of dimensions in which pooling is to be applied

A nil error means the function launched successfully.

Errors:

  • ErrBadParam: At least one of the following conditions are met: poolingDesc has not been initialized. The value of nbDims is inconsistent with the dimensionality of poolingDesc and inputDesc.

Wraps cudnnGetPoolingNdForwardOutputDim.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) Get deprecated

func (p PoolingDescriptor) Get(nbDimsRequested int) (PoolingConfig, error)

Get queries a previously initialized generic PoolingNd descriptor object.

  • nbDimsRequested: Input. Dimension of the expected pooling descriptor. It is also the minimum size of the arrays windowDimA, paddingA, and strideA in order to be able to hold the results

Errors:

  • ErrNotSupported: The parameter nbDimsRequested is greater than CUDNN_DIM_MAX.

Wraps cudnnGetPoolingNdDescriptor.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) Get2D deprecated

Get2D queries a previously created Pooling2d descriptor object.

Wraps cudnnGetPooling2dDescriptor.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) Set deprecated

func (p PoolingDescriptor) Set(mode PoolingMode, maxpoolingNanOpt NanPropagation, windowDimA []int32, paddingA []int32, strideA []int32) error

Set initializes a previously created generic pooling descriptor object.

  • mode: Input. Enumerant to specify the pooling mode
  • maxpoolingNanOpt: Input. Enumerant to specify the Nan propagation mode
  • windowDimA: Input. Array of dimension nbDims containing the window size for each dimension. The value of array elements must be greater than zero
  • paddingA: Input. Array of dimension nbDims containing the padding size for each dimension. Negative padding is allowed
  • strideA: Input. Array of dimension nbDims containing the striding size for each dimension. The value of array elements must be greater than zero (meaning, negative striding size is not allowed)

Errors:

  • ErrBadParam: Either nbDims, or at least one of the elements of the arrays windowDimA or strideA is negative, or mode or maxpoolingNanOpt has an invalid enumerate value.
  • ErrNotSupported: If ( nbDims > CUDNN_DIM_MAX-2).

Wraps cudnnSetPoolingNdDescriptor.

Deprecated: Deprecated by NVIDIA.

func (PoolingDescriptor) Set2D deprecated

func (p PoolingDescriptor) Set2D(mode PoolingMode, maxpoolingNanOpt NanPropagation, windowHeight int32, windowWidth int32, verticalPadding int32, horizontalPadding int32, verticalStride int32, horizontalStride int32) error

Set2D initializes a previously created generic pooling descriptor object into a 2D description.

  • mode: Input. Enumerant to specify the pooling mode
  • maxpoolingNanOpt: Input. Enumerant to specify the Nan propagation mode
  • windowHeight: Input. Height of the pooling window
  • windowWidth: Input. Width of the pooling window
  • verticalPadding: Input. Size of vertical padding
  • horizontalPadding: Input. Size of horizontal padding
  • verticalStride: Input. Pooling vertical stride
  • horizontalStride: Input. Pooling horizontal stride

Errors:

  • ErrBadParam: At least one of the parameters windowHeight, windowWidth, verticalStride, horizontalStride is negative or mode or maxpoolingNanOpt has an invalid enumerate value.

Wraps cudnnSetPooling2dDescriptor.

Deprecated: Deprecated by NVIDIA.

type PoolingMode deprecated

type PoolingMode int32

PoolingMode is an enumerated type passed to PoolingDescriptor.Set2D to select the pooling method to be used by Handle.PoolingForward and Handle.PoolingBackward.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	PoolingMax                        PoolingMode = 0 // The maximum value inside the pooling window is used.
	PoolingAverageCountIncludePadding PoolingMode = 1 // Values inside the pooling window are averaged. The number of elements used to calculate the average includes spatial locations falling in the padding region.
	PoolingAverageCountExcludePadding PoolingMode = 2 // Values inside the pooling window are averaged. The number of elements used to calculate the average excludes spatial locations falling in the padding region.
	PoolingMaxDeterministic           PoolingMode = 3 // The maximum value inside the pooling window is used. The algorithm used is deterministic.
)

func (PoolingMode) String

func (e PoolingMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNAlgo

type RNNAlgo int32

RNNAlgo is an enumerated type used to specify the algorithm.

const (
	RnnAlgoStandard            RNNAlgo = 0 // Each RNN layer is executed as a sequence of operations. This algorithm is expected to have robust performance across a wide range of network parameters.
	RnnAlgoPersistStatic       RNNAlgo = 1 // The recurrent parts of the network are executed using a persistent kernel approach. This method is expected to be fast when the first dimension of the input tensor is small (meaning, a small minibatch). [RnnAlgoPersistStatic] is only supported on devices with compute capability >= 6.0.
	RnnAlgoPersistDynamic      RNNAlgo = 2 // The recurrent parts of the network are executed using a persistent kernel approach. This method is expected to be fast when the first dimension of the input tensor is small (meaning, a small minibatch). When using [RnnAlgoPersistDynamic] persistent kernels are prepared at runtime and are able to optimize using the specific parameters of the network and active GPU. As such, when using [RnnAlgoPersistDynamic] a one-time plan preparation stage must be executed. These plans can then be reused in repeated calls with the same model parameters. The limits on the maximum number of hidden units supported when using [RnnAlgoPersistDynamic] are significantly higher than the limits when using [RnnAlgoPersistStatic], however throughput is likely to significantly reduce when exceeding the maximums supported by [RnnAlgoPersistStatic]. In this regime, this method will still outperform [RnnAlgoStandard] for some cases. [RnnAlgoPersistDynamic] is only supported on devices with compute capability >= 6.0 on Linux machines.
	RnnAlgoPersistStaticSmallH RNNAlgo = 3
	RnnAlgoCount               RNNAlgo = 4
)

func (RNNAlgo) String

func (e RNNAlgo) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNBiasMode

type RNNBiasMode int32

RNNBiasMode is an enumerated type used to specify the number of bias vectors for RNN functions.

Refer to the description of the RNNMode enumerated type for the equations for each cell type based on the bias mode.

const (
	RnnNoBias        RNNBiasMode = 0 // Applies RNN cell formulas that do not use biases.
	RnnSingleInpBias RNNBiasMode = 1 // Applies RNN cell formulas that use one input bias vector in the input GEMM.
	RnnDoubleBias    RNNBiasMode = 2 // Applies RNN cell formulas that use two bias vectors.
	RnnSingleRecBias RNNBiasMode = 3 // Applies RNN cell formulas that use one recurrent bias vector in the recurrent GEMM.
)

func (RNNBiasMode) String

func (e RNNBiasMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNClipMode

type RNNClipMode int32

RNNClipMode is an enumerated type used to select the LSTM cell clipping mode.

const (
	RnnClipNone   RNNClipMode = 0 // Disables LSTM cell clipping.
	RnnClipMinmax RNNClipMode = 1 // Enables LSTM cell clipping.
)

func (RNNClipMode) String

func (e RNNClipMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNConfig

type RNNConfig struct {
	// Pointer to where RNN algorithm type should be stored.
	Algo RNNAlgo
	// Pointer to where RNN cell type should be saved.
	CellMode RNNMode
	// Pointer to where RNN bias mode [RNNBiasMode] should be saved.
	BiasMode RNNBiasMode
	// Pointer to where RNN unidirectional/bidirectional mode should be saved.
	DirMode DirectionMode
	// Pointer to where the mode of the first RNN layer should be saved.
	InputMode RNNInputMode
	// Pointer to where the data type of RNN weights/biases should be stored.
	DataType DataType
	// Pointer to where the math precision type should be stored.
	MathPrec DataType
	// Pointer to where the preferred option for Tensor Cores are saved.
	MathType MathType
	// Pointer to where the RNN input vector size is stored.
	InputSize int32
	// Pointer to where the size of the hidden state should be stored (the same value is used in every RNN layer).
	HiddenSize int32
	// Pointer to where the LSTM cell output size after the recurrent projection is stored.
	ProjSize int32
	// Pointer to where the number of RNN layers should be stored.
	NumLayers int32
	// Pointer to where the handle to a previously configured dropout descriptor should be stored.
	DropoutDesc DropoutDescriptor
	// Pointer to miscellaneous RNN options (flags) that do not require passing additional numerical values to configure.
	AuxFlags uint32
}

RNNConfig holds the settings RNNDescriptor.Get reports.

type RNNDataConfig

type RNNDataConfig struct {
	// Pointer to the host memory location to store the datatype of the RNN data tensor.
	DataType DataType
	// Pointer to the host memory location to store the memory layout of the RNN data tensor.
	Layout RNNDataLayout
	// The maximum sequence length within this RNN data tensor, including the padding vectors.
	MaxSeqLength int32
	// The number of sequences within the mini-batch.
	BatchSize int32
	// The vector length (meaning, embedding size) of the input or output tensor at each time-step.
	VectorSize int32
	// Pointer to the host memory location to store the integer array describing the length (meaning, number of timesteps) of each sequence. This is allowed to be a NULL pointer if arrayLengthRequested is 0.
	SeqLengthArray []int32
}

RNNDataConfig holds the settings RNNDataDescriptor.Get reports.

type RNNDataDescriptor

type RNNDataDescriptor uintptr

RNNDataDescriptor is a pointer to an opaque structure holding the description of an RNN data set.

The function CreateRNNDataDescriptor is used to create one instance, and RNNDataDescriptor.Set must be used to initialize this instance.

func CreateRNNDataDescriptor

func CreateRNNDataDescriptor() (RNNDataDescriptor, error)

CreateRNNDataDescriptor creates a RNN data descriptor object by allocating the memory needed to hold its opaque structure.

A nil error means the RNN data descriptor object was created successfully.

Errors:

Wraps cudnnCreateRNNDataDescriptor.

func (*RNNDataDescriptor) Close

func (r *RNNDataDescriptor) Close() error

Close destroys a previously created RNN data descriptor object.

Invoking RNNDataDescriptor.Close with the NULL argument is a no operation (NOP). The RNNDataDescriptor.Close function is not able to detect if the RNNDataDesc argument holds a valid address. Undefined behavior will occur in cases of passing an invalid pointer, not returned by the CreateRNNDataDescriptor function, or in the double deletion scenario of a valid address.

A nil error means the RNN data descriptor object was destroyed successfully.

If r is zero, Close returns nil. Otherwise Close sets r to zero when the call succeeds and leaves it unchanged when it fails. Only r is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyRNNDataDescriptor.

func (RNNDataDescriptor) Destroy deprecated

func (r RNNDataDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use RNNDataDescriptor.Close instead.

func (RNNDataDescriptor) Get

func (r RNNDataDescriptor) Get(arrayLengthRequested int, paddingFill unsafe.Pointer) (RNNDataConfig, error)

Get retrieves a previously created RNN data descriptor object.

  • arrayLengthRequested: Input. The number of elements that the user requested for seqLengthArray
  • paddingFill: Output. Pointer to the host memory location to store the user defined symbol. The symbol should be interpreted as the same data type as the RNN data tensor

A nil error means the parameters are fetched successfully.

Errors:

  • ErrBadParam: Any one of these have occurred: Any of RNNDataDesc, dataType, layout, maxSeqLength, batchSize, vectorSize, or paddingFill is NULL. seqLengthArray is NULL while arrayLengthRequested is greater than zero. arrayLengthRequested is less than zero.

Wraps cudnnGetRNNDataDescriptor.

func (RNNDataDescriptor) Set

func (r RNNDataDescriptor) Set(dataType DataType, layout RNNDataLayout, maxSeqLength int32, vectorSize int32, seqLengthArray []int32, paddingFill unsafe.Pointer) error

Set initializes a previously created RNN data descriptor object.

This data structure is intended to support the unpacked (padded) layout for input and output of extended RNN inference and training functions. A packed (unpadded) layout is also supported for backward compatibility.

  • dataType: Input. The datatype of the RNN data tensor. For more information, refer to DataType
  • layout: Input. The memory layout of the RNN data tensor
  • maxSeqLength: Input. The maximum sequence length within this RNN data tensor. In the unpacked (padded) layout, this should include the padding vectors in each sequence. In the packed (unpadded) layout, this should be equal to the greatest element in seqLengthArray
  • vectorSize: Input. The vector length (embedding size) of the input or output tensor at each time-step
  • seqLengthArray: Input. An integer array with batchSize number of elements. Describes the length (number of time-steps) of each sequence. Each element in seqLengthArray must be greater than or equal to 0 but less than or equal to maxSeqLength. In the packed layout, the elements should be sorted in descending order, similar to the layout required by the non-extended RNN compute functions
  • paddingFill: Input. A user-defined symbol for filling the padding position in RNN output. This is only effective when the descriptor is describing the RNN output, and the unpacked layout is specified. The symbol should be in the host memory, and is interpreted as the same data type as that of the RNN data tensor. If a NULL pointer is passed in, then the padding position in the output will be undefined

Errors:

Wraps cudnnSetRNNDataDescriptor.

type RNNDataLayout

type RNNDataLayout int32

RNNDataLayout is an enumerated type used to select the RNN data layout.

It is used in the API calls RNNDataDescriptor.Get and RNNDataDescriptor.Set.

const (
	RnnDataLayoutSeqMajorUnpacked   RNNDataLayout = 0 // Data layout is padded, with outer stride from one time-step to the next.
	RnnDataLayoutSeqMajorPacked     RNNDataLayout = 1 // The sequence length is sorted and packed as in the basic RNN API.
	RnnDataLayoutBatchMajorUnpacked RNNDataLayout = 2 // Data layout is padded, with outer stride from one batch to the next.
)

func (RNNDataLayout) String

func (e RNNDataLayout) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNDescriptor

type RNNDescriptor uintptr

RNNDescriptor is a pointer to an opaque structure holding the description of an RNN operation.

CreateRNNDescriptor is used to create one instance.

func CreateRNNDescriptor

func CreateRNNDescriptor() (RNNDescriptor, error)

CreateRNNDescriptor creates a generic RNN descriptor object by allocating the memory needed to hold its opaque structure.

Errors:

Wraps cudnnCreateRNNDescriptor.

func (RNNDescriptor) Clip

Clip retrieves the current LSTM cell clipping parameters, and stores them in the arguments provided.

The user can assign NULL to any pointer except rnnDesc when the retrieved value is not needed. The function does not check the validity of retrieved parameters.

A nil error means LSTM clipping parameters were successfully retrieved from the RNN descriptor.

Errors:

  • ErrBadParam: An invalid input argument was found ( rnnDesc was NULL).

Wraps cudnnRNNGetClip_v9.

func (*RNNDescriptor) Close

func (r *RNNDescriptor) Close() error

Close destroys a previously created RNN descriptor object.

Invoking RNNDescriptor.Close with the NULL argument is a no operation (NOP). The RNNDescriptor.Close function is not able to detect if the rnnDesc argument holds a valid address. Undefined behavior will occur in cases of passing an invalid pointer, not returned by the CreateRNNDescriptor function, or in the double deletion scenario of a valid address.

If r is zero, Close returns nil. Otherwise Close sets r to zero when the call succeeds and leaves it unchanged when it fails. Only r is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyRNNDescriptor.

func (RNNDescriptor) Destroy deprecated

func (r RNNDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use RNNDescriptor.Close instead.

func (RNNDescriptor) Get

func (r RNNDescriptor) Get() (RNNConfig, error)

Get retrieves RNN network parameters that were configured by RNNDescriptor.Set.

The user can assign NULL to any pointer except rnnDesc when the retrieved value is not needed. The function does not check the validity of retrieved parameters.

A nil error means RNN parameters were successfully retrieved from the RNN descriptor.

Errors:

Wraps cudnnGetRNNDescriptor_v8.

func (RNNDescriptor) Set

func (r RNNDescriptor) Set(algo RNNAlgo, cellMode RNNMode, biasMode RNNBiasMode, dirMode DirectionMode, inputMode RNNInputMode, dataType DataType, mathPrec DataType, mathType MathType, inputSize int32, hiddenSize int32, projSize int32, numLayers int32, dropoutDesc DropoutDescriptor, auxFlags uint32) error

Set initializes a previously created RNN descriptor object.

The RNN descriptor configured by RNNDescriptor.Set was enhanced to store all information needed to compute the total number of adjustable weights/biases in the RNN model.

  • algo: Input. RNN algo ( RnnAlgoStandard, RnnAlgoPersistStatic, or RnnAlgoPersistDynamic)
  • cellMode: Input. Specifies the RNN cell type in the entire model ( RnnRelu, RnnTanh, CUDNN_RNN_LSTM, CUDNN_RNN_GRU)
  • biasMode: Input. Sets the number of bias vectors ( RnnNoBias, RnnSingleInpBias, RnnSingleRecBias, RnnDoubleBias). The two single bias settings are functionally the same for RELU, TANH, and LSTM cell types. For differences in GRU cells, refer to the description of Gru in the RNNMode enumerated type
  • dirMode: Input. Specifies the recurrence pattern: Unidirectional or Bidirectional. In bidirectional RNNs, the hidden states passed between physical layers are concatenations of forward and backward hidden states
  • inputMode: Input. Specifies how the input to the RNN model is processed by the first layer. When inputMode is LinearInput, original input vectors of size inputSize are multiplied by the weight matrix to obtain vectors of hiddenSize. When inputMode is SkipInput, the original input vectors to the first layer are used as is without multiplying them by the weight matrix
  • dataType: Input. Specifies data type for RNN weights/biases and input and output data
  • mathPrec: Input. This parameter is used to control the compute math precision in the RNN model. The following applies: For the input/output in FP16, the parameter mathPrec can be DataHalf or DataFloat. For the input/output in FP32, the parameter mathPrec can only be DataFloat. For the input/output in FP64, double type, the parameter mathPrec can only be DataDouble
  • mathType: Input. Sets the preferred option to use NVIDIA Tensor Cores accelerators on Volta (SM 7.0) or higher GPUs. When dataType is DataHalf, the mathType parameter can be DefaultMath or TensorOpMath. The ALLOW_CONVERSION setting is treated the same as TensorOpMath for this data type. When dataType is DataFloat, the mathType parameter can be DefaultMath or TensorOpMathAllowConversion. When the latter settings are used, original weights and intermediate results will be down-converted to DataHalf before they are used in another recursive iteration. When dataType is DataDouble, the mathType parameter can be DefaultMath. This option has an advisory status meaning Tensor Cores may not be always utilized, for example, due to specific GEMM dimensions restrictions
  • inputSize: Input. Size of the input vector in the RNN model. When the inputMode=[SkipInput], the inputSize should match the hiddenSize value
  • hiddenSize: Input. Size of the hidden state vector in the RNN model. The same hidden size is used in all RNN layers
  • projSize: Input. The size of the LSTM cell output after the recurrent projection. When the LSTM projection is enabled, this value should be smaller than hiddenSize. When the LSTM projection is disabled, and for all other RNN cell types ( RnnRelu, RnnTanh, and CUDNN_RNN_GRU), projSize must be equal to hiddenSize. The recurrent projection is an additional matrix multiplication in the LSTM cell to project (compress) hidden state vectors h t into smaller vectors r t = W r h t, where W r is a rectangular matrix with projSize rows and hiddenSize columns. When the recurrent projection is enabled, the output of the LSTM cell (both to the next layer and unrolled in-time) is r t instead of h t. The recurrent projection can be enabled for LSTM cells and RnnAlgoStandard only
  • numLayers: Input. Number of stacked, physical layers in the deep RNN model. When dirMode= Bidirectional, the physical layer consists of two pseudo-layers corresponding to forward and backward directions
  • dropoutDesc: Input. Handle to a previously created and initialized dropout descriptor. Dropout operation will be applied between physical layers. A single layer network will have no dropout applied. Dropout is used in the training mode only
  • auxFlags: Input. This argument is used to pass miscellaneous switches that do not require additional numerical values to configure the corresponding feature. In future cuDNN releases, this parameter will be used to extend the RNN functionality without adding new API functions (applicable options should be bitwise OR-ed). Currently, this parameter is used to enable or disable padded input/output ( CUDNN_RNN_PADDED_IO_DISABLED, CUDNN_RNN_PADDED_IO_ENABLED). When the padded I/O is enabled, layouts RnnDataLayoutSeqMajorUnpacked and RnnDataLayoutBatchMajorUnpacked are permitted in RNN data descriptors

A nil error means the RNN descriptor was configured successfully.

Errors:

  • ErrBadParam: An invalid input argument was detected.
  • ErrNotSupported: An incompatible or unsupported combination of input arguments was detected.

Wraps cudnnSetRNNDescriptor_v8.

func (RNNDescriptor) SetClip

func (r RNNDescriptor) SetClip(clipMode RNNClipMode, lclip float64, rclip float64) error

SetClip sets the LSTM cell clipping mode.

The LSTM clipping is disabled by default. When enabled, clipping is applied to all layers. This cudnnRNNSetClip_v8() function does not affect the work, reserve, and weight-space buffer sizes and may be called multiple times.

  • clipMode: Input. Enables or disables the LSTM cell clipping. When clipMode is set to RnnClipNone no LSTM cell state clipping is performed. When clipMode is RnnClipMinmax the cell state activation to other units is clipped
  • lclip: Input. The range [lclip, rclip] to which the LSTM cell clipping should be set
  • rclip: Input. The range [lclip, rclip] to which the LSTM cell clipping should be set

Errors:

  • ErrBadParam: An invalid input argument was found, for example: rnnDesc was NULL lclip > rclip either lclip or rclip is NaN

Wraps cudnnRNNSetClip_v9.

type RNNInputMode

type RNNInputMode int32

RNNInputMode is an enumerated type used to specify the behavior of the first layer.

const (
	LinearInput RNNInputMode = 0 // A biased matrix multiplication is performed at the input of the first recurrent layer.
	SkipInput   RNNInputMode = 1 // No operation is performed at the input of the first recurrent layer. If [SkipInput] is used the leading dimension of the input tensor must be equal to the hidden state size of the network.
)

func (RNNInputMode) String

func (e RNNInputMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type RNNMode

type RNNMode int32

RNNMode is an enumerated type used to specify the type of network.

const (
	RnnRelu RNNMode = 0 // A single-gate recurrent neural network with a ReLU activation function. In the forward pass, the output h t for a given iteration can be computed from the recurrent input h t-1 and the previous layer input x t, given the matrices W, R, the bias vectors, and where ReLU(x) = max(x, 0). If [RNNBiasMode] biasMode in rnnDesc is [RnnDoubleBias] (default mode), then the following equation with biases b W and b R applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnSingleInpBias] or [RnnSingleRecBias], then the following equation with bias b applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnNoBias], then the following equation applies:
	RnnTanh RNNMode = 1 // A single-gate recurrent neural network with a tanh activation function. In the forward pass, the output h t for a given iteration can be computed from the recurrent input h t-1 and the previous layer input x t, given the matrices W, R the bias vectors, and where tanh is the hyperbolic tangent function. If [RNNBiasMode] biasMode in rnnDesc is [RnnDoubleBias] (default mode), then the following equation with biases b W and b R applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnSingleInpBias] or [RnnSingleRecBias], then the following equation with bias b applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnNoBias], then the following equation applies:
	Lstm    RNNMode = 2 // A four-gate LSTM (Long Short-Term Memory) network with no peephole connections. In the forward pass, the output h t and cell output c t for a given iteration can be computed from the recurrent input h t-1, the cell input c t-1 and the previous layer input x t, given the matrices W, R, and the bias vectors. In addition, the following applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnDoubleBias] (default mode), then the following equations with biases b W and b R apply: If [RNNBiasMode] biasMode in rnnDesc is [RnnSingleInpBias] or [RnnSingleRecBias], then the following equations with bias b apply: If [RNNBiasMode] biasMode in rnnDesc is [RnnNoBias], then the following equations apply:
	Gru     RNNMode = 3 // A three-gate network consisting of Gated Recurrent Units (GRU). In the forward pass, the output h t for a given iteration can be computed from the recurrent input h t-1 and the previous layer input x t given matrices W, R, and the bias vectors. In addition, the following applies: If [RNNBiasMode] biasMode in rnnDesc is [RnnDoubleBias] (default mode), then the following equations with biases b W and b R apply: If [RNNBiasMode] biasMode in rnnDesc is [RnnSingleInpBias], then the following equations with bias b apply: If [RNNBiasMode] biasMode in rnnDesc is [RnnSingleRecBias], then the following equations with bias b apply: If [RNNBiasMode] biasMode in rnnDesc is [RnnNoBias], then the following equations apply:
)

func (RNNMode) String

func (e RNNMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type ReduceTensorConfig

type ReduceTensorConfig struct {
	// Enumerant to specify the reduced tensor operation.
	ReduceTensorOp ReduceTensorOp
	// Enumerant to specify the computation datatype of the reduction.
	ReduceTensorCompType DataType
	// Input. Enumerant to specify the Nan propagation mode.
	ReduceTensorNanOpt NanPropagation
	// Enumerant to specify the reduced tensor indices.
	ReduceTensorIndices ReduceTensorIndices
	// Enumerant to specify the reduced tensor indices type.
	ReduceTensorIndicesType IndicesType
}

ReduceTensorConfig holds the settings ReduceTensorDescriptor.Get reports.

type ReduceTensorDescriptor deprecated

type ReduceTensorDescriptor uintptr

ReduceTensorDescriptor is a pointer to an opaque structure holding the description of a tensor reduction operation, used as a parameter to Handle.ReduceTensor. CreateReduceTensorDescriptor is used to create one instance, and ReduceTensorDescriptor.Set must be used to initialize this instance.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateReduceTensorDescriptor deprecated

func CreateReduceTensorDescriptor() (ReduceTensorDescriptor, error)

CreateReduceTensorDescriptor creates a reduced tensor descriptor object by allocating the memory needed to hold its opaque structure.

Errors:

Wraps cudnnCreateReduceTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (*ReduceTensorDescriptor) Close deprecated

func (r *ReduceTensorDescriptor) Close() error

Close destroys a previously created reduce tensor descriptor object.

When the input pointer is NULL, this function performs no destroy operation.

If r is zero, Close returns nil. Otherwise Close sets r to zero when the call succeeds and leaves it unchanged when it fails. Only r is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyReduceTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (ReduceTensorDescriptor) Destroy deprecated

func (r ReduceTensorDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use ReduceTensorDescriptor.Close instead.

func (ReduceTensorDescriptor) Get deprecated

Get queries a previously initialized reduce tensor descriptor object.

Errors:

Wraps cudnnGetReduceTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (ReduceTensorDescriptor) Set deprecated

func (r ReduceTensorDescriptor) Set(reduceTensorOp ReduceTensorOp, reduceTensorCompType DataType, reduceTensorNanOpt NanPropagation, reduceTensorIndices ReduceTensorIndices, reduceTensorIndicesType IndicesType) error

Set initializes a previously created reduce tensor descriptor object.

  • reduceTensorOp: Input. Enumerant to specify the reduced tensor operation
  • reduceTensorCompType: Input. Enumerant to specify the computation datatype of the reduction
  • reduceTensorNanOpt: Input. Enumerant to specify the Nan propagation mode
  • reduceTensorIndices: Input. Enumerant to specify the reduced tensor indices
  • reduceTensorIndicesType: Input. Enumerant to specify the reduced tensor indices type

Errors:

  • ErrBadParam: reduceTensorDesc is NULL ( reduceTensorOp, reduceTensorCompType, reduceTensorNanOpt, reduceTensorIndices or reduceTensorIndicesType has an invalid enumerant value).

Wraps cudnnSetReduceTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

type ReduceTensorIndices deprecated

type ReduceTensorIndices int32

ReduceTensorIndices is an enumerated type used to indicate whether indices are to be computed by the Handle.ReduceTensor routine. This enumerated type is used as a field for the ReduceTensorDescriptor descriptor.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	ReduceTensorNoIndices        ReduceTensorIndices = 0 // Do not compute indices.
	ReduceTensorFlattenedIndices ReduceTensorIndices = 1 // Compute indices. The resulting indices are relative, and flattened.
)

func (ReduceTensorIndices) String

func (e ReduceTensorIndices) String() string

String returns the constant name, or a numeric representation for unknown values.

type ReduceTensorOp deprecated

type ReduceTensorOp int32

ReduceTensorOp is an enumerated type used to indicate the Tensor Core operation to be used by the Handle.ReduceTensor routine. This enumerated type is used as a field for the ReduceTensorDescriptor descriptor.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	ReduceTensorAdd        ReduceTensorOp = 0 // The operation to be performed is addition.
	ReduceTensorMul        ReduceTensorOp = 1 // The operation to be performed is multiplication.
	ReduceTensorMin        ReduceTensorOp = 2 // The operation to be performed is a minimum comparison.
	ReduceTensorMax        ReduceTensorOp = 3 // The operation to be performed is a maximum comparison.
	ReduceTensorAmax       ReduceTensorOp = 4 // The operation to be performed is a maximum comparison of absolute values.
	ReduceTensorAvg        ReduceTensorOp = 5 // The operation to be performed is averaging.
	ReduceTensorNorm1      ReduceTensorOp = 6 // The operation to be performed is addition of absolute values.
	ReduceTensorNorm2      ReduceTensorOp = 7 // The operation to be performed is a square root of the sum of squares.
	ReduceTensorMulNoZeros ReduceTensorOp = 8 // The operation to be performed is multiplication, not including elements of value zero.
)

func (ReduceTensorOp) String

func (e ReduceTensorOp) String() string

String returns the constant name, or a numeric representation for unknown values.

type ReorderType deprecated

type ReorderType int32

ReorderType is an enumerated type to set the convolution reordering type.

The reordering type can be set by ConvolutionDescriptor.SetReorderType and its status can be read by ConvolutionDescriptor.ReorderType.

Deprecated: Deprecated by NVIDIA. This enumerated type is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this enumerated type.

const (
	DefaultReorder ReorderType = 0
	NoReorder      ReorderType = 1
)

func (ReorderType) String

func (e ReorderType) String() string

String returns the constant name, or a numeric representation for unknown values.

type ResampleMode

type ResampleMode int32

ResampleMode is an enumerated type to indicate the resample mode in the backend resample operations.

const (
	ResampleNearest               ResampleMode = 0
	ResampleBilinear              ResampleMode = 1
	ResampleAvgpool               ResampleMode = 2
	ResampleAvgpoolIncludePadding ResampleMode = 2
	ResampleAvgpoolExcludePadding ResampleMode = 4
	ResampleMaxpool               ResampleMode = 3
)

func (ResampleMode) String

func (e ResampleMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type Result

type Result int32

Result represents a cudnn API error code (cudnnStatus_t).

When the library is loaded, Result.Error returns rich messages from GetErrorString. When the library is not loaded, it falls back to the numeric error code and Go-defined name.

const (
	Success                                   Result = 0
	ErrNotInitialized                         Result = 1001
	ErrSublibraryVersionMismatch              Result = 1002
	ErrSerializationVersionMismatch           Result = 1003
	ErrDeprecated                             Result = 1004
	ErrLicenseError                           Result = 1005
	ErrRuntimeInProgress                      Result = 1006
	ErrRuntimeFpOverflow                      Result = 1007
	ErrSublibraryLoadingFailed                Result = 1008
	ErrBadParam                               Result = 2000
	ErrBadParamNullPointer                    Result = 2002
	ErrBadParamMisalignedPointer              Result = 2003
	ErrBadParamNotFinalized                   Result = 2004
	ErrBadParamOutOfBound                     Result = 2005
	ErrBadParamSizeInsufficient               Result = 2006
	ErrBadParamStreamMismatch                 Result = 2007
	ErrBadParamShapeMismatch                  Result = 2008
	ErrBadParamDuplicatedEntries              Result = 2009
	ErrBadParamAttributeType                  Result = 2010
	ErrBadParamCudaGraphMismatch              Result = 2011
	ErrBadParamDescriptorType                 Result = 2012
	ErrNotSupported                           Result = 3000
	ErrNotSupportedGraphPattern               Result = 3001
	ErrNotSupportedShape                      Result = 3002
	ErrNotSupportedDataType                   Result = 3003
	ErrNotSupportedLayout                     Result = 3004
	ErrNotSupportedIncompatibleCudaDriver     Result = 3005
	ErrNotSupportedIncompatibleCudart         Result = 3006
	ErrNotSupportedArchMismatch               Result = 3007
	ErrNotSupportedRuntimePrerequisiteMissing Result = 3008
	ErrNotSupportedSublibraryUnavailable      Result = 3009
	ErrNotSupportedSharedMemoryInsufficient   Result = 3010
	ErrNotSupportedPadding                    Result = 3011
	ErrNotSupportedBadLaunchParam             Result = 3012
	ErrNotSupportedCudaGraphNativeApi         Result = 3013
	ErrNotSupportedInvalidDynamicShape        Result = 3014
	ErrInternalError                          Result = 4000
	ErrInternalErrorCompilationFailed         Result = 4001
	ErrInternalErrorUnexpectedValue           Result = 4002
	ErrInternalErrorHostAllocationFailed      Result = 4003
	ErrInternalErrorDeviceAllocationFailed    Result = 4004
	ErrInternalErrorBadLaunchParam            Result = 4005
	ErrInternalErrorTextureCreationFailed     Result = 4006
	ErrExecutionFailed                        Result = 5000
	ErrExecutionFailedCudaDriver              Result = 5001
	ErrExecutionFailedCublas                  Result = 5002
	ErrExecutionFailedCudart                  Result = 5003
	ErrExecutionFailedCurand                  Result = 5004
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrAllocFailed Result = ErrInternalErrorHostAllocationFailed
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrInvalidValue Result = 2001
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrArchMismatch Result = ErrNotSupportedArchMismatch
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrMappingError Result = ErrInternalErrorTextureCreationFailed
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrRuntimePrerequisiteMissing Result = ErrNotSupportedRuntimePrerequisiteMissing
	//
	// Deprecated: Deprecated by NVIDIA.
	ErrVersionMismatch Result = ErrSublibraryVersionMismatch
)

cudnn error codes from cudnn.h.

func FullErrorCode

func FullErrorCode(category Result, specificError int32) Result

FullErrorCode combines a category and specific error code using signed 32-bit arithmetic. It adapts CUDNN_STATUS_FULL_ERROR_CODE for int32 operands whose sum is representable. Outside that range Go wraps modulo 2^32; signed C addition overflow is undefined and no C equivalence is claimed.

Example
fmt.Println(int32(FullErrorCode(2000, 1)))
Output:
2001

func (Result) Category

func (r Result) Category() Result

Category returns the thousands component of r using signed 32-bit arithmetic. It adapts CUDNN_STATUS_CATEGORY for an int32 operand. Division truncates toward zero, including for negative values; C callers using unsigned operands have different arithmetic semantics.

Example
fmt.Println(int32(Result(2001).Category()))
Output:
2000

func (Result) Code

func (r Result) Code() int32

Code returns the underlying result code for programmatic error handling.

func (Result) Error

func (r Result) Error() string

Error implements the error interface. When the library is loaded, it returns the error description from GetErrorString. Otherwise it returns a fallback string with the Go constant name and numeric code.

func (Result) SpecificError

func (r Result) SpecificError() int32

SpecificError returns the remainder after removing r's category, with the same sign as r. It adapts CUDNN_STATUS_SPECIFIC_ERROR for an int32 operand.

Example
fmt.Println(Result(2001).SpecificError())
Output:
1

func (Result) String

func (r Result) String() string

String returns the Go constant name of the result.

type RngDistribution

type RngDistribution int32

RngDistribution is an enumerated type to indicate the distribution to be used in the backend Rng (random number generator) operation.

const (
	RngDistributionBernoulli RngDistribution = 0 // The bernoulli distribution is used for the random number generation. The attribute [AttrRngBernoulliDistProbability] can be used to specify the probability of generating 1’s.
	RngDistributionUniform   RngDistribution = 1 // The uniform distribution is used for the random number generation. The attribute [AttrRngUniformDistMinimum] and [AttrRngUniformDistMaximum] can be used to specify the minimum and maximum value between which the random numbers should be uniformly generated.
	RngDistributionNormal    RngDistribution = 2 // The normal distribution is used for the random number generation. The attribute [AttrRngNormalDistMean] and [AttrRngNormalDistStandardDeviation] can be used to specify the mean and standard deviation of the random number generator.
)

func (RngDistribution) String

func (e RngDistribution) String() string

String returns the constant name, or a numeric representation for unknown values.

type RuntimeTag

type RuntimeTag uintptr

RuntimeTag is an opaque runtime tag (deprecated).

type SamplerType

type SamplerType int32

SamplerType is an enumerated type passed to SpatialTransformerDescriptor.Set to select the sampler type to be used by Handle.SpatialTfSamplerForward and Handle.SpatialTfSamplerBackward.

const (
	SamplerBilinear SamplerType = 0 // Selects the bilinear sampler.
)

func (SamplerType) String

func (e SamplerType) String() string

String returns the constant name, or a numeric representation for unknown values.

type SeqDataAxis

type SeqDataAxis int32

SeqDataAxis is an enumerated type that indexes active dimensions in the dimA[] argument that is passed to the SeqDataDescriptor.Set function to configure the sequence data descriptor of type SeqDataDescriptor. SeqDataAxis constants are also used in the axis[] argument of the SeqDataDescriptor.Set call to define the layout of the sequence data buffer in memory. Refer to SeqDataDescriptor.Set for a detailed description on how to use the SeqDataAxis enumerated type. The CUDNN_SEQDATA_DIM_COUNT macro defines the number of constants in the SeqDataAxis enumerated type. This value is currently set to 4.

const (
	SeqdataTimeDim  SeqDataAxis = 0 // Identifies the TIME (sequence length) dimension or specifies the TIME in the data layout.
	SeqdataBatchDim SeqDataAxis = 1 // Identifies the BATCH dimension or specifies the BATCH in the data layout.
	SeqdataBeamDim  SeqDataAxis = 2 // Identifies the BEAM dimension or specifies the BEAM in the data layout.
	SeqdataVectDim  SeqDataAxis = 3 // Identifies the VECT (vector) dimension or specifies the VECT in the data layout.
)

func (SeqDataAxis) String

func (e SeqDataAxis) String() string

String returns the constant name, or a numeric representation for unknown values.

type SeqDataDescriptor deprecated

type SeqDataDescriptor uintptr

SeqDataDescriptor is a pointer to an opaque structure holding parameters of the sequence data container or buffer.

The sequence data container is used to store fixed size vectors defined by the VECT dimension. Vectors are arranged in additional three dimensions: TIME, BATCH, and BEAM. The TIME dimension is used to bundle vectors into sequences of vectors. The actual sequences can be shorter than the TIME dimension, therefore, additional information is needed about each sequence length and how unused (padding) vectors should be saved. It is assumed that the sequence data container is fully packed. The TIME, BATCH, and BEAM dimensions can be in any order when vectors are traversed in the ascending order of addresses. Six data layouts (permutation of TIME, BATCH, and BEAM) are possible. The SeqDataDescriptor object holds the following parameters: Use the CreateSeqDataDescriptor function to create one instance of the sequence data descriptor object and SeqDataDescriptor.Close to delete a previously created descriptor. Use the SeqDataDescriptor.Set function to configure the descriptor. This descriptor is used by multihead attention API functions. These are the enumeration types in the cudnn_adv library.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateSeqDataDescriptor deprecated

func CreateSeqDataDescriptor() (SeqDataDescriptor, error)

CreateSeqDataDescriptor creates one instance of an opaque sequence data descriptor object by allocating the host memory for it and initializing all descriptor fields.

This function creates one instance of an opaque sequence data descriptor object by allocating the host memory for it and initializing all descriptor fields. The function writes NULL to seqDataDesc when the sequence data descriptor object cannot be allocated. Use the SeqDataDescriptor.Set function to configure the sequence data descriptor and SeqDataDescriptor.Close to destroy it and release the allocated memory.

A nil error means the descriptor object was created successfully.

Errors:

Wraps cudnnCreateSeqDataDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (*SeqDataDescriptor) Close deprecated

func (s *SeqDataDescriptor) Close() error

Close destroys the sequence data descriptor object and releases its memory.

This function destroys the sequence data descriptor object and releases its memory. The seqDataDesc argument can be NULL. Invoking SeqDataDescriptor.Close with a NULL argument is a no operation (NOP). The SeqDataDescriptor.Close function is not able to detect if the seqDataDesc argument holds a valid address. Undefined behavior will occur in case of passing an invalid pointer, not returned by the CreateSeqDataDescriptor function, or in the double deletion scenario of a valid address.

If s is zero, Close returns nil. Otherwise Close sets s to zero when the call succeeds and leaves it unchanged when it fails. Only s is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroySeqDataDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (SeqDataDescriptor) Destroy deprecated

func (s SeqDataDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use SeqDataDescriptor.Close instead.

func (SeqDataDescriptor) Get deprecated

func (s SeqDataDescriptor) Get(nbDimsRequested int, seqLengthSizeRequested int, paddingFill unsafe.Pointer) (DataType, []int32, []SeqDataAxis, []int32, error)

Get retrieves settings from a previously created sequence data descriptor.

This function retrieves settings from a previously created sequence data descriptor. The user can assign NULL to any pointer except seqDataDesc when the retrieved value is not needed. The nbDimsRequested argument applies to both dimA[] and axes[] arrays. A positive value of nbDimsRequested or seqLengthSizeRequested is ignored when the corresponding array, dimA[], axes[], or seqLengthArray[] is NULL. The SeqDataDescriptor.Get function does not report the actual strides in the sequence data buffer. Those strides can be handy in computing the offset to any sequence data element. The user must precompute strides based on the axes[] and dimA[] arrays reported by the SeqDataDescriptor.Get function. Below is sample code that performs this task: Now, the strA[] array can be used to compute the index to any sequence data element, for example: The above code assumes that all four indices ( batch, beam, time, vect) are less than the corresponding value in the dimA[] array. The sample code also omits the strA[SeqdataVectDim] stride because its value is always 1, meaning, elements of one vector occupy a contiguous block of memory.

  • nbDimsRequested: Input. The maximum number of consecutive elements that can be written to dimA[] and axes[] arrays starting from index zero. The recommended value for this argument is CUDNN_SEQDATA_DIM_COUNT
  • seqLengthSizeRequested: Input. The maximum number of consecutive elements that can be written to the seqLengthArray[] array starting from index zero
  • paddingFill: Output. Pointer to a storage location of dataType with the fill value that should be written to all padding vectors. Use NULL when an explicit initialization of output padding vectors was not requested

A nil error means requested sequence data descriptor fields were retrieved successfully.

Errors:

Wraps cudnnGetSeqDataDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (SeqDataDescriptor) Set deprecated

func (s SeqDataDescriptor) Set(dataType DataType, dimA []int32, axes []SeqDataAxis, seqLengthArray []int32, paddingFill unsafe.Pointer) error

Set initializes a previously created sequence data descriptor object.

This function initializes a previously created sequence data descriptor object. In the most simplified view, this descriptor defines dimensions ( dimA) and the data layout ( axes) of a four-dimensional tensor. All four dimensions of the sequence data descriptor have unique identifiers that can be used to index the dimA[] array: For example, to express information that vectors in our sequence data buffer are five elements long, we need to assign dimA[SeqdataVectDim]=5 in the dimA[] array. The number of active dimensions in the dimA[] and axes[] arrays is defined by the nbDims argument. Currently, the value of this argument should be four. The actual size of the dimA[] and axes[] arrays should be declared using the CUDNN_SEQDATA_DIM_COUNT macro. The SeqDataDescriptor container is treated as a collection of fixed length vectors that form sequences, similarly to words (vectors of characters) constructing sentences. The TIME dimension spans the sequence length. Different sequences are bundled together in a batch. A BATCH may be a group of individual sequences or beams. A BEAM is a cluster of alternative sequences or candidates. When thinking about the beam, consider a translation task from one language to another. You may want to keep around and experiment with several translated versions of the original sentence before selecting the best one. The number of candidates kept around is the BEAM size. Every sequence can have a different length, even within the same beam, so vectors toward the end of the sequence can be just padding. The paddingFill argument specifies how the padding vectors should be written in output sequence data buffers. The paddingFill argument points to one value of type dataType that should be copied to all elements in padding vectors. Currently, the only supported value for paddingFill is NULL which means this option should be ignored. In this case, elements of the padding vectors in output buffers will have undefined values. It is assumed that a non-empty sequence always starts from the time index zero. The seqLengthArray[] must specify all sequence lengths in the container so the total size of this array should be dimA[SeqdataBatchDim] * dimA[SeqdataBeamDim]. Each element of the seqLengthArray[] array should have a non-negative value, less than or equal to dimA[SeqdataTimeDim]; the maximum sequence length. Elements in seqLengthArray[] are always arranged in the same batch-major order, meaning, when considering BEAM and BATCH dimensions, BATCH is the outer or the slower changing index when we traverse the array in ascending order of the addresses. Using a simple example, the seqLengthArray[] array should hold sequence lengths in the following order: When dimA[SeqdataBatchDim]=3 and dimA[SeqdataBeamDim]=2. Data stored in the SeqDataDescriptor container must comply with the following constraints: The axes argument in the SeqDataDescriptor function is a bit more complicated. This array should have the same capacity as dimA[]. The axes[] array specifies the actual data layout in the GPU memory. In this function, the layout is described in the following way: as we move from one element of a vector to another in memory by incrementing the element pointer, what is the order of VECT, TIME, BATCH, and BEAM dimensions that we encounter. Let us assume that we want to define the following data layout: Data Layout Example for SeqDataDescriptor.Set That corresponds to tensor dimensions: Now, let’s initialize the axes[] array. Note that the most inner dimension is described by the last active element of axes[]. There is only one valid configuration here as we always traverse a full vector first. Thus, we need to write SeqdataVectDim in the last active element of axes[]. Now, let’s work on the remaining three elements of axes[]. When we reach the end of the first vector, we jump to the next BEAM, therefore: When we approach the end of the second vector, we move to the next batch, therefore: The last (outermost) dimension is TIME: The four values of the axes[] array fully describe the data layout depicted in the figure. The sequence data descriptor allows the user to select 3! = 6 different data layouts or permutations of BEAM, BATCH, and TIME dimensions. The multihead attention API supports all six layouts.

  • dataType: Input. Data type of the sequence data buffer ( DataHalf, DataFloat, or DataDouble)
  • dimA: Input. Integer array specifying sequence data dimensions. Use the SeqDataAxis enumerated type to index all active dimA[] elements
  • axes: Input. Array of SeqDataAxis that defines the layout of sequence data in memory. The first nbDims elements of axes[] should be initialized with the outermost dimension in axes[0] and the innermost dimension in axes[nbDims-1]
  • seqLengthArray: Input. An integer array that defines all sequence lengths of the container
  • paddingFill: Input. Must be NULL. Pointer to a value of dataType that is used to fill up output vectors beyond the valid length of each sequence or NULL to ignore this setting

A nil error means all input arguments were validated and the sequence data descriptor was successfully updated.

Errors:

  • ErrAllocFailed: Failed to allocate storage for the sequence data descriptor object.
  • ErrBadParam: An invalid input argument was found. Some examples include: seqDataDesc=NULL dateType was not a valid type of DataType nbDims was negative or zero seqLengthArraySize did not match the expected length some elements of seqLengthArray[] were invalid
  • ErrNotSupported: An unsupported input argument was encountered. Some examples include: nbDims is not equal to 4 paddingFill is not NULL

Wraps cudnnSetSeqDataDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

type Severity

type Severity int32

Severity is an enumerated type passed to the customized callback function for logging that users may set.

This enumerate describes the severity level of the item, so the customized logging call back may react differently. The numerical values are the same that are to be used for setting the CUDNN_LOGLEVEL_DBG environment variable.

const (
	SevFatal   Severity = 0
	SevError   Severity = 1
	SevWarning Severity = 2
	SevInfo    Severity = 3
)

func (Severity) String

func (e Severity) String() string

String returns the constant name, or a numeric representation for unknown values.

type SignalMode

type SignalMode int32

SignalMode is an enumerated type to indicate the signaling mode in the backend signal operation.

const (
	SignalSet  SignalMode = 0 // The flag variable is updated with the provided signal value atomically.
	SignalWait SignalMode = 1 // The operation blocks until the flag variable keeps comparing equal to the provided signal value.
)

func (SignalMode) String

func (e SignalMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type SoftmaxAlgorithm

type SoftmaxAlgorithm int32

SoftmaxAlgorithm is used to select an implementation of the softmax function used in Handle.SoftmaxForward and Handle.SoftmaxBackward.

const (
	SoftmaxFast     SoftmaxAlgorithm = 0 // This implementation applies the straightforward softmax operation.
	SoftmaxAccurate SoftmaxAlgorithm = 1 // This implementation scales each point of the softmax input domain by its maximum value to avoid potential floating point overflows in the softmax evaluation.
	SoftmaxLog      SoftmaxAlgorithm = 2 // This entry performs the log softmax operation, avoiding overflows by scaling each point in the input domain as in [SoftmaxAccurate].
)

func (SoftmaxAlgorithm) String

func (e SoftmaxAlgorithm) String() string

String returns the constant name, or a numeric representation for unknown values.

type SoftmaxMode

type SoftmaxMode int32

SoftmaxMode is used to select over which data the Handle.SoftmaxForward and Handle.SoftmaxBackward are computing their results.

const (
	SoftmaxModeInstance SoftmaxMode = 0
	SoftmaxModeChannel  SoftmaxMode = 1
)

func (SoftmaxMode) String

func (e SoftmaxMode) String() string

String returns the constant name, or a numeric representation for unknown values.

type SpatialTransformerDescriptor

type SpatialTransformerDescriptor uintptr

SpatialTransformerDescriptor is a pointer to an opaque structure holding the description of a spatial transformation operation. CreateSpatialTransformerDescriptor is used to create one instance, SpatialTransformerDescriptor.Set is used to initialize this instance, and SpatialTransformerDescriptor.Close is used to destroy this instance.

func CreateSpatialTransformerDescriptor

func CreateSpatialTransformerDescriptor() (SpatialTransformerDescriptor, error)

CreateSpatialTransformerDescriptor creates a generic spatial transformer descriptor object by allocating the memory needed to hold its opaque structure.

Errors:

Wraps cudnnCreateSpatialTransformerDescriptor.

func (*SpatialTransformerDescriptor) Close

Close destroys a previously created spatial transformer descriptor object.

If s is zero, Close returns nil. Otherwise Close sets s to zero when the call succeeds and leaves it unchanged when it fails. Only s is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroySpatialTransformerDescriptor.

func (SpatialTransformerDescriptor) Destroy deprecated

func (s SpatialTransformerDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use SpatialTransformerDescriptor.Close instead.

func (SpatialTransformerDescriptor) Set

func (s SpatialTransformerDescriptor) Set(samplerType SamplerType, dataType DataType, dimA []int32) error

Set initializes a previously created generic spatial transformer descriptor object.

  • samplerType: Input. Enumerant to specify the sampler type
  • dataType: Input. Data type
  • dimA: Input. Array of dimension nbDims containing the size of the transformed tensor for every dimension

Errors:

  • ErrBadParam: At least one of the following conditions are met: Either stDesc or dimA is NULL. Either dataType or samplerType has an invalid enumerant value.

Wraps cudnnSetSpatialTransformerNdDescriptor.

type SymbolError

type SymbolError struct {
	Symbol string
	Err    error
}

SymbolError reports that a symbol is not callable.

Err distinguishes the two ways that happens. A nil Err means the loaded library does not export the symbol, which is what an installation older than the symbol looks like. A non-nil Err means the library does export it and the binding itself failed; the library is not at fault.

func (*SymbolError) Error

func (e *SymbolError) Error() string

Error reports the uncallable library symbol and, when the symbol was present but could not be bound, why.

func (*SymbolError) Unwrap

func (e *SymbolError) Unwrap() error

Unwrap returns the reason the symbol could not be bound, or nil when the loaded library does not export it.

type Tensor4DConfig

type Tensor4DConfig struct {
	DataType DataType
	// Number of images.
	N int32
	// Number of feature maps per image.
	C int32
	// Height of each feature map.
	H int32
	// Width of each feature map.
	W int32
	// Stride between two consecutive images.
	NStride int32
	// Stride between two consecutive feature maps.
	CStride int32
	// Stride between two consecutive rows.
	HStride int32
	// Stride between two consecutive columns.
	WStride int32
}

Tensor4DConfig holds the settings TensorDescriptor.Get4D reports.

type TensorDescriptor

type TensorDescriptor uintptr

TensorDescriptor is a pointer to an opaque structure holding the description of a generic n-D dataset.

CreateTensorDescriptor is used to create one instance, and one of the routines TensorDescriptor.Set, TensorDescriptor.Set4D, or TensorDescriptor.Set4DEx must be used to initialize this instance.

func CreateTensorDescriptor

func CreateTensorDescriptor() (TensorDescriptor, error)

CreateTensorDescriptor creates a generic tensor descriptor object by allocating the memory needed to hold its opaque structure.

The data is initialized to all zeros.

Errors:

Wraps cudnnCreateTensorDescriptor.

func (*TensorDescriptor) Close

func (t *TensorDescriptor) Close() error

Close destroys a previously created tensor descriptor object.

When the input pointer is NULL, this function performs no destroy operation.

If t is zero, Close returns nil. Otherwise Close sets t to zero when the call succeeds and leaves it unchanged when it fails. Only t is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyTensorDescriptor.

func (TensorDescriptor) DeriveBN deprecated

func (t TensorDescriptor) DeriveBN(xDesc TensorDescriptor, mode BatchNormMode) error

DeriveBN derives a secondary tensor descriptor for the batch normalization scale, invVariance, bnBias, and bnScale subtensors from the layer’s x data descriptor.

Use the tensor descriptor produced by this function as the bnScaleBiasMeanVarDesc parameter for the Handle.BatchNormalizationForwardInference and Handle.BatchNormalizationForwardTraining functions, and as the bnScaleBiasDiffDesc parameter in the Handle.BatchNormalizationBackward function. The resulting dimensions will be: For HALF input data type the resulting tensor descriptor will have a FLOAT type. For other data types, it will have the same type as the input data.

  • xDesc: Input. Handle to a previously created and initialized layer’s x data descriptor
  • mode: Input. Batch normalization layer mode of operation

Errors:

Wraps cudnnDeriveBNTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (TensorDescriptor) DeriveNorm deprecated

func (t TensorDescriptor) DeriveNorm(derivedNormMeanVarDesc TensorDescriptor, xDesc TensorDescriptor, mode NormMode, groupCnt int32) error

DeriveNorm derives tensor descriptors for the normalization mean, invariance, normBias, and normScale subtensors from the layer’s x data descriptor and norm mode.

Normalization mean and invariance share the same descriptor while bias and scale share the same descriptor. Use the tensor descriptor produced by this function as the normScaleBiasDesc or normMeanVarDesc parameter for the Handle.NormalizationForwardInference and Handle.NormalizationForwardTraining functions, and as the dNormScaleBiasDesc and normMeanVarDesc parameters in the Handle.NormalizationBackward function. The resulting dimensions will be: For HALF input data type the resulting tensor descriptor will have a FLOAT type. For other data types, it will have the same type as the input data.

  • derivedNormMeanVarDesc: Output. Handle to a previously created tensor descriptor
  • xDesc: Input. Handle to a previously created and initialized layer’s x data descriptor
  • mode: Input. Batch normalization layer mode of operation

Errors:

Wraps cudnnDeriveNormTensorDescriptor.

Deprecated: Deprecated by NVIDIA.

func (TensorDescriptor) Destroy deprecated

func (t TensorDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use TensorDescriptor.Close instead.

func (TensorDescriptor) DropoutGetReserveSpaceSize

func (t TensorDescriptor) DropoutGetReserveSpaceSize() (int, error)

DropoutGetReserveSpaceSize is used to query the amount of reserve needed to run dropout with the input dimensions given by xDesc.

The same reserve space is expected to be passed to Handle.DropoutForward and Handle.DropoutBackward, and its contents is expected to remain unchanged between Handle.DropoutForward and Handle.DropoutBackward calls.

Wraps cudnnDropoutGetReserveSpaceSize.

func (TensorDescriptor) Get

func (t TensorDescriptor) Get(nbDimsRequested int) (DataType, []int32, []int32, error)

Get retrieves values stored in a previously initialized TensorNd descriptor object.

  • nbDimsRequested: Input. 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

A nil error means the results were returned successfully.

Errors:

  • ErrBadParam: Either tensorDesc or nbDims pointer is NULL.

Wraps cudnnGetTensorNdDescriptor.

func (TensorDescriptor) Get4D

func (t TensorDescriptor) Get4D() (Tensor4DConfig, error)

Get4D queries the parameters of the previously initialized Tensor4d descriptor object.

A nil error means the operation succeeded.

Wraps cudnnGetTensor4dDescriptor.

func (TensorDescriptor) Set

func (t TensorDescriptor) Set(dataType DataType, dimA []int32, strideA []int32) error

Set initializes a previously created generic tensor descriptor object.

The total size of a tensor including the potential padding between dimensions is limited to 2 Giga-elements of type datatype. Tensors are restricted to having at least 4 dimensions, and at most CUDNN_DIM_MAX dimensions (defined in cudnn.h). When working with lower dimensional data, it is recommended that the user create a 4D tensor, and set the size along unused dimensions to 1.

  • dataType: Input. Data type
  • dimA: Input. Array of dimension nbDims that contain the size of the tensor for every dimension. The size along unused dimensions should be set to 1. By convention, the ordering of dimensions in the array follows the format - [N, C, D, H, W], with W occupying the smallest index in the array
  • strideA: Input. Array of dimension nbDims that contain the stride of the tensor for every dimension. By convention, the ordering of the strides in the array follows the format - [Nstride, Cstride, Dstride, Hstride, Wstride], with Wstride occupying the smallest index in the array

Errors:

  • ErrBadParam: At least one of the elements of the array dimA was negative or zero, or dataType has an invalid enumerant value.
  • ErrNotSupported: The parameter nbDims is outside the range [4, CUDNN_DIM_MAX], or the total size of the tensor descriptor exceeds the maximum limit of 2 Giga-elements.

Wraps cudnnSetTensorNdDescriptor.

func (TensorDescriptor) Set4D

func (t TensorDescriptor) Set4D(format TensorFormat, dataType DataType, n int32, c int32, h int32, w int32) error

Set4D 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. The total size of a tensor including the potential padding between dimensions is limited to 2 Giga-elements of type datatype.

  • format: Input. Type of format
  • dataType: Input. Data type
  • n: Input. Number of images
  • c: Input. Number of feature maps per image
  • h: Input. Height of each feature map
  • w: Input. Width of each feature map

Errors:

  • ErrBadParam: At least one of the parameters n, c, h, w was negative or format has an invalid enumerant value or dataType has an invalid enumerant value.
  • ErrNotSupported: The total size of the tensor descriptor exceeds the maximum limit of 2 Giga-elements.

Wraps cudnnSetTensor4dDescriptor.

func (TensorDescriptor) Set4DEx

func (t TensorDescriptor) Set4DEx(dataType DataType, n int32, c int32, h int32, w int32, nStride int32, cStride int32, hStride int32, wStride int32) error

Set4DEx initializes a previously created generic tensor descriptor object into a 4D tensor, similarly to TensorDescriptor.Set4D 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. At present, some cuDNN routines have limited support for strides. Those routines will return ErrNotSupported if a 4D tensor object with an unsupported stride is used. Handle.TransformTensor can be used to convert the data to a supported layout. The total size of a tensor including the potential padding between dimensions is limited to 2 Giga-elements of type datatype.

  • dataType: Input. Data type
  • n: Input. Number of images
  • c: Input. Number of feature maps per image
  • h: Input. Height of each feature map
  • w: Input. Width of each feature map
  • nStride: Input. Stride between two consecutive images
  • cStride: Input. Stride between two consecutive feature maps
  • hStride: Input. Stride between two consecutive rows
  • wStride: Input. Stride between two consecutive columns

Errors:

  • ErrBadParam: At least one of the parameters n, c, h, w or nStride, cStride, hStride, wStride is negative or dataType has an invalid enumerant value.
  • ErrNotSupported: The total size of the tensor descriptor exceeds the maximum limit of 2 Giga-elements.

Wraps cudnnSetTensor4dDescriptorEx.

func (TensorDescriptor) SetEx

func (t TensorDescriptor) SetEx(format TensorFormat, dataType DataType, dimA []int32) error

SetEx initializes an Nd tensor descriptor.

  • format: Input. Tensor format
  • dataType: Input. Tensor data type
  • dimA: Input. Array containing the size of each dimension

Errors:

  • ErrBadParam: Tensor descriptor was not allocated properly; or input parameters are not set correctly.
  • ErrNotSupported: Dimension size requested is larger than maximum dimension size supported.

Wraps cudnnSetTensorNdDescriptorEx.

func (TensorDescriptor) Size

func (t TensorDescriptor) Size() (int, error)

Size 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.

A nil error means the results were returned successfully.

Wraps cudnnGetTensorSizeInBytes.

type TensorFormat

type TensorFormat int32

TensorFormat is an enumerated type used by TensorDescriptor.Set4D to create a tensor with a pre-defined layout.

For a detailed explanation of how these tensors are arranged in memory, refer to Data Layout Formats.

const (
	TensorNchw      TensorFormat = 0 // This tensor format specifies that the data is laid out in the following order: batch size, feature maps, rows, columns. The strides are implicitly defined in such a way that the data are contiguous in memory with no padding between images, feature maps, rows, and columns; the columns are the inner dimension and the images are the outermost dimension.
	TensorNhwc      TensorFormat = 1 // This tensor format specifies that the data is laid out in the following order: batch size, rows, columns, feature maps. The strides are implicitly defined in such a way that the data are contiguous in memory with no padding between images, rows, columns, and feature maps; the feature maps are the inner dimension and the images are the outermost dimension.
	TensorNchwVectC TensorFormat = 2 // This tensor format specifies that the data is laid out in the following order: batch size, feature maps, rows, columns. However, each element of the tensor is a vector of multiple feature maps. The length of the vector is carried by the data type of the tensor. The strides are implicitly defined in such a way that the data are contiguous in memory with no padding between images, feature maps, rows, and columns; the columns are the inner dimension and the images are the outermost dimension. This format is only supported with tensor data types CUDNN_DATA_INT8x4, CUDNN_DATA_INT8x32, and CUDNN_DATA_UINT8x4. The [TensorNchwVectC] can also be interpreted in the following way: The NCHW INT8x32 format is really N x (C/32) x H x W x 32 (32 Cs for every W), just as the NCHW INT8x4 format is N x (C/4) x H x W x 4 (4 Cs for every W). Hence, the VECT_C name - each W is a vector (4 or 32) of Cs.
)

func (TensorFormat) String

func (e TensorFormat) String() string

String returns the constant name, or a numeric representation for unknown values.

type TensorTransformConfig

type TensorTransformConfig struct {
	// The transform format that will be returned.
	DestFormat TensorFormat
	// An array filled with the amount of padding to add before each dimension. The dimension of this padBeforeA[] parameter is equal to nbDimsRequested.
	PadBeforeA []int32
	// An array filled with the amount of padding to add after each dimension. The dimension of this padBeforeA[] parameter is equal to nbDimsRequested.
	PadAfterA []int32
	// An array that was filled with the folding parameters for each spatial dimension. The dimension of this foldA[] array is nbDimsRequested-2.
	FoldA []uint32
	// The setting that selects folding or unfolding. For more information, refer to [FoldingDirection].
	Direction FoldingDirection
}

TensorTransformConfig holds the settings TensorTransformDescriptor.Get reports.

type TensorTransformDescriptor deprecated

type TensorTransformDescriptor uintptr

TensorTransformDescriptor is an opaque structure containing the description of the tensor transform.

Use the CreateTensorTransformDescriptor function to create an instance of this descriptor, and TensorTransformDescriptor.Close function to destroy a previously created instance. These are the enumeration types in the cudnn_ops library.

Deprecated: Deprecated by NVIDIA. This opaque handle is deprecated and is currently only used by deprecated APIs. Consider using replacements for the deprecated APIs that use this opaque handle.

func CreateTensorTransformDescriptor deprecated

func CreateTensorTransformDescriptor() (TensorTransformDescriptor, error)

CreateTensorTransformDescriptor creates a tensor transform descriptor object by allocating the memory needed to hold its opaque structure.

This function creates a tensor transform descriptor object by allocating the memory needed to hold its opaque structure. The tensor data is initialized to all zeros. Use the TensorTransformDescriptor.Set function to initialize the descriptor created by this function.

A nil error means the descriptor object was created successfully.

Errors:

Wraps cudnnCreateTensorTransformDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (*TensorTransformDescriptor) Close deprecated

func (t *TensorTransformDescriptor) Close() error

Close destroys a previously created tensor transform descriptor.

If t is zero, Close returns nil. Otherwise Close sets t to zero when the call succeeds and leaves it unchanged when it fails. Only t is zeroed: a copy of it still refers to the released object.

Wraps cudnnDestroyTensorTransformDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (TensorTransformDescriptor) Destroy deprecated

func (t TensorTransformDescriptor) Destroy() error

Destroy calls Close.

Deprecated: Use TensorTransformDescriptor.Close instead.

func (TensorTransformDescriptor) Get deprecated

func (t TensorTransformDescriptor) Get(nbDimsRequested int) (TensorTransformConfig, error)

Get returns the values stored in a previously initialized tensor transform descriptor.

This function returns the values stored in a previously initialized tensor transform descriptor.

  • nbDimsRequested: Input. The number of dimensions to consider. For more information, refer to Tensor Descriptor

A nil error means the results were obtained successfully.

Errors:

  • ErrBadParam: If transformDesc is NULL or if nbDimsRequested is less than 3 or greater than CUDNN_DIM_MAX.

Wraps cudnnGetTensorTransformDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

func (TensorTransformDescriptor) InitTransformDest deprecated

func (t TensorTransformDescriptor) InitTransformDest(srcDesc TensorDescriptor, destDesc TensorDescriptor) (int, error)

InitTransformDest initializes and returns a destination tensor descriptor destDesc for tensor transform operations.

This function initializes and returns a destination tensor descriptor destDesc for tensor transform operations. The initialization is done with the desired parameters described in the transform descriptor TensorDescriptor. The returned Tensor descriptor will be packed.

  • srcDesc: Input. Handle to a previously initialized tensor descriptor
  • destDesc: Output. Handle of the tensor descriptor that will be initialized and returned

A nil error means the tensor descriptor was initialized successfully.

Errors:

  • ErrBadParam: If either srcDesc or destDesc is NULL, or if the tensor descriptors nbDims is incorrect. For more information, refer to Tensor Descriptor..
  • ErrExecutionFailed: Function failed to launch on the GPU.
  • ErrNotSupported: If the provided configuration is not 4D.

Wraps cudnnInitTransformDest.

Deprecated: Deprecated in cuDNN 9.0.

func (TensorTransformDescriptor) Set deprecated

func (t TensorTransformDescriptor) Set(nbDims uint32, destFormat TensorFormat, padBeforeA *int32, padAfterA *int32, foldA *uint32, direction FoldingDirection) error

Set initializes a tensor transform descriptor that was previously created using the CreateTensorTransformDescriptor function.

This function initializes a tensor transform descriptor that was previously created using the CreateTensorTransformDescriptor function.

  • nbDims: Input. The dimensionality of the transform operands. Must be greater than 2. For more information, refer to Tensor Descriptor
  • destFormat: Input. The desired destination format
  • padBeforeA: Input. An array that contains the amount of padding that should be added before each dimension. Set to NULL for no padding
  • padAfterA: Input. An array that contains the amount of padding that should be added after each dimension. Set to NULL for no padding
  • foldA: Input. An array that contains the folding parameters for each spatial dimension (dimensions 2 and up). Set to NULL for no folding
  • direction: Input. Selects folding or unfolding. This input has no effect when folding parameters are all <= 1. For more information, refer to FoldingDirection

A nil error means the function was launched successfully.

Errors:

  • ErrBadParam: The parameter transformDesc is NULL, or if direction is invalid, or nbDims is <= 2.
  • ErrNotSupported: If the dimension size requested is larger than maximum dimension size supported (meaning, one of the nbDims is larger than CUDNN_DIM_MAX), or if destFromat is something other than NCHW or NHWC.

Wraps cudnnSetTensorTransformDescriptor.

Deprecated: Deprecated in cuDNN 9.0.

type WgradMode

type WgradMode int32

WgradMode is an enumerated type that selects how buffers holding gradients of the loss function, computed with respect to trainable parameters, are updated. Currently, this type is used by the Handle.MultiHeadAttnBackwardWeights and Handle.RNNBackwardWeights functions only.

const (
	WgradModeAdd WgradMode = 0 // A weight gradient component corresponding to a new batch of inputs is added to previously evaluated weight gradients. Before using this mode, the buffer holding weight gradients should be initialized to zero. Alternatively, the first API call outputting to an uninitialized buffer should use the [WgradModeSet] option.
	WgradModeSet WgradMode = 1 // A weight gradient component, corresponding to a new batch of inputs, overwrites previously stored weight gradients in the output buffer.
)

func (WgradMode) String

func (e WgradMode) String() string

String returns the constant name, or a numeric representation for unknown values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL