cudnn

package
Version: v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

README

  1. Please ensure you have cuDNN Developer Packages installed.
  2. usr/include/x86_64-linux-gnu/cudnn_v7.h to provide /usr/include/cudnn.h

Documentation

Index

Constants

View Source
const (
	Fwd ConvolutionType = 0
	//  combination of these indicate are used for bwd functions
	BwdFilter = 1 << 7
	BwdData   = 1<<7 | 1<<6
)
View Source
const (
	Success                    cudnnStatus = C.CUDNN_STATUS_SUCCESS
	NotInitialized             cudnnStatus = C.CUDNN_STATUS_NOT_INITIALIZED
	AllocFailed                cudnnStatus = C.CUDNN_STATUS_ALLOC_FAILED
	BadParam                   cudnnStatus = C.CUDNN_STATUS_BAD_PARAM
	InternalError              cudnnStatus = C.CUDNN_STATUS_INTERNAL_ERROR
	InvalidValue               cudnnStatus = C.CUDNN_STATUS_INVALID_VALUE
	ArchMismatch               cudnnStatus = C.CUDNN_STATUS_ARCH_MISMATCH
	MappingError               cudnnStatus = C.CUDNN_STATUS_MAPPING_ERROR
	ExecutionFailed            cudnnStatus = C.CUDNN_STATUS_EXECUTION_FAILED
	NotSupported               cudnnStatus = C.CUDNN_STATUS_NOT_SUPPORTED
	LicenseError               cudnnStatus = C.CUDNN_STATUS_LICENSE_ERROR
	RuntimePrerequisiteMissing cudnnStatus = C.CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING
	RuntimeInProgress          cudnnStatus = C.CUDNN_STATUS_RUNTIME_IN_PROGRESS
	RuntimeFpOverflow          cudnnStatus = C.CUDNN_STATUS_RUNTIME_FP_OVERFLOW
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activation

type Activation struct {
	// contains filtered or unexported fields
}

Activation is a representation of cudnnActivationDescriptor_t.

func NewActivation

func NewActivation(mode ActivationMode, reluNanOpt NanPropagation, coef float64) (retVal *Activation, err error)

NewActivation creates a new Activation.

func (*Activation) C added in v0.9.4

C returns the cgo representation.

func (*Activation) Coef

func (a *Activation) Coef() float64

Coef returns the internal coef.

func (*Activation) Mode

func (a *Activation) Mode() ActivationMode

Mode returns the internal mode.

func (*Activation) ReluNanOpt

func (a *Activation) ReluNanOpt() NanPropagation

ReluNanOpt returns the internal reluNanOpt.

type ActivationMode

type ActivationMode int

func (ActivationMode) C

C returns the C representation of ActivationMode

func (ActivationMode) String

func (e ActivationMode) String() string

type Algorithm added in v0.9.4

type Algorithm interface{}

type AlgorithmDescriptor added in v0.9.4

type AlgorithmDescriptor struct {
	// contains filtered or unexported fields
}

AlgorithmDescriptor is a representation of cudnnAlgorithmDescriptor_t.

func NewAlgorithmDescriptor added in v0.9.4

func NewAlgorithmDescriptor(algorithm Algorithm) (retVal *AlgorithmDescriptor, err error)

NewAlgorithmDescriptor creates a new AlgorithmDescriptor.

func (*AlgorithmDescriptor) C added in v0.9.4

C returns the internal cgo representation

type AlgorithmPerformance added in v0.9.4

type AlgorithmPerformance struct {
	// contains filtered or unexported fields
}

AlgorithmPerformance is a representation of cudnnAlgorithmPerformance_t.

func NewAlgorithmPerformance added in v0.9.4

func NewAlgorithmPerformance(algoDesc *AlgorithmDescriptor, n int, status Status, time float32, memory uintptr) (retVal *AlgorithmPerformance, err error)

NewAlgorithmPerformance creates `n` new cudnnAlgorithmPerformance objects, wrapped in AlgorithmPerformance.

func (*AlgorithmPerformance) AlgoDesc added in v0.9.4

AlgoDesc returns the internal algoDesc.

func (*AlgorithmPerformance) C added in v0.9.4

C returns the cgo representation.

func (*AlgorithmPerformance) Memory added in v0.9.4

func (a *AlgorithmPerformance) Memory() uintptr

Memory returns the internal memory.

func (*AlgorithmPerformance) N added in v0.9.4

func (a *AlgorithmPerformance) N() int

N returns how many algorithm performance objects were created in the graphics card.

func (*AlgorithmPerformance) Status added in v0.9.4

func (a *AlgorithmPerformance) Status() Status

Status returns the internal status.

func (*AlgorithmPerformance) Time added in v0.9.4

func (a *AlgorithmPerformance) Time() float32

Time returns the internal time.

type Attention added in v0.9.4

type Attention struct {
	// contains filtered or unexported fields
}

Attention is a representation of cudnnAttnDescriptor_t.

func NewAttention added in v0.9.4

func NewAttention(attnMode uint, nHeads int, smScaler float64, dataType DataType, computePrec DataType, mathType MathType, attnDropoutDesc *Dropout, postDropoutDesc *Dropout, qSize int, kSize int, vSize int, qProjSize int, kProjSize int, vProjSize int, oProjSize int, qoMaxSeqLength int, kvMaxSeqLength int, maxBatchSize int, maxBeamSize int) (retVal *Attention, err error)

NewAttention creates a new Attention.

func (*Attention) AttnDropoutDesc added in v0.9.4

func (a *Attention) AttnDropoutDesc() *Dropout

AttnDropoutDesc returns the internal attnDropoutDesc.

func (*Attention) AttnMode added in v0.9.4

func (a *Attention) AttnMode() uint

AttnMode returns the internal attnMode.

func (*Attention) C added in v0.9.4

C returns the internal cgo representation.

func (*Attention) ComputePrec added in v0.9.4

func (a *Attention) ComputePrec() DataType

ComputePrec returns the internal computePrec.

func (*Attention) DataType added in v0.9.4

func (a *Attention) DataType() DataType

DataType returns the internal dataType.

func (*Attention) KProjSize added in v0.9.4

func (a *Attention) KProjSize() int

KProjSize returns the internal kProjSize.

func (*Attention) KSize added in v0.9.4

func (a *Attention) KSize() int

KSize returns the internal kSize.

func (*Attention) KvMaxSeqLength added in v0.9.4

func (a *Attention) KvMaxSeqLength() int

KvMaxSeqLength returns the internal kvMaxSeqLength.

func (*Attention) MathType added in v0.9.4

func (a *Attention) MathType() MathType

MathType returns the internal mathType.

func (*Attention) MaxBatchSize added in v0.9.4

func (a *Attention) MaxBatchSize() int

MaxBatchSize returns the internal maxBatchSize.

func (*Attention) MaxBeamSize added in v0.9.4

func (a *Attention) MaxBeamSize() int

MaxBeamSize returns the internal maxBeamSize.

func (*Attention) NHeads added in v0.9.4

func (a *Attention) NHeads() int

NHeads returns the internal nHeads.

func (*Attention) OProjSize added in v0.9.4

func (a *Attention) OProjSize() int

OProjSize returns the internal oProjSize.

func (*Attention) PostDropoutDesc added in v0.9.4

func (a *Attention) PostDropoutDesc() *Dropout

PostDropoutDesc returns the internal postDropoutDesc.

func (*Attention) QProjSize added in v0.9.4

func (a *Attention) QProjSize() int

QProjSize returns the internal qProjSize.

func (*Attention) QSize added in v0.9.4

func (a *Attention) QSize() int

QSize returns the internal qSize.

func (*Attention) QoMaxSeqLength added in v0.9.4

func (a *Attention) QoMaxSeqLength() int

QoMaxSeqLength returns the internal qoMaxSeqLength.

func (*Attention) SmScaler added in v0.9.4

func (a *Attention) SmScaler() float64

SmScaler returns the internal smScaler.

func (*Attention) VProjSize added in v0.9.4

func (a *Attention) VProjSize() int

VProjSize returns the internal vProjSize.

func (*Attention) VSize added in v0.9.4

func (a *Attention) VSize() int

VSize returns the internal vSize.

type Backend added in v0.9.4

type Backend struct {
	// contains filtered or unexported fields
}

Backend is a representation of cudnnBackendDescriptor_t.

func NewBackend added in v0.9.4

func NewBackend(attributeName BackendAttributeName, attributeType BackendAttributeType, backendType BackendDescriptorType, elementCount int64, arrayOfElements Memory) (retVal *Backend, err error)

NewBackend creates a new Backend.

func (*Backend) ArrayOfElements added in v0.9.4

func (b *Backend) ArrayOfElements() Memory

ArrayOfElements returns the internal arrayOfElements.

func (*Backend) AttributeName added in v0.9.4

func (b *Backend) AttributeName() BackendAttributeName

AttributeName returns the internal attributeName.

func (*Backend) AttributeType added in v0.9.4

func (b *Backend) AttributeType() BackendAttributeType

AttributeType returns the internal attributeType.

func (*Backend) C added in v0.9.4

C() returns the internal cgo representation

func (*Backend) ElementCount added in v0.9.4

func (b *Backend) ElementCount() int64

ElementCount returns the internal elementCount parameter.

func (*Backend) Type added in v0.9.4

func (b *Backend) Type() BackendDescriptorType

Type returns the backend type.

type BackendAttributeName added in v0.9.4

type BackendAttributeName int
const (
	BEAttrNamePointwiseMode                         BackendAttributeName = C.CUDNN_ATTR_POINTWISE_MODE
	BEAttrNamePointwiseMathPrec                     BackendAttributeName = C.CUDNN_ATTR_POINTWISE_MATH_PREC
	BEAttrNamePointwiseNanPropagation               BackendAttributeName = C.CUDNN_ATTR_POINTWISE_NAN_PROPAGATION
	BEAttrNamePointwiseReluLowerClip                BackendAttributeName = C.CUDNN_ATTR_POINTWISE_RELU_LOWER_CLIP
	BEAttrNamePointwiseReluUpperClip                BackendAttributeName = C.CUDNN_ATTR_POINTWISE_RELU_UPPER_CLIP
	BEAttrNameConvolutionCompType                   BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_COMP_TYPE
	BEAttrNameConvolutionConvMode                   BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_CONV_MODE
	BEAttrNameConvolutionDilations                  BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_DILATIONS
	BEAttrNameConvolutionFilterStrides              BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_FILTER_STRIDES
	BEAttrNameConvolutionPostPaddings               BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_POST_PADDINGS
	BEAttrNameConvolutionPrePaddings                BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_PRE_PADDINGS
	BEAttrNameConvolutionSpatialDims                BackendAttributeName = C.CUDNN_ATTR_CONVOLUTION_SPATIAL_DIMS
	BEAttrNameEngineheurMode                        BackendAttributeName = C.CUDNN_ATTR_ENGINEHEUR_MODE
	BEAttrNameEngineheurOperationGraph              BackendAttributeName = C.CUDNN_ATTR_ENGINEHEUR_OPERATION_GRAPH
	BEAttrNameEngineheurResults                     BackendAttributeName = C.CUDNN_ATTR_ENGINEHEUR_RESULTS
	BEAttrNameEnginecfgEngine                       BackendAttributeName = C.CUDNN_ATTR_ENGINECFG_ENGINE
	BEAttrNameEnginecfgIntermediateInfo             BackendAttributeName = C.CUDNN_ATTR_ENGINECFG_INTERMEDIATE_INFO
	BEAttrNameEnginecfgKnobChoices                  BackendAttributeName = C.CUDNN_ATTR_ENGINECFG_KNOB_CHOICES
	BEAttrNameExecutionPlanHandle                   BackendAttributeName = C.CUDNN_ATTR_EXECUTION_PLAN_HANDLE
	BEAttrNameExecutionPlanEngineConfig             BackendAttributeName = C.CUDNN_ATTR_EXECUTION_PLAN_ENGINE_CONFIG
	BEAttrNameExecutionPlanWorkspaceSize            BackendAttributeName = C.CUDNN_ATTR_EXECUTION_PLAN_WORKSPACE_SIZE
	BEAttrNameExecutionPlanComputedIntermediateUids BackendAttributeName = C.CUDNN_ATTR_EXECUTION_PLAN_COMPUTED_INTERMEDIATE_UIDS
	BEAttrNameExecutionPlanRunOnlyIntermediateUids  BackendAttributeName = C.CUDNN_ATTR_EXECUTION_PLAN_RUN_ONLY_INTERMEDIATE_UIDS
	BEAttrNameIntermediateInfoUniqueId              BackendAttributeName = C.CUDNN_ATTR_INTERMEDIATE_INFO_UNIQUE_ID
	BEAttrNameIntermediateInfoSize                  BackendAttributeName = C.CUDNN_ATTR_INTERMEDIATE_INFO_SIZE
	BEAttrNameIntermediateInfoDependentDataUids     BackendAttributeName = C.CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_DATA_UIDS
	BEAttrNameIntermediateInfoDependentAttributes   BackendAttributeName = C.CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_ATTRIBUTES
	BEAttrNameKnobChoiceKnobType                    BackendAttributeName = C.CUDNN_ATTR_KNOB_CHOICE_KNOB_TYPE
	BEAttrNameKnobChoiceKnobValue                   BackendAttributeName = C.CUDNN_ATTR_KNOB_CHOICE_KNOB_VALUE
	BEAttrNameOperationConvolutionForwardAlpha      BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_ALPHA
	BEAttrNameOperationConvolutionForwardBeta       BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_BETA
	BEAttrNameOperationConvolutionForwardConvDesc   BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_CONV_DESC
	BEAttrNameOperationConvolutionForwardW          BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_W
	BEAttrNameOperationConvolutionForwardX          BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_X
	BEAttrNameOperationConvolutionForwardY          BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_FORWARD_Y
	BEAttrNameOperationConvolutionBwdDataAlpha      BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_ALPHA
	BEAttrNameOperationConvolutionBwdDataBeta       BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_BETA
	BEAttrNameOperationConvolutionBwdDataConvDesc   BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_CONV_DESC
	BEAttrNameOperationConvolutionBwdDataW          BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_W
	BEAttrNameOperationConvolutionBwdDataDx         BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DX
	BEAttrNameOperationConvolutionBwdDataDy         BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_DATA_DY
	BEAttrNameOperationConvolutionBwdFilterAlpha    BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_ALPHA
	BEAttrNameOperationConvolutionBwdFilterBeta     BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_BETA
	BEAttrNameOperationConvolutionBwdFilterConvDesc BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_CONV_DESC
	BEAttrNameOperationConvolutionBwdFilterDw       BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DW
	BEAttrNameOperationConvolutionBwdFilterX        BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_X
	BEAttrNameOperationConvolutionBwdFilterDy       BackendAttributeName = C.CUDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DY
	BEAttrNameOperationPointwisePwDescriptor        BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_PW_DESCRIPTOR
	BEAttrNameOperationPointwiseXdesc               BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_XDESC
	BEAttrNameOperationPointwiseBdesc               BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_BDESC
	BEAttrNameOperationPointwiseYdesc               BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_YDESC
	BEAttrNameOperationPointwiseAlpha1              BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_ALPHA1
	BEAttrNameOperationPointwiseAlpha2              BackendAttributeName = C.CUDNN_ATTR_OPERATION_POINTWISE_ALPHA2
	BEAttrNameOperationGenstatsMode                 BackendAttributeName = C.CUDNN_ATTR_OPERATION_GENSTATS_MODE
	BEAttrNameOperationGenstatsMathPrec             BackendAttributeName = C.CUDNN_ATTR_OPERATION_GENSTATS_MATH_PREC
	BEAttrNameOperationGenstatsXdesc                BackendAttributeName = C.CUDNN_ATTR_OPERATION_GENSTATS_XDESC
	BEAttrNameOperationGenstatsSumdesc              BackendAttributeName = C.CUDNN_ATTR_OPERATION_GENSTATS_SUMDESC
	BEAttrNameOperationGenstatsSqsumdesc            BackendAttributeName = C.CUDNN_ATTR_OPERATION_GENSTATS_SQSUMDESC
	BEAttrNameOperationgraphHandle                  BackendAttributeName = C.CUDNN_ATTR_OPERATIONGRAPH_HANDLE
	BEAttrNameOperationgraphOps                     BackendAttributeName = C.CUDNN_ATTR_OPERATIONGRAPH_OPS
	BEAttrNameOperationgraphEngineGlobalCount       BackendAttributeName = C.CUDNN_ATTR_OPERATIONGRAPH_ENGINE_GLOBAL_COUNT
	BEAttrNameTensorByteAlignment                   BackendAttributeName = C.CUDNN_ATTR_TENSOR_BYTE_ALIGNMENT
	BEAttrNameTensorDataType                        BackendAttributeName = C.CUDNN_ATTR_TENSOR_DATA_TYPE
	BEAttrNameTensorDimensions                      BackendAttributeName = C.CUDNN_ATTR_TENSOR_DIMENSIONS
	BEAttrNameTensorStrides                         BackendAttributeName = C.CUDNN_ATTR_TENSOR_STRIDES
	BEAttrNameTensorVectorCount                     BackendAttributeName = C.CUDNN_ATTR_TENSOR_VECTOR_COUNT
	BEAttrNameTensorVectorizedDimension             BackendAttributeName = C.CUDNN_ATTR_TENSOR_VECTORIZED_DIMENSION
	BEAttrNameTensorUniqueId                        BackendAttributeName = C.CUDNN_ATTR_TENSOR_UNIQUE_ID
	BEAttrNameTensorIsVirtual                       BackendAttributeName = C.CUDNN_ATTR_TENSOR_IS_VIRTUAL
	BEAttrNameVariantPackUniqueIds                  BackendAttributeName = C.CUDNN_ATTR_VARIANT_PACK_UNIQUE_IDS
	BEAttrNameVariantPackDataPointers               BackendAttributeName = C.CUDNN_ATTR_VARIANT_PACK_DATA_POINTERS
	BEAttrNameVariantPackIntermediates              BackendAttributeName = C.CUDNN_ATTR_VARIANT_PACK_INTERMEDIATES
	BEAttrNameVariantPackWorkspace                  BackendAttributeName = C.CUDNN_ATTR_VARIANT_PACK_WORKSPACE
	BEAttrNameLayoutInfoTensorUid                   BackendAttributeName = C.CUDNN_ATTR_LAYOUT_INFO_TENSOR_UID
	BEAttrNameLayoutInfoTypes                       BackendAttributeName = C.CUDNN_ATTR_LAYOUT_INFO_TYPES
	BEAttrNameKnobInfoType                          BackendAttributeName = C.CUDNN_ATTR_KNOB_INFO_TYPE
	BEAttrNameKnobInfoMaximumValue                  BackendAttributeName = C.CUDNN_ATTR_KNOB_INFO_MAXIMUM_VALUE
	BEAttrNameKnobInfoMinimumValue                  BackendAttributeName = C.CUDNN_ATTR_KNOB_INFO_MINIMUM_VALUE
	BEAttrNameKnobInfoStride                        BackendAttributeName = C.CUDNN_ATTR_KNOB_INFO_STRIDE
	BEAttrNameEngineOperationGraph                  BackendAttributeName = C.CUDNN_ATTR_ENGINE_OPERATION_GRAPH
	BEAttrNameEngineGlobalIndex                     BackendAttributeName = C.CUDNN_ATTR_ENGINE_GLOBAL_INDEX
	BEAttrNameEngineKnobInfo                        BackendAttributeName = C.CUDNN_ATTR_ENGINE_KNOB_INFO
	BEAttrNameEngineNumericalNote                   BackendAttributeName = C.CUDNN_ATTR_ENGINE_NUMERICAL_NOTE
	BEAttrNameEngineLayoutInfo                      BackendAttributeName = C.CUDNN_ATTR_ENGINE_LAYOUT_INFO
)

func (BackendAttributeName) C added in v0.9.4

C returns the C representation of BackendAttributeName

func (BackendAttributeName) String added in v0.9.4

func (e BackendAttributeName) String() string

type BackendAttributeType added in v0.9.4

type BackendAttributeType int

func (BackendAttributeType) C added in v0.9.4

C returns the C representation of BackendAttributeType

func (BackendAttributeType) String added in v0.9.4

func (e BackendAttributeType) String() string

type BackendDescriptorType added in v0.9.4

type BackendDescriptorType int
const (
	BEDescriptorPointwiseDescriptor                          BackendDescriptorType = C.CUDNN_BACKEND_POINTWISE_DESCRIPTOR
	BEDescriptorConvolutionDescriptor                        BackendDescriptorType = C.CUDNN_BACKEND_CONVOLUTION_DESCRIPTOR
	BEDescriptorEngineDescriptor                             BackendDescriptorType = C.CUDNN_BACKEND_ENGINE_DESCRIPTOR
	BEDescriptorEnginecfgDescriptor                          BackendDescriptorType = C.CUDNN_BACKEND_ENGINECFG_DESCRIPTOR
	BEDescriptorEngineheurDescriptor                         BackendDescriptorType = C.CUDNN_BACKEND_ENGINEHEUR_DESCRIPTOR
	BEDescriptorExecutionPlanDescriptor                      BackendDescriptorType = C.CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR
	BEDescriptorIntermediateInfoDescriptor                   BackendDescriptorType = C.CUDNN_BACKEND_INTERMEDIATE_INFO_DESCRIPTOR
	BEDescriptorKnobChoiceDescriptor                         BackendDescriptorType = C.CUDNN_BACKEND_KNOB_CHOICE_DESCRIPTOR
	BEDescriptorKnobInfoDescriptor                           BackendDescriptorType = C.CUDNN_BACKEND_KNOB_INFO_DESCRIPTOR
	BEDescriptorLayoutInfoDescriptor                         BackendDescriptorType = C.CUDNN_BACKEND_LAYOUT_INFO_DESCRIPTOR
	BEDescriptorOperationConvolutionForwardDescriptor        BackendDescriptorType = C.CUDNN_BACKEND_OPERATION_CONVOLUTION_FORWARD_DESCRIPTOR
	BEDescriptorOperationConvolutionBackwardFilterDescriptor BackendDescriptorType = C.CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_FILTER_DESCRIPTOR
	BEDescriptorOperationConvolutionBackwardDataDescriptor   BackendDescriptorType = C.CUDNN_BACKEND_OPERATION_CONVOLUTION_BACKWARD_DATA_DESCRIPTOR
	BEDescriptorOperationPointwiseDescriptor                 BackendDescriptorType = C.CUDNN_BACKEND_OPERATION_POINTWISE_DESCRIPTOR
	BEDescriptorOperationGenStatsDescriptor                  BackendDescriptorType = C.CUDNN_BACKEND_OPERATION_GEN_STATS_DESCRIPTOR
	BEDescriptorOperationgraphDescriptor                     BackendDescriptorType = C.CUDNN_BACKEND_OPERATIONGRAPH_DESCRIPTOR
	BEDescriptorVariantPackDescriptor                        BackendDescriptorType = C.CUDNN_BACKEND_VARIANT_PACK_DESCRIPTOR
	BEDescriptorTensorDescriptor                             BackendDescriptorType = C.CUDNN_BACKEND_TENSOR_DESCRIPTOR
)

func (BackendDescriptorType) C added in v0.9.4

C returns the C representation of BackendDescriptorType

func (BackendDescriptorType) String added in v0.9.4

func (e BackendDescriptorType) String() string

type BackendHeurMode added in v0.9.4

type BackendHeurMode int

func (BackendHeurMode) C added in v0.9.4

C returns the C representation of BackendHeurMode

func (BackendHeurMode) String added in v0.9.4

func (e BackendHeurMode) String() string

type BackendKnobType added in v0.9.4

type BackendKnobType int

func (BackendKnobType) C added in v0.9.4

C returns the C representation of BackendKnobType

func (BackendKnobType) String added in v0.9.4

func (e BackendKnobType) String() string

type BackendLayoutType added in v0.9.4

type BackendLayoutType int

func (BackendLayoutType) C added in v0.9.4

C returns the C representation of BackendLayoutType

func (BackendLayoutType) String added in v0.9.4

func (e BackendLayoutType) String() string

type BackendNumericalNote added in v0.9.4

type BackendNumericalNote int

func (BackendNumericalNote) C added in v0.9.4

C returns the C representation of BackendNumericalNote

func (BackendNumericalNote) String added in v0.9.4

func (e BackendNumericalNote) String() string

type BatchNormMode

type BatchNormMode int

func (BatchNormMode) C

C returns the C representation of BatchNormMode

func (BatchNormMode) String

func (e BatchNormMode) String() string

type BatchNormOps added in v0.9.4

type BatchNormOps int

func (BatchNormOps) C added in v0.9.4

C returns the C representation of BatchNormOps

func (BatchNormOps) String added in v0.9.4

func (e BatchNormOps) String() string

type CTCLoss

type CTCLoss struct {
	// contains filtered or unexported fields
}

CTCLoss is a representation of cudnnCTCLossDescriptor_t.

func NewCTCLoss

func NewCTCLoss(compType DataType) (retVal *CTCLoss, err error)

NewCTCLoss creates a new CTCLoss.

type CTCLossAlgo

type CTCLossAlgo int
const (
	DeterministicCTCLoss    CTCLossAlgo = C.CUDNN_CTC_LOSS_ALGO_DETERMINISTIC
	NonDeterministicCTCLoss CTCLossAlgo = C.CUDNN_CTC_LOSS_ALGO_NON_DETERMINISTIC
)

func (CTCLossAlgo) C

C returns the C representation of CTCLossAlgo

func (CTCLossAlgo) String

func (e CTCLossAlgo) String() string

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents the context in which cuDNN operations are performed in.

Internally, the Context holds a cudnnHandle_t

Once the context has been finished, do remember to call `Close` on the context.

func NewContext

func NewContext() (retVal *Context)

NewContext creates a new Context. This is the only function that will panic if it is unable to create the context.

func (*Context) ActivationBackward

func (co *Context) ActivationBackward(activationDesc *Activation, alpha float64, yDesc *TensorDescriptor, y Memory, dyDesc *TensorDescriptor, dy Memory, xDesc *TensorDescriptor, x Memory, beta float64, dxDesc *TensorDescriptor, dx Memory) error

Input. Handle to a previously created cuDNN context. For more information, see cudnnHandle_t.

func (*Context) ActivationForward

func (co *Context) ActivationForward(activationDesc *Activation, alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

Input. Handle to a previously created cuDNN context. For more information, see cudnnHandle_t.

func (*Context) AddTensor

func (co *Context) AddTensor(alpha float64, aDesc *TensorDescriptor, A Memory, beta float64, cDesc *TensorDescriptor, C_ Memory) error

AddTensor 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.

C_ is both an input and output

func (*Context) BatchNormalizationBackward

func (co *Context) BatchNormalizationBackward(mode BatchNormMode, alphaDataDiff float64, betaDataDiff float64, alphaParamDiff float64, betaParamDiff float64, xDesc *TensorDescriptor, x Memory, dyDesc *TensorDescriptor, dy Memory, dxDesc *TensorDescriptor, dx Memory, dBnScaleBiasDesc *TensorDescriptor, bnScale Memory, dBnScaleResult Memory, dBnBiasResult Memory, epsilon float64, savedMean Memory, savedInvVariance Memory) error

For more information, see cudnnDeriveBNTensorDescriptor() for the secondary tensor descriptor generation for the parameters used in this function.

func (*Context) BatchNormalizationForwardInference

func (co *Context) BatchNormalizationForwardInference(mode BatchNormMode, alpha float64, beta float64, xDesc *TensorDescriptor, x Memory, yDesc *TensorDescriptor, y Memory, bnScaleBiasMeanVarDesc *TensorDescriptor, bnScale Memory, bnBias Memory, estimatedMean Memory, estimatedVariance Memory, epsilon float64) error

Input. Handle to a previously created cuDNN library descriptor. For more information, see cudnnHandle_t.

func (*Context) BatchNormalizationForwardTraining

func (co *Context) BatchNormalizationForwardTraining(mode BatchNormMode, alpha float64, beta float64, xDesc *TensorDescriptor, x Memory, yDesc *TensorDescriptor, y Memory, bnScaleBiasMeanVarDesc *TensorDescriptor, bnScale Memory, bnBias Memory, exponentialAverageFactor float64, resultRunningMean Memory, resultRunningVariance Memory, epsilon float64, resultSaveMean Memory, resultSaveInvVariance Memory) error

Handle to a previously created cuDNN library descriptor. For more information, see cudnnHandle_t.

func (*Context) Close

func (ctx *Context) Close() error

Close destroys the underlying context.

func (*Context) ConvolutionBackwardBias

func (co *Context) ConvolutionBackwardBias(alpha float64, dyDesc *TensorDescriptor, dy Memory, beta float64, dbDesc *TensorDescriptor, db Memory) 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. Therefore, the number of elements produced is equal to the number of features maps of the input tensor.

func (*Context) ConvolutionBackwardData

func (co *Context) ConvolutionBackwardData(alpha float64, wDesc *Filter, w Memory, dyDesc *TensorDescriptor, dy Memory, convDesc *Convolution, algo ConvolutionBwdDataAlgo, workSpace Memory, workSpaceSizeInBytes uintptr, beta float64, dxDesc *TensorDescriptor, dx Memory) error

ConvolutionBackwardData computes the convolution data gradient of the tensor dy, where y is the output of the forward convolution in cudnnConvolutionForward(). 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.

dx is both an input and output

func (*Context) ConvolutionBackwardFilter

func (co *Context) ConvolutionBackwardFilter(alpha float64, xDesc *TensorDescriptor, x Memory, dyDesc *TensorDescriptor, dy Memory, convDesc *Convolution, algo ConvolutionBwdFilterAlgo, workSpace Memory, workSpaceSizeInBytes uintptr, beta float64, dwDesc *Filter, dw Memory) error

ConvolutionBackwardFilter computes the convolution weight (filter) gradient of the tensor dy, where y is the output of the forward convolution in cudnnConvolutionForward(). 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.

dw is both an input and output

func (*Context) ConvolutionBiasActivationForward

func (co *Context) ConvolutionBiasActivationForward(alpha1 float64, xDesc *TensorDescriptor, x Memory, wDesc *Filter, w Memory, convDesc *Convolution, algo ConvolutionFwdAlgo, workSpace Memory, workSpaceSizeInBytes uintptr, alpha2 float64, zDesc *TensorDescriptor, z Memory, biasDesc *TensorDescriptor, bias Memory, activationDesc *Activation, yDesc *TensorDescriptor, y Memory) error

Input. Handle to a previously created cuDNN context. For more information, see cudnnHandle_t.

y is both an input and output

func (*Context) ConvolutionForward

func (co *Context) ConvolutionForward(alpha float64, xDesc *TensorDescriptor, x Memory, wDesc *Filter, w Memory, convDesc *Convolution, algo ConvolutionFwdAlgo, workSpace Memory, workSpaceSizeInBytes uintptr, beta float64, yDesc *TensorDescriptor, y Memory) error

ConvolutionForward 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.

y is both an input and output

func (*Context) DivisiveNormalizationBackward

func (co *Context) DivisiveNormalizationBackward(normDesc *LRN, mode DivNormMode, alpha float64, xDesc *TensorDescriptor, x Memory, means Memory, dy Memory, temp Memory, temp2 Memory, beta float64, dXdMeansDesc *TensorDescriptor, dx Memory, dMeans Memory) error

DivisiveNormalizationBackward performs the backward DivisiveNormalization layer computation.

func (*Context) DivisiveNormalizationForward

func (co *Context) DivisiveNormalizationForward(normDesc *LRN, mode DivNormMode, alpha float64, xDesc *TensorDescriptor, x Memory, means Memory, temp Memory, temp2 Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

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.

func (*Context) DoOp

func (ctx *Context) DoOp(op *Op,
	alpha1 float64, aDesc *TensorDescriptor, aData Memory,
	alpha2 float64, bDesc *TensorDescriptor, bData Memory,
	beta float64, cDesc *TensorDescriptor, cData Memory) error

DoOp actually performs the operation.

func (*Context) DropoutBackward

func (co *Context) DropoutBackward(dropoutDesc *Dropout, dydesc *TensorDescriptor, dy Memory, dxdesc *TensorDescriptor, dx Memory, reserveSpace Memory, reserveSpaceSizeInBytes uintptr) 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.

func (*Context) DropoutForward

func (co *Context) DropoutForward(dropoutDesc *Dropout, xdesc *TensorDescriptor, x Memory, ydesc *TensorDescriptor, y Memory, reserveSpace Memory, reserveSpaceSizeInBytes uintptr) error

DropoutForward performs forward dropout operation over x returning results in y. If dropout was used as a parameter to cudnnSetDropoutDescriptor(), the approximately dropout fraction of x values will be replaced by a 0, and the rest will be scaled by 1/(1-dropout). DropoutForward should not be running concurrently with another DropoutForward() function using the same states.

func (*Context) DropoutGetStatesSize

func (co *Context) DropoutGetStatesSize() (sizeInBytes uintptr, err error)

DropoutGetStatesSize is used to query the amount of space required to store the states of the random number generators used by cudnnDropoutForward() function.

func (*Context) FindConvolutionBackwardDataAlgorithm added in v0.9.4

func (co *Context) FindConvolutionBackwardDataAlgorithm(wDesc *Filter, dyDesc *TensorDescriptor, convDesc *Convolution, dxDesc *TensorDescriptor, requestedAlgoCount int) (returnedAlgoCount int, perfResults *ConvolutionBwdDataPerf, err error)

FindConvolutionBackwardDataAlgorithm attempts all algorithms available for cudnnConvolutionBackwardData(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

func (*Context) FindConvolutionBackwardDataAlgorithmEx added in v0.9.4

func (co *Context) FindConvolutionBackwardDataAlgorithmEx(wDesc *Filter, w Memory, dyDesc *TensorDescriptor, dy Memory, convDesc *Convolution, dxDesc *TensorDescriptor, dx Memory, requestedAlgoCount int, workSpace Memory, workSpaceSizeInBytes uintptr) (returnedAlgoCount int, perfResults *ConvolutionBwdDataPerf, err error)

FindConvolutionBackwardDataAlgorithmEx attempts all algorithms available for cudnnConvolutionBackwardData(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

dxDesc is both an input and output

func (*Context) FindConvolutionBackwardFilterAlgorithm added in v0.9.4

func (co *Context) FindConvolutionBackwardFilterAlgorithm(xDesc *TensorDescriptor, dyDesc *TensorDescriptor, convDesc *Convolution, dwDesc *Filter, requestedAlgoCount int) (returnedAlgoCount int, perfResults *ConvolutionBwdPerf, err error)

FindConvolutionBackwardFilterAlgorithm attempts all algorithms available for cudnnConvolutionBackwardFilter(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

func (*Context) FindConvolutionBackwardFilterAlgorithmEx added in v0.9.4

func (co *Context) FindConvolutionBackwardFilterAlgorithmEx(xDesc *TensorDescriptor, x Memory, dyDesc *TensorDescriptor, y Memory, convDesc *Convolution, dwDesc *Filter, dw Memory, requestedAlgoCount int, workSpace Memory, workSpaceSizeInBytes uintptr) (returnedAlgoCount int, perfResults *ConvolutionBwdPerf, err error)

FindConvolutionBackwardFilterAlgorithmEx attempts all algorithms available for cudnnConvolutionBackwardFilter(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

dw is both an input and output

func (*Context) FindConvolutionForwardAlgorithm added in v0.9.4

func (co *Context) FindConvolutionForwardAlgorithm(xDesc *TensorDescriptor, wDesc *Filter, convDesc *Convolution, yDesc *TensorDescriptor, requestedAlgoCount int) (returnedAlgoCount int, perfResults *ConvolutionFwdPerf, err error)

FindConvolutionForwardAlgorithm attempts all algorithms available for cudnnConvolutionForward(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

func (*Context) FindConvolutionForwardAlgorithmEx added in v0.9.4

func (co *Context) FindConvolutionForwardAlgorithmEx(xDesc *TensorDescriptor, x Memory, wDesc *Filter, w Memory, convDesc *Convolution, yDesc *TensorDescriptor, y Memory, requestedAlgoCount int, workSpace Memory, workSpaceSizeInBytes uintptr) (returnedAlgoCount int, perfResults *ConvolutionFwdPerf, err error)

FindConvolutionForwardAlgorithmEx attempts all algorithms available for cudnnConvolutionForward(). It will attempt both the provided convDescmathType and CUDNN_DEFAULT_MATH (assuming the two differ).

y is both an input and output

func (*Context) GetReductionIndicesSize

func (co *Context) GetReductionIndicesSize(reduceTensorDesc *Reduction, aDesc *TensorDescriptor, cDesc *TensorDescriptor) (sizeInBytes uintptr, err error)

GetReductionIndicesSize 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.

func (*Context) GetReductionWorkspaceSize

func (co *Context) GetReductionWorkspaceSize(reduceTensorDesc *Reduction, aDesc *TensorDescriptor, cDesc *TensorDescriptor) (sizeInBytes uintptr, err error)

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

func (*Context) Im2Col

func (co *Context) Im2Col(xDesc *TensorDescriptor, x Memory, wDesc *Filter, convDesc *Convolution, colBuffer Memory) error

Input. Handle to a previously created cuDNN context.

func (*Context) LRNCrossChannelBackward

func (co *Context) LRNCrossChannelBackward(normDesc *LRN, lrnMode LRNMode, alpha float64, yDesc *TensorDescriptor, y Memory, dyDesc *TensorDescriptor, dy Memory, xDesc *TensorDescriptor, x Memory, beta float64, dx Memory) (dxDesc *TensorDescriptor, err error)

LRNCrossChannelBackward performs the backward LRN layer computation.

func (*Context) LRNCrossChannelForward

func (co *Context) LRNCrossChannelForward(normDesc *LRN, lrnMode LRNMode, alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

LRNCrossChannelForward performs the forward LRN layer computation.

func (*Context) OpTensor

func (co *Context) OpTensor(opTensorDesc *Op, alpha1 float64, aDesc *TensorDescriptor, A Memory, alpha2 float64, bDesc *TensorDescriptor, B Memory, beta float64, cDesc *TensorDescriptor, C_ Memory) error

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. The op to use is indicated by the descriptor OpTensorDescriptor_t, meaning, the type of opTensorDesc. Currently-supported ops are listed by the OpTensorOp_t enum.

C_ is both an input and output

func (*Context) PoolingBackward

func (co *Context) PoolingBackward(poolingDesc *Pooling, alpha float64, yDesc *TensorDescriptor, y Memory, dyDesc *TensorDescriptor, dy Memory, xDesc *TensorDescriptor, x Memory, beta float64, dxDesc *TensorDescriptor, dx Memory) error

PoolingBackward computes the gradient of a pooling operation.

func (*Context) PoolingForward

func (co *Context) PoolingForward(poolingDesc *Pooling, alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, yDesc *TensorDescriptor, y Memory) 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.

func (*Context) ReduceTensor

func (co *Context) ReduceTensor(reduceTensorDesc *Reduction, indices Memory, indicesSizeInBytes uintptr, workspace Memory, workspaceSizeInBytes uintptr, alpha float64, aDesc *TensorDescriptor, A Memory, beta float64, cDesc *TensorDescriptor, C_ Memory) 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. The reduction op to use is indicated by the descriptor reduceTensorDesc. Currently-supported ops are listed by the ReduceTensorOp_t enum.

C_ is both an input and output

func (*Context) ScaleTensor

func (co *Context) ScaleTensor(yDesc *TensorDescriptor, y Memory, alpha float64) error

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

y is both an input and output

func (*Context) SoftmaxBackward

func (co *Context) SoftmaxBackward(algo SoftmaxAlgorithm, mode SoftmaxMode, alpha float64, yDesc *TensorDescriptor, y Memory, dyDesc *TensorDescriptor, dy Memory, beta float64, dxDesc *TensorDescriptor, dx Memory) error

SoftmaxBackward computes the gradient of the softmax function.

func (*Context) SoftmaxForward

func (co *Context) SoftmaxForward(algo SoftmaxAlgorithm, mode SoftmaxMode, alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

SoftmaxForward computes the softmax function.

func (*Context) SpatialTfGridGeneratorBackward

func (co *Context) SpatialTfGridGeneratorBackward(stDesc *SpatialTransformer, dgrid Memory, dtheta Memory) error

SpatialTfGridGeneratorBackward computes the gradient of a grid generation operation.

func (*Context) SpatialTfGridGeneratorForward

func (co *Context) SpatialTfGridGeneratorForward(stDesc *SpatialTransformer, theta Memory, grid Memory) error

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

func (*Context) SpatialTfSamplerBackward

func (co *Context) SpatialTfSamplerBackward(stDesc *SpatialTransformer, alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, dxDesc *TensorDescriptor, dx Memory, alphaDgrid Memory, dyDesc *TensorDescriptor, dy Memory, grid Memory, betaDgrid Memory, dgrid Memory) error

SpatialTfSamplerBackward computes the gradient of a sampling operation.

func (*Context) SpatialTfSamplerForward

func (co *Context) SpatialTfSamplerForward(stDesc *SpatialTransformer, alpha float64, xDesc *TensorDescriptor, x Memory, grid Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

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

func (*Context) TransformTensor

func (co *Context) TransformTensor(alpha float64, xDesc *TensorDescriptor, x Memory, beta float64, yDesc *TensorDescriptor, y Memory) error

TransformTensor 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). TransformTensor can be used to convert a tensor with an unsupported format to a supported one.

type Convolution

type Convolution struct {
	// contains filtered or unexported fields
}

Convolution is a struct describing the convolution operations. Internally it holds a cudnnConvolutionDescriptor_t, which will be passed around when making cgo calls.

func NewConvolution

func NewConvolution(mathType MathType, groupCount int, padding, filterStride, dilation []int, convolutionMode ConvolutionMode, datatype DataType) (retVal *Convolution, err error)

func (*Convolution) CalcForwardOutputShape

func (c *Convolution) CalcForwardOutputShape(input *TensorDescriptor, filter *Filter, dims int) (retVal []int, err error)

func (*Convolution) Dilation

func (c *Convolution) Dilation() []int

func (*Convolution) FilterStride

func (c *Convolution) FilterStride() []int

func (*Convolution) ForwardOutputShape

func (c *Convolution) ForwardOutputShape(input *TensorDescriptor, filter *Filter, dims int) (retVal []int, err error)

func (*Convolution) GroupCount

func (c *Convolution) GroupCount() int

func (*Convolution) MathType

func (c *Convolution) MathType() MathType

func (*Convolution) Padding

func (c *Convolution) Padding() []int

type ConvolutionBwdDataPerf

type ConvolutionBwdDataPerf struct {
	Algo ConvolutionBwdDataAlgo
	Err  error

	Time        float64
	Memory      uintptr // size
	Determinism Determinism
	MathType    MathType
	// contains filtered or unexported fields
}

type ConvolutionBwdPerf

type ConvolutionBwdPerf struct {
	Err error

	Algo        ConvolutionBwdFilterAlgo
	Time        float64
	Memory      uintptr // size
	Determinism Determinism
	MathType    MathType
	// contains filtered or unexported fields
}

type ConvolutionFwdAlgo

type ConvolutionFwdAlgo int

func (ConvolutionFwdAlgo) C

type ConvolutionFwdPerf

type ConvolutionFwdPerf struct {
	Algo        ConvolutionFwdAlgo
	Time        float64
	Memory      uintptr // size
	Determinism Determinism
	MathType    MathType
	Err         error
	// contains filtered or unexported fields
}

TODO

type ConvolutionMode

type ConvolutionMode int
const (
	StandardConvolution ConvolutionMode = C.CUDNN_CONVOLUTION
	CrossCorrelation    ConvolutionMode = C.CUDNN_CROSS_CORRELATION
)

func (ConvolutionMode) C

C returns the C representation of ConvolutionMode

type ConvolutionPreference

type ConvolutionPreference byte

ConvolutionPreference represents the preference for the algorithm to work with.

Coincidentally ALL the preferences share the same three enum numbers, so we roll them into one Go type.

const (
	NoWorkspace ConvolutionPreference = iota
	PreferFastest
	SpecifyWorkspaceLimit
)

func MakeConvolutionPreference

func MakeConvolutionPreference(t ConvolutionType, pref ConvolutionPreference) ConvolutionPreference

MakeConvolutionPreference allows the creation of a tagged preference - whether it's fwd, bwd or data or filter

func (ConvolutionPreference) C

func (c ConvolutionPreference) C() C.int

C returns the C representation. Note this is only OK to do because all the ConvolutionPreferences share the ssame enum ints.

This may break

func (ConvolutionPreference) IsBwd

func (c ConvolutionPreference) IsBwd() bool

func (ConvolutionPreference) IsData

func (c ConvolutionPreference) IsData() bool

func (ConvolutionPreference) IsFilter

func (c ConvolutionPreference) IsFilter() bool

func (ConvolutionPreference) IsFwd

func (c ConvolutionPreference) IsFwd() bool

func (ConvolutionPreference) Pref

type ConvolutionType

type ConvolutionType byte

type DataType

type DataType int

func (DataType) C

func (e DataType) C() C.cudnnDataType_t

C returns the C representation of DataType

func (DataType) String

func (e DataType) String() string

type Determinism

type Determinism int
const (
	NonDeterministic Determinism = C.CUDNN_NON_DETERMINISTIC
	Deterministic    Determinism = C.CUDNN_DETERMINISTIC
)

func (Determinism) C

C returns the C representation of Determinism

func (Determinism) String

func (e Determinism) String() string

type DirectionMode

type DirectionMode int
const (
	Unidirectional DirectionMode = C.CUDNN_UNIDIRECTIONAL
	Bidirectional  DirectionMode = C.CUDNN_BIDIRECTIONAL
)

func (DirectionMode) C

C returns the C representation of DirectionMode

func (DirectionMode) String

func (e DirectionMode) String() string

type DivNormMode

type DivNormMode int
const (
	PrecomputedMeans DivNormMode = C.CUDNN_DIVNORM_PRECOMPUTED_MEANS
)

func (DivNormMode) C

C returns the C representation of DivNormMode

func (DivNormMode) String

func (e DivNormMode) String() string

type Dropout

type Dropout struct {
	// contains filtered or unexported fields
}

Dropout is a representation of cudnnDropoutDescriptor_t.

The usecase of Dropout is quite different from the rest of the APIs in this library. There is a two stage API:

drop := NewDropout(...)
drop.Use(ctx, states....)

This is because the Dropout is largely tied to run-time. An additional `.IsReady` method is added to indicate if the dropout state is ready to be used

However, if your runtime is known ahead of time, the `NewDropoutWithContext` creation function can be used.

func NewDropout

func NewDropout(dropout float64) (retVal *Dropout, err error)

NewDropout creates a Dropout descriptor. It is not usable by default because some additional stateful information needs to be passed in

func NewDropoutWithContext

func NewDropoutWithContext(dropout float64, handle *Context, states Memory, stateSizeInBytes uintptr, seed uint64) (retVal *Dropout, err error)

NewDropout creates a new Dropout with the given context (handle, states, etc)

func (*Dropout) Dropout

func (dr *Dropout) Dropout() float32

Dropout returns the internal dropout ratio.

func (*Dropout) Handle

func (dr *Dropout) Handle() *Context

Handle returns the internal handle.

func (*Dropout) IsReady

func (dr *Dropout) IsReady() bool

IsReady indicates if the dropout operator is ready to be used

func (*Dropout) RequiredStateSize

func (dr *Dropout) RequiredStateSize(ctx *Context) (uintptr, error)

func (*Dropout) Reset

func (dr *Dropout) Reset()

Reset resets the state to be not ready. It does NOT reset the dropout ratio.

func (*Dropout) RestoreDropoutDescriptor

func (dr *Dropout) RestoreDropoutDescriptor(handle *Context, dropout float32, states Memory, stateSizeInBytes uintptr, seed uint64) error

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

func (*Dropout) Seed

func (dr *Dropout) Seed() uint64

Seed returns the internal seed.

func (*Dropout) StateSizeInBytes

func (dr *Dropout) StateSizeInBytes() uintptr

StateSizeInBytes returns the internal stateSizeInBytes.

func (*Dropout) States

func (dr *Dropout) States() Memory

func (*Dropout) Use

func (dr *Dropout) Use(ctx *Context, states Memory, stateSizeInBytes uintptr, seed uint64) error

Use is the second stage of the two-stage API.

type ErrQueryMode

type ErrQueryMode int

func (ErrQueryMode) C

C returns the C representation of ErrQueryMode

func (ErrQueryMode) String

func (e ErrQueryMode) String() string

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter is a representation of cudnnFilterDescriptor_t.

func NewFilter

func NewFilter(dataType DataType, format TensorFormat, shape []int) (retVal *Filter, err error)

NewFilter creates a new Filter.

func (*Filter) DataType

func (f *Filter) DataType() DataType

DataType returns the data type of the filter

func (*Filter) Format

func (f *Filter) Format() TensorFormat

Filter returns the TensorFormat of the filter

func (*Filter) Shape

func (f *Filter) Shape() []int

Shape returns a copy of the shape.

type FoldingDirection added in v0.9.4

type FoldingDirection int

func (FoldingDirection) C added in v0.9.4

C returns the C representation of FoldingDirection

func (FoldingDirection) String added in v0.9.4

func (e FoldingDirection) String() string

type ForwardMode added in v0.9.4

type ForwardMode int

func (ForwardMode) C added in v0.9.4

C returns the C representation of ForwardMode

func (ForwardMode) String added in v0.9.4

func (e ForwardMode) String() string

type FusedOpConsts added in v0.9.4

type FusedOpConsts struct {
	// contains filtered or unexported fields
}

FusedOpConsts is a representation of cudnnFusedOpsConstParamPack_t.

func NewFusedOpConsts added in v0.9.4

func NewFusedOpConsts(ops FusedOps, paramLabel FusedOpsConstParamLabel, param Memory) (retVal *FusedOpConsts, err error)

NewFusedOpConsts creates a new FusedOpConsts.

func (*FusedOpConsts) C added in v0.9.4

C returns the internal cgo representation.

func (*FusedOpConsts) Ops added in v0.9.4

func (f *FusedOpConsts) Ops() FusedOps

Ops returns the ops that were fused.

func (*FusedOpConsts) Param added in v0.9.4

func (f *FusedOpConsts) Param() Memory

Param returns the internal param.

func (*FusedOpConsts) ParamLabel added in v0.9.4

func (f *FusedOpConsts) ParamLabel() FusedOpsConstParamLabel

ParamLabel returns the internal paramLabel.

type FusedOpVariantParams added in v0.9.4

type FusedOpVariantParams struct {
	// contains filtered or unexported fields
}

FusedOpVariantParams is a representation of cudnnFusedOpsVariantParamPack_t.

func NewFusedOpVariantParams added in v0.9.4

func NewFusedOpVariantParams(ops FusedOps, paramLabel FusedOpsVariantParamLabel, ptr Memory) (retVal *FusedOpVariantParams, err error)

NewFusedOpVariantParams creates a new FusedOpVariantParams.

func (*FusedOpVariantParams) C added in v0.9.4

C returns the internal cgo representation.

func (*FusedOpVariantParams) Ops added in v0.9.4

func (f *FusedOpVariantParams) Ops() FusedOps

Ops returns the ops that are fused.

func (*FusedOpVariantParams) ParamLabel added in v0.9.4

ParamLabel returns the internal paramLabel.

func (*FusedOpVariantParams) Ptr added in v0.9.4

func (f *FusedOpVariantParams) Ptr() Memory

Ptr returns the internal ptr.

type FusedOps added in v0.9.4

type FusedOps int
const (
	ScaleBiasActivationConvBnstats   FusedOps = C.CUDNN_FUSED_SCALE_BIAS_ACTIVATION_CONV_BNSTATS
	ScaleBiasActivationWgrad         FusedOps = C.CUDNN_FUSED_SCALE_BIAS_ACTIVATION_WGRAD
	BnFinalizeStatisticsTraining     FusedOps = C.CUDNN_FUSED_BN_FINALIZE_STATISTICS_TRAINING
	BnFinalizeStatisticsInference    FusedOps = C.CUDNN_FUSED_BN_FINALIZE_STATISTICS_INFERENCE
	ConvScaleBiasAddActivation       FusedOps = C.CUDNN_FUSED_CONV_SCALE_BIAS_ADD_ACTIVATION
	ScaleBiasAddActivationGenBitmask FusedOps = C.CUDNN_FUSED_SCALE_BIAS_ADD_ACTIVATION_GEN_BITMASK
	DactivationForkDbatchnorm        FusedOps = C.CUDNN_FUSED_DACTIVATION_FORK_DBATCHNORM
)

func (FusedOps) C added in v0.9.4

func (e FusedOps) C() C.cudnnFusedOps_t

C returns the C representation of FusedOps

func (FusedOps) String added in v0.9.4

func (e FusedOps) String() string

type FusedOpsConstParamLabel added in v0.9.4

type FusedOpsConstParamLabel int
const (
	Xdesc                        FusedOpsConstParamLabel = C.CUDNN_PARAM_XDESC
	XdataPlaceholder             FusedOpsConstParamLabel = C.CUDNN_PARAM_XDATA_PLACEHOLDER
	BnMode                       FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_MODE
	BnEqscalebiasDesc            FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_EQSCALEBIAS_DESC
	BnEqscalePlaceholder         FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_EQSCALE_PLACEHOLDER
	BnEqbiasPlaceholder          FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_EQBIAS_PLACEHOLDER
	ActivationDesc               FusedOpsConstParamLabel = C.CUDNN_PARAM_ACTIVATION_DESC
	ConvDesc                     FusedOpsConstParamLabel = C.CUDNN_PARAM_CONV_DESC
	Wdesc                        FusedOpsConstParamLabel = C.CUDNN_PARAM_WDESC
	WdataPlaceholder             FusedOpsConstParamLabel = C.CUDNN_PARAM_WDATA_PLACEHOLDER
	Dwdesc                       FusedOpsConstParamLabel = C.CUDNN_PARAM_DWDESC
	DwdataPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_DWDATA_PLACEHOLDER
	Ydesc                        FusedOpsConstParamLabel = C.CUDNN_PARAM_YDESC
	YdataPlaceholder             FusedOpsConstParamLabel = C.CUDNN_PARAM_YDATA_PLACEHOLDER
	Dydesc                       FusedOpsConstParamLabel = C.CUDNN_PARAM_DYDESC
	DydataPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_DYDATA_PLACEHOLDER
	YstatsDesc                   FusedOpsConstParamLabel = C.CUDNN_PARAM_YSTATS_DESC
	YsumPlaceholder              FusedOpsConstParamLabel = C.CUDNN_PARAM_YSUM_PLACEHOLDER
	YsqsumPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_YSQSUM_PLACEHOLDER
	BnScalebiasMeanvarDesc       FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_SCALEBIAS_MEANVAR_DESC
	BnScalePlaceholder           FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_SCALE_PLACEHOLDER
	BnBiasPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_BIAS_PLACEHOLDER
	BnSavedMeanPlaceholder       FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_SAVED_MEAN_PLACEHOLDER
	BnSavedInvstdPlaceholder     FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_SAVED_INVSTD_PLACEHOLDER
	BnRunningMeanPlaceholder     FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_RUNNING_MEAN_PLACEHOLDER
	BnRunningVarPlaceholder      FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_RUNNING_VAR_PLACEHOLDER
	Zdesc                        FusedOpsConstParamLabel = C.CUDNN_PARAM_ZDESC
	ZdataPlaceholder             FusedOpsConstParamLabel = C.CUDNN_PARAM_ZDATA_PLACEHOLDER
	BnZEqscalebiasDesc           FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_Z_EQSCALEBIAS_DESC
	BnZEqscalePlaceholder        FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_Z_EQSCALE_PLACEHOLDER
	BnZEqbiasPlaceholder         FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_Z_EQBIAS_PLACEHOLDER
	ActivationBitmaskDesc        FusedOpsConstParamLabel = C.CUDNN_PARAM_ACTIVATION_BITMASK_DESC
	ActivationBitmaskPlaceholder FusedOpsConstParamLabel = C.CUDNN_PARAM_ACTIVATION_BITMASK_PLACEHOLDER
	Dxdesc                       FusedOpsConstParamLabel = C.CUDNN_PARAM_DXDESC
	DxdataPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_DXDATA_PLACEHOLDER
	Dzdesc                       FusedOpsConstParamLabel = C.CUDNN_PARAM_DZDESC
	DzdataPlaceholder            FusedOpsConstParamLabel = C.CUDNN_PARAM_DZDATA_PLACEHOLDER
	BnDscalePlaceholder          FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_DSCALE_PLACEHOLDER
	BnDbiasPlaceholder           FusedOpsConstParamLabel = C.CUDNN_PARAM_BN_DBIAS_PLACEHOLDER
)

func (FusedOpsConstParamLabel) C added in v0.9.4

C returns the C representation of FusedOpsConstParamLabel

func (FusedOpsConstParamLabel) String added in v0.9.4

func (e FusedOpsConstParamLabel) String() string

type FusedOpsPointerPlaceHolder added in v0.9.4

type FusedOpsPointerPlaceHolder int

func (FusedOpsPointerPlaceHolder) C added in v0.9.4

C returns the C representation of FusedOpsPointerPlaceHolder

func (FusedOpsPointerPlaceHolder) String added in v0.9.4

type FusedOpsVariantParamLabel added in v0.9.4

type FusedOpsVariantParamLabel int
const (
	PtrXdata                        FusedOpsVariantParamLabel = C.CUDNN_PTR_XDATA
	PtrBnEqscale                    FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_EQSCALE
	PtrBnEqbias                     FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_EQBIAS
	PtrWdata                        FusedOpsVariantParamLabel = C.CUDNN_PTR_WDATA
	PtrDwdata                       FusedOpsVariantParamLabel = C.CUDNN_PTR_DWDATA
	PtrYdata                        FusedOpsVariantParamLabel = C.CUDNN_PTR_YDATA
	PtrDydata                       FusedOpsVariantParamLabel = C.CUDNN_PTR_DYDATA
	PtrYsum                         FusedOpsVariantParamLabel = C.CUDNN_PTR_YSUM
	PtrYsqsum                       FusedOpsVariantParamLabel = C.CUDNN_PTR_YSQSUM
	PtrWorkspace                    FusedOpsVariantParamLabel = C.CUDNN_PTR_WORKSPACE
	PtrBnScale                      FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_SCALE
	PtrBnBias                       FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_BIAS
	PtrBnSavedMean                  FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_SAVED_MEAN
	PtrBnSavedInvstd                FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_SAVED_INVSTD
	PtrBnRunningMean                FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_RUNNING_MEAN
	PtrBnRunningVar                 FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_RUNNING_VAR
	PtrZdata                        FusedOpsVariantParamLabel = C.CUDNN_PTR_ZDATA
	PtrBnZEqscale                   FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_Z_EQSCALE
	PtrBnZEqbias                    FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_Z_EQBIAS
	PtrActivationBitmask            FusedOpsVariantParamLabel = C.CUDNN_PTR_ACTIVATION_BITMASK
	PtrDxdata                       FusedOpsVariantParamLabel = C.CUDNN_PTR_DXDATA
	PtrDzdata                       FusedOpsVariantParamLabel = C.CUDNN_PTR_DZDATA
	PtrBnDscale                     FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_DSCALE
	PtrBnDbias                      FusedOpsVariantParamLabel = C.CUDNN_PTR_BN_DBIAS
	ScalarSizeTWorkspaceSizeInBytes FusedOpsVariantParamLabel = C.CUDNN_SCALAR_SIZE_T_WORKSPACE_SIZE_IN_BYTES
	ScalarInt64TBnAccumulationCount FusedOpsVariantParamLabel = C.CUDNN_SCALAR_INT64_T_BN_ACCUMULATION_COUNT
	ScalarDoubleBnExpAvgFactor      FusedOpsVariantParamLabel = C.CUDNN_SCALAR_DOUBLE_BN_EXP_AVG_FACTOR
	ScalarDoubleBnEpsilon           FusedOpsVariantParamLabel = C.CUDNN_SCALAR_DOUBLE_BN_EPSILON
)

func (FusedOpsVariantParamLabel) C added in v0.9.4

C returns the C representation of FusedOpsVariantParamLabel

func (FusedOpsVariantParamLabel) String added in v0.9.4

func (e FusedOpsVariantParamLabel) String() string

type GenStatsMode added in v0.9.4

type GenStatsMode int

func (GenStatsMode) C added in v0.9.4

C returns the C representation of GenStatsMode

func (GenStatsMode) String added in v0.9.4

func (e GenStatsMode) String() string

type IndicesType

type IndicesType int

func (IndicesType) C

C returns the C representation of IndicesType

func (IndicesType) String

func (e IndicesType) String() string

type LRN

type LRN struct {
	// contains filtered or unexported fields
}

LRN is a representation of cudnnLRNDescriptor_t.

func NewLRN

func NewLRN(lrnN uint, lrnAlpha float64, lrnBeta float64, lrnK float64) (retVal *LRN, err error)

NewLRN creates a new LRN.

func (*LRN) C added in v0.9.4

func (l *LRN) C() C.cudnnLRNDescriptor_t

C returns the internal cgo representation

func (*LRN) LrnAlpha

func (l *LRN) LrnAlpha() float64

LrnAlpha returns the internal lrnAlpha.

func (*LRN) LrnBeta

func (l *LRN) LrnBeta() float64

LrnBeta returns the internal lrnBeta.

func (*LRN) LrnK

func (l *LRN) LrnK() float64

LrnK returns the internal lrnK.

func (*LRN) LrnN

func (l *LRN) LrnN() uint

LrnN returns the internal lrnN.

type LRNMode

type LRNMode int
const (
	CrossChannelDim1 LRNMode = C.CUDNN_LRN_CROSS_CHANNEL_DIM1
)

func (LRNMode) C

func (e LRNMode) C() C.cudnnLRNMode_t

C returns the C representation of LRNMode

func (LRNMode) String

func (e LRNMode) String() string

type LossNormalizationMode added in v0.9.4

type LossNormalizationMode int

func (LossNormalizationMode) C added in v0.9.4

C returns the C representation of LossNormalizationMode

func (LossNormalizationMode) String added in v0.9.4

func (e LossNormalizationMode) String() string

type MathType

type MathType int
const (
	DefaultMath                 MathType = C.CUDNN_DEFAULT_MATH
	TensorOpMath                MathType = C.CUDNN_TENSOR_OP_MATH
	TensorOpMathAllowConversion MathType = C.CUDNN_TENSOR_OP_MATH_ALLOW_CONVERSION
	FmaMath                     MathType = C.CUDNN_FMA_MATH
)

func (MathType) C

func (e MathType) C() C.cudnnMathType_t

C returns the C representation of MathType

func (MathType) String

func (e MathType) String() string

type Memory

type Memory interface {
	Uintptr() uintptr

	IsNativelyAccessible() bool
}

Memory represents an instance of CUDA memory

type MultiHeadAttnWeightKind added in v0.9.4

type MultiHeadAttnWeightKind int

func (MultiHeadAttnWeightKind) C added in v0.9.4

C returns the C representation of MultiHeadAttnWeightKind

func (MultiHeadAttnWeightKind) String added in v0.9.4

func (e MultiHeadAttnWeightKind) String() string

type NanPropagation

type NanPropagation int
const (
	NotPropagateNan NanPropagation = C.CUDNN_NOT_PROPAGATE_NAN
	PropagateNan    NanPropagation = C.CUDNN_PROPAGATE_NAN
)

func (NanPropagation) C

C returns the C representation of NanPropagation

func (NanPropagation) String

func (e NanPropagation) String() string

type NormAlgo added in v0.9.4

type NormAlgo int
const (
	StandardNorm NormAlgo = C.CUDNN_NORM_ALGO_STANDARD
	PersistNorm  NormAlgo = C.CUDNN_NORM_ALGO_PERSIST
)

func (NormAlgo) C added in v0.9.4

func (e NormAlgo) C() C.cudnnNormAlgo_t

C returns the C representation of NormAlgo

func (NormAlgo) String added in v0.9.4

func (e NormAlgo) String() string

type NormMode added in v0.9.4

type NormMode int
const (
	NormPerActivation NormMode = C.CUDNN_NORM_PER_ACTIVATION
	NormPerChannel    NormMode = C.CUDNN_NORM_PER_CHANNEL
)

func (NormMode) C added in v0.9.4

func (e NormMode) C() C.cudnnNormMode_t

C returns the C representation of NormMode

func (NormMode) String added in v0.9.4

func (e NormMode) String() string

type NormOps added in v0.9.4

type NormOps int

func (NormOps) C added in v0.9.4

func (e NormOps) C() C.cudnnNormOps_t

C returns the C representation of NormOps

func (NormOps) String added in v0.9.4

func (e NormOps) String() string

type Op

type Op struct {
	// contains filtered or unexported fields
}

Op is a tuple describing the operation that needs to be done

func NewOp

func NewOp(op OpTensorOp, dt DataType, prop NanPropagation) (*Op, error)

NewOp creates a new Op with the provided settings

func (*Op) DataType

func (op *Op) DataType() DataType

DataType returns the data type that the operation is supposed to work on.

func (*Op) NaNPropagation

func (op *Op) NaNPropagation() NanPropagation

NaNPropagation returns the NaN propagation strategy.

func (*Op) Op

func (op *Op) Op() OpTensorOp

Op returns the operation that needs to be done.

type OpTensorOp

type OpTensorOp int

func (OpTensorOp) C

C returns the C representation of OpTensorOp

func (OpTensorOp) String

func (e OpTensorOp) String() string

type PointwiseMode added in v0.9.4

type PointwiseMode int

func (PointwiseMode) C added in v0.9.4

C returns the C representation of PointwiseMode

func (PointwiseMode) String added in v0.9.4

func (e PointwiseMode) String() string

type Pooling

type Pooling struct {
	// contains filtered or unexported fields
}

Pooling is a representation of cudnnPoolingDescriptor_t.

func NewPooling

func NewPooling(mode PoolingMode, maxpoolingNanOpt NanPropagation, shape, strides, padding []int) (retVal *Pooling, err error)

NewPooling creates a new Pooling op.

func (*Pooling) CalcOutputShape

func (p *Pooling) CalcOutputShape(input *TensorDescriptor, dims int) (retVal []int, err error)

CalcOutputShape is like OutputShape, but doesn't go through a check for the cached value.

func (*Pooling) Mode

func (p *Pooling) Mode() PoolingMode

Mode returns the Pooling Mode of the pooling operation.

func (*Pooling) NaNPropagation

func (p *Pooling) NaNPropagation() NanPropagation

NaNPropagation returns the NaN propagation strategy when the pooling type is a max pooling.

func (*Pooling) OutputShape

func (p *Pooling) OutputShape(input *TensorDescriptor, dims int) (retVal []int, err error)

OutputShape computes the output shape given the input tensor.

This method caches the outputShape. If a inputTensor is seen before, and the dims is exactly the same, then the cached output shape is used

func (*Pooling) Padding

func (p *Pooling) Padding() []int

Padding returns a copy of the input padding shape

func (*Pooling) Shape

func (p *Pooling) Shape() []int

Shape returns a copy of the input window shape.

func (*Pooling) Strides

func (p *Pooling) Strides() []int

Strides returns a copy of the input strides

type PoolingMode

type PoolingMode int

func (PoolingMode) C

C returns the C representation of PoolingMode

func (PoolingMode) String

func (e PoolingMode) String() string

type RNN

type RNN struct {
	// contains filtered or unexported fields
}

RNN is a representation of cudnnRNNDescriptor_t.

func (*RNN) Algo

func (r *RNN) Algo() RNNAlgo

func (*RNN) DataType

func (r *RNN) DataType() DataType

func (*RNN) DirectionMode

func (r *RNN) DirectionMode() DirectionMode

func (*RNN) Dropout

func (r *RNN) Dropout() *Dropout

func (*RNN) HiddenSize

func (r *RNN) HiddenSize() int

func (*RNN) InputMode

func (r *RNN) InputMode() RNNInputMode

func (*RNN) MatrixMathType

func (r *RNN) MatrixMathType() MathType

func (*RNN) Mode

func (r *RNN) Mode() RNNMode

func (*RNN) NumLayers

func (r *RNN) NumLayers() int

func (*RNN) SetMatrixMathType

func (r *RNN) SetMatrixMathType(mathType MathType) error

type RNNAlgo

type RNNAlgo int

func (RNNAlgo) C

func (e RNNAlgo) C() C.cudnnRNNAlgo_t

C returns the C representation of RNNAlgo

func (RNNAlgo) String

func (e RNNAlgo) String() string

type RNNBiasMode added in v0.9.4

type RNNBiasMode int

func (RNNBiasMode) C added in v0.9.4

C returns the C representation of RNNBiasMode

func (RNNBiasMode) String added in v0.9.4

func (e RNNBiasMode) String() string

type RNNClipMode added in v0.9.4

type RNNClipMode int
const (
	RNNClipNone   RNNClipMode = C.CUDNN_RNN_CLIP_NONE
	RNNClipMinmax RNNClipMode = C.CUDNN_RNN_CLIP_MINMAX
)

func (RNNClipMode) C added in v0.9.4

C returns the C representation of RNNClipMode

func (RNNClipMode) String added in v0.9.4

func (e RNNClipMode) String() string

type RNNData added in v0.9.4

type RNNData struct {
	// contains filtered or unexported fields
}

RNNData is a representation of cudnnRNNDataDescriptor_t.

func NewRNNData added in v0.9.4

func NewRNNData(dataType DataType, layout RNNDataLayout, maxSeqLength int, batchSize int, vectorSize int, seqLengthArray []int, paddingFill Memory) (retVal *RNNData, err error)

NewRNNData creates a new RNNData.

func (*RNNData) BatchSize added in v0.9.4

func (r *RNNData) BatchSize() int

BatchSize returns the internal batchSize.

func (*RNNData) C added in v0.9.4

C() returns the internal cgo representation of RNNData

func (*RNNData) DataType added in v0.9.4

func (r *RNNData) DataType() DataType

DataType returns the internal dataType.

func (*RNNData) Layout added in v0.9.4

func (r *RNNData) Layout() RNNDataLayout

Layout returns the internal layout.

func (*RNNData) MaxSeqLength added in v0.9.4

func (r *RNNData) MaxSeqLength() int

MaxSeqLength returns the internal maxSeqLength.

func (*RNNData) PaddingFill added in v0.9.4

func (r *RNNData) PaddingFill() Memory

PaddingFill returns the internal paddingFill.

func (*RNNData) SeqLengthArray added in v0.9.4

func (r *RNNData) SeqLengthArray() []int

SeqLengthArray returns the internal `seqLengthArray` slice.

func (*RNNData) VectorSize added in v0.9.4

func (r *RNNData) VectorSize() int

VectorSize returns the internal vectorSize.

type RNNDataLayout added in v0.9.4

type RNNDataLayout int

func (RNNDataLayout) C added in v0.9.4

C returns the C representation of RNNDataLayout

func (RNNDataLayout) String added in v0.9.4

func (e RNNDataLayout) String() string

type RNNInputMode

type RNNInputMode int
const (
	LinearInput RNNInputMode = C.CUDNN_LINEAR_INPUT
	SkipInput   RNNInputMode = C.CUDNN_SKIP_INPUT
)

func (RNNInputMode) C

C returns the C representation of RNNInputMode

func (RNNInputMode) String

func (e RNNInputMode) String() string

type RNNMode

type RNNMode int
const (
	RNNReLU RNNMode = C.CUDNN_RNN_RELU
	RNNTanh RNNMode = C.CUDNN_RNN_TANH
	LSTM    RNNMode = C.CUDNN_LSTM
	GRU     RNNMode = C.CUDNN_GRU
)

func (RNNMode) C

func (e RNNMode) C() C.cudnnRNNMode_t

C returns the C representation of RNNMode

func (RNNMode) String

func (e RNNMode) String() string

type RNNPlan

type RNNPlan struct {
	// contains filtered or unexported fields
}

func NewRNNPlan

func NewRNNPlan(minibatch int, dataType DataType, desc *RNN) (plan *RNNPlan, err error)

func (*RNNPlan) Update

func (p *RNNPlan) Update(rnn *RNN) error

type ReduceTensorIndices

type ReduceTensorIndices int

func (ReduceTensorIndices) C

C returns the C representation of ReduceTensorIndices

func (ReduceTensorIndices) String

func (e ReduceTensorIndices) String() string

type ReduceTensorOp

type ReduceTensorOp int

func (ReduceTensorOp) C

C returns the C representation of ReduceTensorOp

func (ReduceTensorOp) String

func (e ReduceTensorOp) String() string

type Reduction

type Reduction struct {
	// contains filtered or unexported fields
}

Reduction is a representation of cudnnReduceTensorDescriptor_t.

func NewReduction

func NewReduction(reduceTensorOp ReduceTensorOp, reduceTensorCompType DataType, reduceTensorNanOpt NanPropagation, reduceTensorIndices ReduceTensorIndices, reduceTensorIndicesType IndicesType) (retVal *Reduction, err error)

NewReduction creates a new Reduction.

func (*Reduction) C added in v0.9.4

C returns the internal cgo representation.

func (*Reduction) ReduceTensorCompType

func (r *Reduction) ReduceTensorCompType() DataType

ReduceTensorCompType returns the internal reduceTensorCompType.

func (*Reduction) ReduceTensorIndices

func (r *Reduction) ReduceTensorIndices() ReduceTensorIndices

ReduceTensorIndices returns the internal reduceTensorIndices.

func (*Reduction) ReduceTensorIndicesType

func (r *Reduction) ReduceTensorIndicesType() IndicesType

ReduceTensorIndicesType returns the internal reduceTensorIndicesType.

func (*Reduction) ReduceTensorNanOpt

func (r *Reduction) ReduceTensorNanOpt() NanPropagation

ReduceTensorNanOpt returns the internal reduceTensorNanOpt.

func (*Reduction) ReduceTensorOp

func (r *Reduction) ReduceTensorOp() ReduceTensorOp

ReduceTensorOp returns the internal reduceTensorOp.

type ReorderType added in v0.9.4

type ReorderType int
const (
	DefaultReorder ReorderType = C.CUDNN_DEFAULT_REORDER
	NoReorder      ReorderType = C.CUDNN_NO_REORDER
)

func (ReorderType) C added in v0.9.4

C returns the C representation of ReorderType

func (ReorderType) String added in v0.9.4

func (e ReorderType) String() string

type SamplerType

type SamplerType int
const (
	Bilinear SamplerType = C.CUDNN_SAMPLER_BILINEAR
)

func (SamplerType) C

C returns the C representation of SamplerType

func (SamplerType) String

func (e SamplerType) String() string

type SeqData added in v0.9.4

type SeqData struct {
	// contains filtered or unexported fields
}

SeqData is a representation of cudnnSeqDataDescriptor_t.

func NewSeqData added in v0.9.4

func NewSeqData(dataType DataType, nbDims int, dimA []int, axes []SeqDataAxis, seqLengthArraySize uintptr, seqLengthArray []int, paddingFill Memory) (retVal *SeqData, err error)

NewSeqData creates a new SeqData.

func (*SeqData) Axes added in v0.9.4

func (s *SeqData) Axes() []SeqDataAxis

Axes returns the internal axes.

func (*SeqData) C added in v0.9.4

C() returns the internal cgo representation

func (*SeqData) DataType added in v0.9.4

func (s *SeqData) DataType() DataType

DataType returns the internal dataType.

func (*SeqData) DimA added in v0.9.4

func (s *SeqData) DimA() []int

DimA returns the internal dimA slice.

func (*SeqData) NbDims added in v0.9.4

func (s *SeqData) NbDims() int

NbDims returns the internal nbDims.

func (*SeqData) PaddingFill added in v0.9.4

func (s *SeqData) PaddingFill() Memory

PaddingFill returns the internal paddingFill.

func (*SeqData) SeqLengthArray added in v0.9.4

func (s *SeqData) SeqLengthArray() []int

SeqLengthArray returns the internal `seqLengthArray` slice.

func (*SeqData) SeqLengthArraySize added in v0.9.4

func (s *SeqData) SeqLengthArraySize() uintptr

SeqLengthArraySize returns the internal seqLengthArraySize.

type SeqDataAxis added in v0.9.4

type SeqDataAxis int

func (SeqDataAxis) C added in v0.9.4

C returns the C representation of SeqDataAxis

func (SeqDataAxis) String added in v0.9.4

func (e SeqDataAxis) String() string

type Severity added in v0.9.4

type Severity int

func (Severity) C added in v0.9.4

func (e Severity) C() C.cudnnSeverity_t

C returns the C representation of Severity

func (Severity) String added in v0.9.4

func (e Severity) String() string

type SoftmaxAlgorithm

type SoftmaxAlgorithm int

func (SoftmaxAlgorithm) C

C returns the C representation of SoftmaxAlgorithm

func (SoftmaxAlgorithm) String

func (e SoftmaxAlgorithm) String() string

type SoftmaxMode

type SoftmaxMode int

func (SoftmaxMode) C

C returns the C representation of SoftmaxMode

func (SoftmaxMode) String

func (e SoftmaxMode) String() string

type SpatialTransformer

type SpatialTransformer struct {
	// contains filtered or unexported fields
}

SpatialTransformer is a representation of cudnnSpatialTransformerDescriptor_t.

func NewSpatialTransformer

func NewSpatialTransformer(samplerType SamplerType, dataType DataType, nbDims int, dimA []int) (retVal *SpatialTransformer, err error)

NewSpatialTransformer creates a new SpatialTransformer.

func (*SpatialTransformer) C added in v0.9.4

C() returns the internal C representation of the Spatial Transformer

func (*SpatialTransformer) DataType

func (s *SpatialTransformer) DataType() DataType

DataType returns the internal dataType.

func (*SpatialTransformer) DimA added in v0.9.4

func (s *SpatialTransformer) DimA() []int

DimA returns the internal `dimA` slice.

func (*SpatialTransformer) NbDims

func (s *SpatialTransformer) NbDims() int

NbDims returns the internal nbDims.

func (*SpatialTransformer) SamplerType

func (s *SpatialTransformer) SamplerType() SamplerType

SamplerType returns the internal samplerType.

type Status added in v0.9.4

type Status = cudnnStatus

type TensorDescriptor

type TensorDescriptor struct {
	// contains filtered or unexported fields
}

func NewTensorDescriptor

func NewTensorDescriptor(format TensorFormat, dt DataType, shape, strides []int) (*TensorDescriptor, error)

func (*TensorDescriptor) DataType

func (t *TensorDescriptor) DataType() DataType

func (*TensorDescriptor) DeriveBNTensorDescriptor added in v0.9.4

func (te *TensorDescriptor) DeriveBNTensorDescriptor(xDesc *TensorDescriptor, mode BatchNormMode) (derivedBnDesc *TensorDescriptor, err error)

DeriveBNTensorDescriptor derives a secondary tensor descriptor for the batch normalization scale, invVariance, bnBias, and bnScale subtensors from the layer's x data descriptor.

func (*TensorDescriptor) DropoutGetReserveSpaceSize

func (te *TensorDescriptor) DropoutGetReserveSpaceSize() (sizeInBytes uintptr, err 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 cudnnDropoutForward() and cudnnDropoutBackward(), and its contents is expected to remain unchanged between cudnnDropoutForward() and cudnnDropoutBackward() calls.

func (*TensorDescriptor) Format

func (t *TensorDescriptor) Format() TensorFormat

func (*TensorDescriptor) Shape

func (t *TensorDescriptor) Shape() []int

func (*TensorDescriptor) Strides

func (t *TensorDescriptor) Strides() []int

type TensorFormat

type TensorFormat int

func (TensorFormat) C

C returns the C representation of TensorFormat

func (TensorFormat) String

func (e TensorFormat) String() string

type TensorTransform added in v0.9.4

type TensorTransform struct {
	// contains filtered or unexported fields
}

TensorTransform is a representation of cudnnTensorTransformDescriptor_t.

func NewTensorTransform added in v0.9.4

func NewTensorTransform(nbDims uint32, destFormat TensorFormat, padBeforeA []int32, padAfterA []int32, foldA []uint32, direction FoldingDirection) (retVal *TensorTransform, err error)

NewTensorTransform creates a new TensorTransform.

func (*TensorTransform) C added in v0.9.4

C returns the cgo representation

func (*TensorTransform) DestFormat added in v0.9.4

func (t *TensorTransform) DestFormat() TensorFormat

DestFormat returns the internal destFormat.

func (*TensorTransform) Direction added in v0.9.4

func (t *TensorTransform) Direction() FoldingDirection

Direction returns the internal direction.

func (*TensorTransform) FoldA added in v0.9.4

func (t *TensorTransform) FoldA() []uint32

FoldA returns the internal `foldA` slice.

func (*TensorTransform) NDims added in v0.9.4

func (t *TensorTransform) NDims() uint32

func (*TensorTransform) PadAfterA added in v0.9.4

func (t *TensorTransform) PadAfterA() []int32

PadAfterA returns the internal `padAfterA` padding slice.

func (*TensorTransform) PadBeforeA added in v0.9.4

func (t *TensorTransform) PadBeforeA() []int32

PadBeforeA returns the internal `padBeforeA` padding slice.

type WgradMode added in v0.9.4

type WgradMode int

func (WgradMode) C added in v0.9.4

C returns the C representation of WgradMode

func (WgradMode) String added in v0.9.4

func (e WgradMode) String() string

Notes

Bugs

  • the memory for the scratch space isn't freed. This could potentially lead to some issues

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL