convolution

package
v0.0.0-...-98db5b7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: CC-BY-4.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackDataPerformance

type BackDataPerformance gocudnn.ConvBwdDataAlgoPerformance

BackDataPerformance is a wrapper for gocudnn.ConvBwdDataAlgoPerformance

type ConvBwdDataAlgoPerformance struct {
	Algo        ConvFwdAlgo --flag --- Algo is the flag for the cudnn algorithm
	Status      Status    -- error occurance while running test
	Time        float32  -- time it takes to do the algo
	Memory      SizeT  --size of workspace memory to be passed
	Determinism Determinism  --flag determins if the algo is deterministic
	MathType    MathType -- flag chooses the mathtype - tensorcores?
}

func (BackDataPerformance) Print

func (b BackDataPerformance) Print()

Print will print forward performance to console

func (BackDataPerformance) String

func (b BackDataPerformance) String() string

type BackFilterPerformance

type BackFilterPerformance gocudnn.ConvBwdFiltAlgoPerformance

BackFilterPerformance is a wrapper for gocudnn.ConvBwdFiltAlgoPerformance

type ConvBwdFiltAlgoPerformance struct {
	Algo        ConvFwdAlgo --flag --- Algo is the flag for the cudnn algorithm
	Status      Status    -- error occurance while running test
	Time        float32  -- time it takes to do the algo
	Memory      SizeT  --size of workspace memory to be passed
	Determinism Determinism  --flag determins if the algo is deterministic
	MathType    MathType -- flag chooses the mathtype - tensorcores?
}

func (BackFilterPerformance) String

func (b BackFilterPerformance) String() string

type ForwardPerformance

type ForwardPerformance gocudnn.ConvFwdAlgoPerformance

ForwardPerformance is wrapper for gocudnn.ConvFwdAlgoPerformance with its exported Values

type ConvFwdAlgoPerformance struct{
	Algo        ConvFwdAlgo --Algo is the flag for the cudnn algorithm
	Status      Status    -- error occurance while running test
	Time        float32  -- time it takes to do the algo
	Memory      SizeT  --size of workspace memory to be passed
	Determinism Determinism  --flag
	MathType    MathType -- flag
}

func (ForwardPerformance) Print

func (f ForwardPerformance) Print()

Print will print the forward performance to console

func (ForwardPerformance) String

func (f ForwardPerformance) String() string

type Info

type Info struct {
	CMode       gocudnn.ConvolutionMode `json:"c_mode,omitempty"`
	Dtype       gocudnn.DataType        `json:"dtype,omitempty"`
	Pad         []int32                 `json:"pad,omitempty"`
	Stride      []int32                 `json:"stride,omitempty"`
	Dilation    []int32                 `json:"dilation,omitempty"`
	Format      gocudnn.TensorFormat    `json:"format,omitempty"`
	MathType    gocudnn.MathType        `json:"math_type,omitempty"`
	FwdAlgo     ForwardPerformance      `json:"fwd_algo,omitempty"`
	BwdDataAlgo BackDataPerformance     `json:"bwd_data_algo,omitempty"`
	BwdFiltAlgo BackFilterPerformance   `json:"bwd_filt_algo,omitempty"`
	Group       int32                   `json:"group,omitempty"`
}

Info is the contains the info to make the op

func (Info) Stage

func (input Info) Stage() (*Ops, error)

Stage stages/sets up an Ops and returns a pointer to it with the info stored in the info type

type Ops

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

Ops is a struct

func StageOperation

func StageOperation(mode gocudnn.ConvolutionMode, data gocudnn.DataType, mathtype gocudnn.MathType, group int32, pad, stride, dilation []int32) (conv *Ops, err error)

StageOperation set sets a convolution struct default algos go as follows fwd: direct, bwdfilt: algo0, bwddata:algo0

func (*Ops) BackwardBias

func (c *Ops) BackwardBias(
	handle *cudnn.Handler,
	alpha float64,
	dy *tensor.Volume,
	beta float64,
	dbias *tensor.Volume) error

BackwardBias does the backward bias calculation

func (*Ops) BackwardData

func (c *Ops) BackwardData(
	handle *cudnn.Handler,
	alpha float64,
	w *tensor.Volume,
	dy *tensor.Volume,
	wspace *nvidia.Malloced,
	beta float64,
	dx *tensor.Volume) error

BackwardData dx = alpha * BwdPropData(w,dy)+beta*dx

func (*Ops) BackwardFilter

