Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

Module: tfp.experimental.substrates.jax.math

View source on GitHub

TensorFlow Probability math functions.


psd_kernels module: Positive-semidefinite kernels package.


cholesky_concat(...): Concatenates chol @ chol.T with additional rows and columns.

clip_by_value_preserve_gradient(...): Clips values to a specified min and max while leaving gradient unaltered.

custom_gradient(...): Embeds a custom gradient into a Tensor.

fill_triangular(...): Creates a (batch of) triangular matrix from a vector of inputs.

fill_triangular_inverse(...): Creates a vector from a (batch of) triangular matrix.

log1mexp(...): Compute log(1 - exp(-|x|)) in a numerically stable way.

log1psquare(...): Numerically stable calculation of log(1 + x**2) for small or large |x|.

log_add_exp(...): Computes log(exp(x) + exp(y)) in a numerically stable way.

log_combinations(...): Multinomial coefficient.

log_sub_exp(...): Compute log(exp(max(x, y)) - exp(min(x, y))) in a numerically stable way.

lu_matrix_inverse(...): Computes a matrix inverse given the matrix's LU decomposition.

lu_reconstruct(...): The inverse LU decomposition, X == lu_reconstruct(*tf.linalg.lu(X)).

lu_solve(...): Solves systems of linear eqns A X = RHS, given LU factorizations.

pivoted_cholesky(...): Computes the (partial) pivoted cholesky decomposition of matrix.

random_rademacher(...): Generates Tensor consisting of -1 or +1, chosen uniformly at random.

random_rayleigh(...): Generates Tensor of positive reals drawn from a Rayleigh distributions.

reduce_logmeanexp(...): Computes log(mean(exp(input_tensor))).

reduce_weighted_logsumexp(...): Computes log(abs(sum(weight * exp(elements across tensor dimensions)))).

smootherstep(...): Computes a sigmoid-like interpolation function on the unit-interval.

soft_sorting_matrix(...): Computes a matrix representing a continuous relaxation of sorting.

soft_threshold(...): Soft Thresholding operator.

softplus_inverse(...): Computes the inverse softplus, i.e., x = softplus_inverse(softplus(x)).

sparse_or_dense_matmul(...): Returns (batched) matmul of a SparseTensor (or Tensor) with a Tensor.

sparse_or_dense_matvecmul(...): Returns (batched) matmul of a (sparse) matrix with a column vector.

value_and_gradient(...): Computes f(*xs) and its gradients wrt to *xs.