Autograd-Math


mean

Mean of a Variable, alongside the specified axis. - axis axis to compute the mean. 0-based indexed. - keepDims A boolean, whether to keep the dimensions or not. If keepDims is False, the rank of the Variable is reduced by 1. If keepDims is True, the reduced dimensions are retained with length 1.

Scala example

mean(x: Variable[T], axis: Int = 0, keepDims: Boolean = false)

Python example

mean(x, axis=0, keepDims=False):

abs

Element-wise absolute value. - x A Variable.

Scala example

abs(x: Variable[T])

Python example

abs(x):

sum

Sum of the values in a Variable, alongside the specified axis. - axis axis to compute the mean. 0-based indexed. - keepDims A boolean, whether to keep the dimensions or not. If keepDims is False, the rank of the Variable is reduced by 1. If keepDims is True, the reduced dimensions are retained with length 1.

Scala example

sum(x: Variable[T], axis: Int = 0, keepDims: Boolean = false)

Python example

sum(x, axis=0, keepDims=False):

clip

Element-wise value clipping. - x A Variable. - min Double - max Double

Scala example

clip(x: Variable[T], min: Double, max: Double)

Python example

clip(x, min, max)

square

Element-wise square. - x A Variable.

Scala example

square(x: Variable[T])

Python example

square(x):

sqrt

Element-wise square root. - x A Variable.

Scala example

sqrt(x: Variable[T])

Python example

sqrt(x):

maximum

Element-wise maximum of two Variables. - x A Variable. - y A Variable or Double.

Scala example

maximum(x: Variable[T], y: Variable[T])

Python example

maximum(x, y):

log

Element-wise log. - x A Variable.

Scala example

log(x: Variable[T])

Python example

log(x):

exp

Element-wise exponential. - x A Variable.

Scala example

exp(x: Variable[T])

Python example

exp(x):

pow

Element-wise exponentiation. - x A Variable. - a Double.

Scala example

pow(x: Variable[T])

Python example

pow(x):

softsign

Softsign of a Variable.

Scala example

softsign(x: Variable[T])

Python example

softsign(x):

softplus

Softplus of a Variable.

Scala example

softplus(x: Variable[T])

Python example

softplus(x):

stack

Stacks a list of rank R tensors into a rank R+1 tensor. You should start from 1 as dim 0 is for batch. - inputs: List of variables (tensors) - axis: xis along which to perform stacking.

Scala example

def stack[T: ClassTag](inputs: List[Variable[T]], axis: Int = 1)

Python example

def stack(inputs, axis=1)

expand_dims

Adds a 1-sized dimension at index "axis".

Scala example

def expandDims[T: ClassTag](x: Variable[T], axis: Int)

Python example

expand_dims(x, axis)

contiguous

Turn the output and grad to be contiguous for the input Variable

Scala example

def contiguous[T: ClassTag](input: Variable[T])

Python example

def contiguous(x)

mm

Module to perform matrix multiplication on two mini-batch inputs, producing a mini-batch. - x A variable. - y A variable. - axes Axes along which to perform multiplication.

Scala example

def mm[T: ClassTag](x: Variable[T], y: Variable[T], axes: List[Int])

Python example

def mm(x, y, axes)

batch_dot

Operator that computes a dot product between samples in two tensors. - x Shape should only be [batch, xx] - y Shape should only be [batch, xx] - axes Integer or tuple of integers, axis or axes along which to take the dot product. - normalize Whether to L2-normalize samples along the dot product axis before taking the dot product. If set to True, then the output of the dot product is the cosine proximity between the two samples.

Scala example

def batchDot[T: ClassTag](x: Variable[T], y: Variable[T], axes: List[Int], normalize: Boolean = false)

Python example

def batch_dot(x, y, axes=1, normalize=False)

l2_normalize

Normalizes a tensor wrt the L2 norm alongside the specified axis. - x A variable. - axis Axis along which to perform normalization.

Scala example

def l2Normalize[T: ClassTag](x: Variable[T], axis: Int)

Python example

def l2_normalize(x, axis)