activation

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: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags() (act gocudnn.ActivationMode, Nan gocudnn.NANProp)

Flags returns the flags that are needed to create an Activation struct

Types

type Flag

type Flag struct {
	Mode    Mode
	NanFlag gocudnn.NANProp
}

Flag is a helper struct used to pass flags

type Mode

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

Mode passes Mode flags

func (*Mode) ClippedRelu

func (m *Mode) ClippedRelu() Mode

ClippedRelu places a ceiling on the output

func (*Mode) Elu

func (m *Mode) Elu() Mode

Elu is the exponential linear unit

func (*Mode) Identity

func (m *Mode) Identity() Mode

Identity passes identity. It is used for bwd and fwd convolutionactivationbiasfwd

func (*Mode) Leaky

func (m *Mode) Leaky() Mode

Leaky is the leaky linear unit

func (*Mode) PRelu

func (m *Mode) PRelu() Mode

PRelu is the Parametric activation function. This is an experimental function

func (*Mode) Relu

func (m *Mode) Relu() Mode

Relu returns relu flag

func (*Mode) Sigmoid

func (m *Mode) Sigmoid() Mode

Sigmoid returns sigmoid flag

func (*Mode) Tanh

func (m *Mode) Tanh() Mode

Tanh sends a flag for the tanh activation

func (*Mode) Threshhold

func (m *Mode) Threshhold() Mode

Threshhold passes a Threshhold mode flag. It is an experimental function.

type OpInfo

type OpInfo struct {
	Mode     Mode             `json:"mode,omitempty"`
	NanProp  gocudnn.NANProp  `json:"nan_prop,omitempty"`
	Coef     float64          `json:"coef,omitempty"`
	DataType gocudnn.DataType `json:"data_type,omitempty"`
}

OpInfo contains the necissary information to build an activation Ops

func (OpInfo) Stage

func (input OpInfo) Stage(h *cudnn.Handler) (*Ops, error)

Stage builds and returns *Op from the info inside of the info type

type Ops

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

Ops is the non linear function that is used in neural networks. This structure holds the information used to performing the activation function.

func Stage

func Stage(handle *cudnn.Handler, mode Mode, dtype gocudnn.DataType, nan gocudnn.NANProp, coef float64) (*Ops, error)

Stage creates an activation struct given the properties passed in function

func (*Ops) BwdProp

func (act *Ops) BwdProp(
	handle *cudnn.Handler,
	alpha float64,
	y *tensor.Volume,
	dy *tensor.Volume,
	x *tensor.Volume,
	beta float64,
	dx *tensor.Volume,
	negcoef *tensor.Volume,
	dnegcoef *tensor.Volume,
	thresh *tensor.Volume,
	dthresh *tensor.Volume,
	poscoef *tensor.Volume,
	dposcoef *tensor.Volume) error

BwdProp is the backwards propigation of the activation struct

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.

func (*Ops) Destroy

func (act *Ops) Destroy() error

Destroy destroys the cuda allocated memory associated with Activation

func (*Ops) FwdProp

func (act *Ops) FwdProp(
	handle *cudnn.Handler,
	alpha float64,
	x *tensor.Volume,
	beta float64,
	y *tensor.Volume,
	negcoef *tensor.Volume,
	thresh *tensor.Volume,
	poscoef *tensor.Volume) error

FwdProp is the forward propigation function for the Activation struct

func (*Ops) Info

func (act *Ops) Info() (OpInfo, error)

Info returns the Info struct. (Made for saving to a json file at a higher level)

func (*Ops) Mode

func (act *Ops) Mode() Mode

Mode returns the activation Mode

func (*Ops) Properties

func (act *Ops) Properties() (Mode, gocudnn.NANProp, float64, error)

Properties returns the values that were used to Create the Activation struct

Jump to

Keyboard shortcuts

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