clipper

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClipNorm

type ClipNorm struct {
	MaxNorm, NormType mat.Float
}

ClipNorm is a GradClipper which clips the values of a matrix according to the NormType. See ClipNorm.Clip.

func (*ClipNorm) Clip

func (c *ClipNorm) Clip(gs []mat.Matrix)

Clip clips the gradients, multiplying each parameter by the MaxNorm, divided by n-norm of the overall gradients. NormType is the n-norm. Can be “Double.POSITIVE_INFINITY“ for infinity norm (default 2.0)

type ClipValue

type ClipValue struct {
	Value mat.Float
}

ClipValue is a GradClipper which clips the values of a matrix between -Value and +Value.

func (*ClipValue) Clip

func (c *ClipValue) Clip(gs []mat.Matrix)

Clip clips the values of the matrix in place.

type GradClipper

type GradClipper interface {
	// Clip clips the values of the matrix in place.
	Clip(gs []mat.Matrix)
}

GradClipper is implemented by any value that has the Clip method.

Jump to

Keyboard shortcuts

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