Module dfdx::tensor_ops
source · [−]Expand description
Implementations of all operations for tensors, including activations, binary operations, and other methods.
Functions
The absolute value (abs) computes |x|
Applies a binary function f
, it’s partial wrt. x dfdx
, and its partial wrt. y dfdy
to a pair of Tensors lhs
and `rhs.
Broadcasts the last dimension of rhs
to make it the same size of lhs
.
Broadcast the first dimension of Rhs M times, so its the same size as Lhs.
Clamps all values in t
to between min
and max
The cos function computes cos(x)
The exponential function (exp) computes e ^ x
The Natural Logarithm (ln) computes ln(x)
Numerically stable computation of log(softmax(t))
. Does t - logsumexp(t)
under the hood.
Computes the LogSumExp function.
Equivalent to log(sum(exp(data)))
or data.exp().sum(-1).log()
.
Matrix multiplication.
Sums all the values in self
and divides by number of values.
Replaces any nans in t
with value
.
Negates all values in t
.
Rectified Linear Unit (ReLU) computes max(0, x)
.
The sine function computes sin(x)
Computes the softmax function.
Equivalent to t.log_softmax().exp()
or exp(log_softmax(t))
or exp(t) / sum(exp(t))
Square root computes x ^ 0.5
or √x
.
Square computes x * x
.
Calls [Device::sum_last_dim()] on the underlying array. Result Tensor has smaller number of dimensions.
Hyperbolic Tangent (Tanh) computes tanh(x)
.
Sets t
to value
anywhere mask
equals value
vector * matrix multiplication.