osl_dynamics.inference.ops#

TensorFlow functions used by the layers in osl_dynamics.inference.layers.

Functions#

add_epsilon(A, epsilon[, diag])

Add epsilon to the diagonal of square matrices or to every element.

mvn_log_prob(x, mu, sigma)

Multivariate normal log-likelihood with an analytic gradient.

mvn_log_prob_per_state(x, mu, sigma)

Multivariate normal log-likelihood for each state.

forward_backward_rescale(log_B, P, Pi_0)

Forward-backward recursions for a batch of sequences.

forward_backward_log(log_B, P, Pi_0)

Forward-backward recursions for a batch of sequences.

compiled(func)

func as a tf.function, compiled with XLA where it is supported.

reduce_over_time(x, reduction)

Sum or average over time and average over sequences.

sample_normal(mu, sigma)

Sample from normal distributions.

sample_gumbel_softmax(logits, temperature)

Sample from Gumbel-Softmax (relaxed one-hot categorical) distributions.

normal_kl_divergence(inference_mu, inference_sigma, ...)

KL divergence between the posterior and prior of a sequence of normal

categorical_kl_divergence(inference_logits, ...)

KL divergence between the posterior and prior of a sequence of