Package org. diffkt
Types
We identify values produced for forward or reverse differentiation with a DerivativeID. We assign each derivative a unique DerivativeID with its own unique "sequence" number. Each instance of DerivativeID represents a separate set of perturbations, the product of any two of which is zero.
Implement Differentiable to have the runtime be capable of using your data type as an input or output type of a function that can be differentiated.
Interface for a differentiable tensor.
A differentiable tensor of rank 0 containing a single float (a FloatTensor wrapper around a float).
A sparse row float tensor, which is a FloatTensor of rank 2 which has sparse rows (e.g. has rows that are empty/zero). This data format is particularly useful for embedding table gradients.
A float tensor, which stores its underlying data in a float array and tracks the strides needed to access data for each dimension.
An interface that is capable of wrapping individual values. To be used by an implementation of Differentiable to wrap the individual values.
Functions
Returns the primal value as a FloatScalar.
Returns the primal value as a FloatTensor.
Concatenate two tensors along the provided axis.
x is the output of the network: xi,j is its guess on whether input i is classified as a j. labels is the actual label: labelsi,j is 1 iff input i is classified as a j; 0 otherwise.
x is the output of the network: xi,j is its guess on whether input i is classified as a j. labels is the actual label: labelsi,j is 1 iff input i is classified as a j; 0 otherwise.
Return a tensor made up of slices taken from the input tensor at the given indices along the given axis.
Test whether an input value tested is greater than zero, or less than or equal to zero. Each element of the result is, depending on the value in tested:
Takes a tensor of shape T, a shape B, and a tensor of shape T and returns a tensor of shape T which is the inner product of the two.
Given the shape A,B,D (where A, B and D are lists of Ints, and D is possibly empty), this function converts a tensor of shape A,B,D to a tensor of shape B,A,D, shuffling the data so that the element at position i,j,k is at position j,i,k (where i, j and k are lists of integers corresponding to the shape A, B, and D).
Scalar (floating-point) subtraction.
Tensor subtraction.
Because scalar addition is commutative, we can implement this operation in terms of the same operation with the operands swapped.
The addition of a floating-point number to a DScalar simply updates the primal with the scaled value.
Scalar (floating-point) addition.
Tensor addition.
The forward derivative of a multivariate function.
The forward derivative of a multivariate scalar function.
The forward derivative of a multivariate tensor function.
Evaluate the function, and return a pair containing its result (primal) and the derivative. This version supports user-defined types for input and output of the function.
The Reverse gradients of a multivariate function.
The Reverse derivative of a multivariate function.
The Reverse derivative of a multivariate scalar function.
The Reverse derivative of a multivariate tensor function.
Evaluate the function, and return a pair containing its result (primal) and the derivative. This version supports user-defined types for input and output of the function.
Given the shape A,B,D (where A, B and D are lists of Ints, and D is possibly empty), this function converts a tensor of shape D,A,B to a tensor of shape D,B,A, shuffling the data so that the element at position i,j,k is at position i,k,j (where i, j and k are lists of integers corresponding to the shape D, B, and A).
Sum over given axes. If keepDims is true, the original rank of input is preserved. Otherwise, the dimensions provided by axis are removed from the output shape.
Create a FloatTensor from variable length parameters of type Float. The FloatTensor that is returned is a 1D array.
Create a FloatTensor from the list of values given.