nn_functional

package
v1.11.0-0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterpolateScale

func InterpolateScale(
	input *torch.Tensor,
	scale []float64,
	mode InterpolateMode,
	alignCorners bool,
	antialias bool,
) (output *torch.Tensor)

Down/up sample the input to either the given scale factor. The algorithm used for interpolation is determined by mode. Currently temporal, spatial and volumetric sampling are supported, i.e. expected inputs are 3-D, 4-D or 5-D in shape. The input dimensions are interpreted in the form: mini-batch x channels x [optional depth] x [optional height] x width. The modes available for resizing are: nearest, linear (3D-only), bilinear, bicubic (4D-only), trilinear (5D-only), area, nearest-exact

func InterpolateSize

func InterpolateSize(
	input *torch.Tensor,
	size []int64,
	mode InterpolateMode,
	alignCorners bool,
	antialias bool,
) (output *torch.Tensor)

Down/up sample the input to either the given size. The algorithm used for interpolation is determined by mode. Currently temporal, spatial and volumetric sampling are supported, i.e. expected inputs are 3-D, 4-D or 5-D in shape. The input dimensions are interpreted in the form: mini-batch x channels x [optional depth] x [optional height] x width. The modes available for resizing are: nearest, linear (3D-only), bilinear, bicubic (4D-only), trilinear (5D-only), area, nearest-exact

func Normalize

func Normalize(
	input *torch.Tensor,
	p float64,
	dim int,
	eps float64,
) (output *torch.Tensor)

Perform L_p normalization of inputs over specified dimension.

func Pad

func Pad(
	input *torch.Tensor,
	padding []int64,
	mode PadMode,
	value ...float64,
) (output *torch.Tensor)

Pad a tensor.

func Relu

func Relu(input *torch.Tensor, inplace bool) (output *torch.Tensor)

Apply the rectified linear unit function element-wise.

func Softmax

func Softmax(input *torch.Tensor, dim int64) (output *torch.Tensor)

Apply a softmax function.

Types

type InterpolateMode

type InterpolateMode int64

Interpolation algorithms implemented by libtorch.

const (
	InterpolateNearest InterpolateMode = iota
	InterpolateLinear
	InterpolateBilinear
	InterpolateBicubic
	InterpolateTrilinear
	InterpolateArea
	InterpolateNearestExact
)

type PadMode

type PadMode int64

Padding algorithms implemented by libtorch.

const (
	PadConstant PadMode = iota
	PadReflect
	PadReplicate
	PadCircular
)

Jump to

Keyboard shortcuts

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