func (c *Ops) BackwardFilter(
	handle *cudnn.Handler,
	alpha float64,
	x *tensor.Volume,
	dy *tensor.Volume,
	wspace *nvidia.Malloced,
	beta float64,
	dw *tensor.Volume) error

BackwardFilter dw = alpha * BwdPropFilt(x,dy)+beta*dw

func (*Ops) Dilation

func (c *Ops) Dilation() []int32

Dilation returns the dilation per dim for the operstion (usually H and W)

func (*Ops) Forward

func (c *Ops) Forward(
	handle *cudnn.Handler,
	alpha float64,
	x *tensor.Volume,
	w *tensor.Volume,
	wspace *nvidia.Malloced,
	beta float64,
	y *tensor.Volume) error

Forward y= alpha * Convolution(x,w)+ beta*y

func (*Ops) GetBwdDataAlgoPerfList

func (c *Ops) GetBwdDataAlgoPerfList(handle *cudnn.Handler, dx, w, dy *tensor.Volume, workspace *nvidia.Malloced) ([]BackDataPerformance, error)

GetBwdDataAlgoPerfList gets a list of backward data performance stats to set the convolution algo

func (*Ops) GetBwdFiltAlgoPerfList

func (c *Ops) GetBwdFiltAlgoPerfList(handle *cudnn.Handler, x, dw, dy *tensor.Volume, workspace *nvidia.Malloced) ([]BackFilterPerformance, error)

GetBwdFiltAlgoPerfList gets a list of backward filter stats

func (*Ops) GetFwdAlgoPerfList

func (c *Ops) GetFwdAlgoPerfList(handle *cudnn.Handler, x, w, y *tensor.Volume, workspace *nvidia.Malloced) ([]ForwardPerformance, error)

GetFwdAlgoPerfList gets a list of forward performance stats

func (*Ops) Info

func (c *Ops) Info() (Info, error)

Info returns an info struct and error. Info is usually used for saving the data to a json file.

func (*Ops) OutputDim

func (c *Ops) OutputDim(input *tensor.Volume, filter *tensor.Volume) (dims []int32, err error)

OutputDim will return the dims of what the output tensor should be

func (*Ops) Pad

func (c *Ops) Pad() []int32

Pad returns the padding per dim (usually H and W) for the convolution operation

func (*Ops) SetBestAlgosConsidering

func (c *Ops) SetBestAlgosConsidering(
	handle *cudnn.Handler,
	x *tensor.Volume,
	y *tensor.Volume,
	w *tensor.Volume,
	wspacesize int,
	fastest bool) (
	uint,
	error)

SetBestAlgosConsidering this method will set the best algos for the fwd, bwddata, and bwdfilter algos. and return the workspace size along with an error if an error is found the function will not set any values, Here are some simple rules to the function if fastest is marked true. Then it will find the fastest algo no mater what worksize is. if fastest is set to false. It will check if wspace is greater than zero then it will set the algos to the fastest algo considering the workspace size, and return the largest wspacesize in all the algos else it will find and set the fastest algos with no workspace size and return 0

func (*Ops) SetBestAlgosConsideringDims4d

func (c *Ops) SetBestAlgosConsideringDims4d(
	handle *cudnn.Handler,
	xd []int32,
	yd []int32,
	wd []int32,
	wspacesize int,
	fastest bool,
	dtype gocudnn.DataType,
	frmt gocudnn.TensorFormat,
) (
	uint,
	error)

SetBestAlgosConsideringDims4d is the same as SetBestAlgosConsidering as long as the dims are 4d

func (*Ops) SetBwdDataPerformanceAlgo

func (c *Ops) SetBwdDataPerformanceAlgo(bwddata BackDataPerformance) error

SetBwdDataPerformanceAlgo will sets the convolution algorithm

func (*Ops) SetBwdFiltPerformanceAlgo

func (c *Ops) SetBwdFiltPerformanceAlgo(bwdfilt BackFilterPerformance) error

SetBwdFiltPerformanceAlgo will sets the convolution algorithm

func (*Ops) SetFwdPerformanceAlgo

func (c *Ops) SetFwdPerformanceAlgo(fwd ForwardPerformance) error

SetFwdPerformanceAlgo will sets the convolution algorithm

func (*Ops) SetMathType

func (c *Ops) SetMathType(mtype gocudnn.MathType) error

SetMathType will set the mathtype

func (*Ops) Stride

func (c *Ops) Stride() []int32

Stride or slide returns the stride per dim for the operstion (usually H and W)

func (*Ops) String

func (c *Ops) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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