Multi-lib backend for POT
The goal is to write backend-agnostic code. Whether you’re using Numpy, PyTorch, Jax, Cupy, or Tensorflow, POT code should work nonetheless. To achieve that, POT provides backend classes which implements functions in their respective backend imitating Numpy API. As a convention, we use nx instead of np to refer to the backend.
Examples
>>> from ot.utils import list_to_array >>> from ot.backend import get_backend >>> def f(a, b): # the function does not know which backend to use ... a, b = list_to_array(a, b) # if a list in given, make it an array ... nx = get_backend(a, b) # infer the backend from the arguments ... c = nx.dot(a, b) # now use the backend to do any calculation ... return c
Warning
Tensorflow only works with the Numpy API. To activate it, please run the following:
from tensorflow.python.ops.numpy_ops import np_config np_config.enable_numpy_behavior()Performance
CPU: Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz
GPU: Tesla V100-SXM2-32GB
Date of the benchmark: December 8th, 2021
Commit of benchmark: PR #316, https://github.com/PythonOT/POT/pull/316
Returns the list of available backend implementations.
Returns the proper backend for a list of input arrays
Accepts None entries in the arguments, and ignores them
Also raises TypeError if all arrays are not from the same backend
Returns instances of all available backends.
Note that the function forces all detected implementations to be instantiated even if specific backend was not use before. Be careful as instantiation of the backend might lead to side effects, like GPU memory pre-allocation. See the documentation for more details. If you only need to know which implementations are available, use :py:func:`ot.backend.get_available_backend_implementations, which does not force instance of the backend object to be created.
Returns numpy arrays from any compatible backend
Backend abstract class. Implementations: JaxBackend
, NumpyBackend
, TorchBackend
, CupyBackend
, TensorflowBackend
The __name__ class attribute refers to the name of the backend.
The __type__ class attribute refers to the data structure used by the backend.
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Detach the tensors from the computation graph
See: https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates tensors cloning a numpy array, with the given precision (defaulting to input’s precision) and the given device (in case of GPUs)
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Returns the numpy version of tensors
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
CuPy implementation of the backend
__name__ is “cupy”
__type__ is cp.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
JAX implementation of the backend
__name__ is “jax”
__type__ is jax.numpy.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
NumPy implementation of the backend
__name__ is “numpy”
__type__ is np.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
PyTorch implementation of the backend
__name__ is “torch”
__type__ is torch.Tensor
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
Backend abstract class. Implementations: JaxBackend
, NumpyBackend
, TorchBackend
, CupyBackend
, TensorflowBackend
The __name__ class attribute refers to the name of the backend.
The __type__ class attribute refers to the data structure used by the backend.
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Detach the tensors from the computation graph
See: https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates tensors cloning a numpy array, with the given precision (defaulting to input’s precision) and the given device (in case of GPUs)
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Returns the numpy version of tensors
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
CuPy implementation of the backend
__name__ is “cupy”
__type__ is cp.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
JAX implementation of the backend
__name__ is “jax”
__type__ is jax.numpy.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
NumPy implementation of the backend
__name__ is “numpy”
__type__ is np.ndarray
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
PyTorch implementation of the backend
__name__ is “torch”
__type__ is torch.Tensor
Computes the absolute value element-wise.
This function follows the api from numpy.absolute
See: https://numpy.org/doc/stable/reference/generated/numpy.absolute.html
Returns True if two arrays are element-wise equal within a tolerance.
This function follows the api from numpy.allclose
See: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html
Tests whether any tensor element along given dimensions evaluates to True.
This function follows the api from numpy.any
See: https://numpy.org/doc/stable/reference/generated/numpy.any.html
Returns evenly spaced values within a given interval.
This function follows the api from numpy.arange
See: https://numpy.org/doc/stable/reference/generated/numpy.arange.html
Returns the indices of the maximum values of a tensor along given dimensions.
This function follows the api from numpy.argmax
See: https://numpy.org/doc/stable/reference/generated/numpy.argmax.html
Returns the indices of the minimum values of a tensor along given dimensions.
This function follows the api from numpy.argmin
See: https://numpy.org/doc/stable/reference/generated/numpy.argmin.html
Returns the indices that would sort a tensor.
This function follows the api from numpy.argsort
See: https://numpy.org/doc/stable/reference/generated/numpy.argsort.html
True if two arrays have the same shape and elements, False otherwise.
This function follows the api from numpy.array_equal
.
See: https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
Checks whether or not the two given inputs have the same dtype as well as the same device
Element wise arctangent
See: https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html
Gives the number of bits used by the data type of the given tensor.
Limits the values in a tensor.
This function follows the api from numpy.clip
See: https://numpy.org/doc/stable/reference/generated/numpy.clip.html
Joins a sequence of tensors along an existing dimension.
This function follows the api from numpy.concatenate
See: https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html
Creates a sparse tensor in COOrdinate format.
This function follows the api from scipy.sparse.coo_matrix
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html
Returns a copy of the given tensor.
This function follows the api from numpy.copy
See: https://numpy.org/doc/stable/reference/generated/numpy.copy.html
Returns the cumulative sum of tensor elements over given dimensions.
This function follows the api from numpy.cumsum
See: https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
Compute the determinant of an array.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.det.html
Returns CPU or GPU depending on the device where the given tensor is located.
Extracts or constructs a diagonal tensor.
This function follows the api from numpy.diag
See: https://numpy.org/doc/stable/reference/generated/numpy.diag.html
Returns the dot product of two tensors.
This function follows the api from numpy.dot
See: https://numpy.org/doc/stable/reference/generated/numpy.dot.html
Returns the dtype and the device of the given tensor.
Computes the eigenvalues and eigenvectors of a symmetric tensor.
This function follows the api from scipy.linalg.eigh
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eigh.html
Evaluates the Einstein summation convention on the operands.
This function follows the api from numpy.einsum
See: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
Removes entries smaller than the given threshold from the sparse tensor.
This function follows the api from scipy.sparse.csr_matrix.eliminate_zeros
Computes the exponential value element-wise.
This function follows the api from numpy.exp
See: https://numpy.org/doc/stable/reference/generated/numpy.exp.html
Creates the identity matrix of given size.
This function follows the api from numpy.eye
See: https://numpy.org/doc/stable/reference/generated/numpy.eye.html
Reverses the order of elements in a tensor along given dimensions.
This function follows the api from numpy.flip
See: https://numpy.org/doc/stable/reference/generated/numpy.flip.html
Return the floor of the input element-wise
See: https://numpy.org/doc/stable/reference/generated/numpy.floor.html
Creates a tensor with given shape, filled with given value.
This function follows the api from numpy.full
See: https://numpy.org/doc/stable/reference/generated/numpy.full.html
Computes the inverse of a matrix.
This function follows the api from scipy.linalg.inv
.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.inv.html
Returns whether or not the input consists of floats
Tests element-wise for finiteness (not infinity and not Not a Number).
This function follows the api from numpy.isfinite
.
See: https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html
Tests element-wise for positive or negative infinity and returns result as a boolean tensor.
This function follows the api from numpy.isinf
See: https://numpy.org/doc/stable/reference/generated/numpy.isinf.html
Tests element-wise for NaN and returns result as a boolean tensor.
This function follows the api from numpy.isnan
See: https://numpy.org/doc/stable/reference/generated/numpy.isnan.html
Checks whether or not the input tensor is a sparse tensor.
This function follows the api from scipy.sparse.issparse
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.issparse.html
Computes the (Generalized) Kullback-Leibler divergence.
This function follows the api from scipy.stats.entropy
.
Parameter eps is used to avoid numerical errors and is added in the log.
\[KL(p,q) = \langle \mathbf{p}, log(\mathbf{p} / \mathbf{q} + eps \rangle + \mathbb{1}_{mass=True} \langle \mathbf{q} - \mathbf{p}, \mathbf{1} \rangle\]
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.entropy.html
Returns a specified number of evenly spaced values over a given interval.
This function follows the api from numpy.linspace
See: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html
Computes the natural logarithm, element-wise.
This function follows the api from numpy.log
See: https://numpy.org/doc/stable/reference/generated/numpy.log.html
Computes the log of the sum of exponentials of input elements.
This function follows the api from scipy.special.logsumexp
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.logsumexp.html
Matrix product of two arrays.
See: https://numpy.org/doc/stable/reference/generated/numpy.matmul.html#numpy.matmul
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amax
See: https://numpy.org/doc/stable/reference/generated/numpy.amax.html
Returns element-wise maximum of array elements.
This function follows the api from numpy.maximum
See: https://numpy.org/doc/stable/reference/generated/numpy.maximum.html
Computes the arithmetic mean of a tensor along given dimensions.
This function follows the api from numpy.mean
See: https://numpy.org/doc/stable/reference/generated/numpy.mean.html
Computes the median of a tensor along given dimensions.
This function follows the api from numpy.median
See: https://numpy.org/doc/stable/reference/generated/numpy.median.html
Returns coordinate matrices from coordinate vectors (Numpy convention).
This function follows the api from numpy.meshgrid
See: https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html
Returns the maximum of an array or maximum along given dimensions.
This function follows the api from numpy.amin
See: https://numpy.org/doc/stable/reference/generated/numpy.amin.html
Returns element-wise minimum of array elements.
This function follows the api from numpy.minimum
See: https://numpy.org/doc/stable/reference/generated/numpy.minimum.html
Replace NaN with zero and infinity with large finite numbers or with the numbers defined by the user.
See: https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html#numpy.nan_to_num
Computes the matrix frobenius norm.
This function follows the api from numpy.linalg.norm
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html
Creates a tensor full of ones.
This function follows the api from numpy.ones
See: https://numpy.org/doc/stable/reference/generated/numpy.ones.html
Computes the outer product between two vectors.
This function follows the api from numpy.outer
See: https://numpy.org/doc/stable/reference/generated/numpy.outer.html
First tensor elements raised to powers from second tensor, element-wise.
This function follows the api from numpy.power
See: https://numpy.org/doc/stable/reference/generated/numpy.power.html
Return the product of all elements.
See: https://numpy.org/doc/stable/reference/generated/numpy.prod.html
Return the QR factorization
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.qr.html
Generate uniform random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Generate normal Gaussian random numbers.
This function follows the api from numpy.random.rand
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html
Repeats elements of a tensor.
This function follows the api from numpy.repeat
See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
Gives a new shape to a tensor without changing its data.
This function follows the api from numpy.reshape
See: https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
Finds indices where elements should be inserted to maintain order in given tensor.
This function follows the api from numpy.searchsorted
See: https://numpy.org/doc/stable/reference/generated/numpy.searchsorted.html
Sets the seed for the random generator.
This function follows the api from numpy.random.seed
See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
Define the gradients for the value val wrt the inputs
Returns an element-wise indication of the sign of a number.
This function follows the api from numpy.sign
See: https://numpy.org/doc/stable/reference/generated/numpy.sign.html
Solves a linear matrix equation, or system of linear scalar equations.
This function follows the api from numpy.linalg.solve
.
See: https://numpy.org/doc/stable/reference/generated/numpy.linalg.solve.html
Returns a sorted copy of a tensor.
This function follows the api from numpy.sort
See: https://numpy.org/doc/stable/reference/generated/numpy.sort.html
Return the sorted array and the indices to sort the array
See: https://pytorch.org/docs/stable/generated/torch.sort.html
Returns the non-ngeative square root of a tensor, element-wise.
This function follows the api from numpy.sqrt
See: https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html
Computes the matrix square root. Requires input symmetric positive semi-definite.
This function follows the api from scipy.linalg.sqrtm
, allowing batches.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
Remove axes of length one from a.
This function follows the api from numpy.squeeze
.
See: https://numpy.org/doc/stable/reference/generated/numpy.squeeze.html
Joins a sequence of tensors along a new dimension.
This function follows the api from numpy.stack
See: https://numpy.org/doc/stable/reference/generated/numpy.stack.html
Computes the standard deviation of a tensor along given dimensions.
This function follows the api from numpy.std
See: https://numpy.org/doc/stable/reference/generated/numpy.std.html
Sums tensor elements over given dimensions.
This function follows the api from numpy.sum
See: https://numpy.org/doc/stable/reference/generated/numpy.sum.html
Gathers elements of a tensor along given dimensions.
This function follows the api from numpy.take_along_axis
See: https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html
Construct an array by repeating a the number of times given by reps
See: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
Converts this matrix to Compressed Sparse Row format.
This function follows the api from scipy.sparse.coo_matrix.tocsr
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.tocsr.html
Converts a sparse tensor to a dense tensor.
This function follows the api from scipy.sparse.csr_matrix.toarray
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.toarray.html
Returns the sum along diagonals of the array.
This function follows the api from numpy.trace
.
See: https://numpy.org/doc/stable/reference/generated/numpy.trace.html
Returns a tensor that is a transposed version of a. The given dimensions dim0 and dim1 are swapped.
See: https://numpy.org/doc/stable/reference/generated/numpy.transpose.html
Finds unique elements of given tensor.
This function follows the api from numpy.unique
See: https://numpy.org/doc/stable/reference/generated/numpy.unique.html
Returns elements chosen from x or y depending on condition.
This function follows the api from numpy.where
See: https://numpy.org/doc/stable/reference/generated/numpy.where.html
Pads a tensor with a given value (0 by default).
This function follows the api from numpy.pad
See: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
Creates a tensor full of zeros.
This function follows the api from numpy.zeros
See: https://numpy.org/doc/stable/reference/generated/numpy.zeros.html
Returns the list of available backend implementations.
Returns the proper backend for a list of input arrays
Accepts None entries in the arguments, and ignores them
Also raises TypeError if all arrays are not from the same backend
Returns instances of all available backends.
Note that the function forces all detected implementations to be instantiated even if specific backend was not use before. Be careful as instantiation of the backend might lead to side effects, like GPU memory pre-allocation. See the documentation for more details. If you only need to know which implementations are available, use :py:func:`ot.backend.get_available_backend_implementations, which does not force instance of the backend object to be created.
Returns numpy arrays from any compatible backend
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4