Module: tfp.experimental.nn.util

Utilitity functions for building neural networks.

Classes

class CallOnce: Function object which memoizes the result of create_value_fn().

class RandomVariable: RandomVariable supports random variable semantics for TFP distributions.

Functions

batchify_op(...): Reshape op input x to be a vec of op_min_input_ndims-rank tensors.

display_imgs(...): Display images as a grid.

expand_dims(...): Like tf.expand_dims but accepts a vector of axes to expand.

flatten_rightmost(...): Flatten rightmost dims.

halflife_decay(...): Interpolates initial to final using halflife (exponential) decay.

im2row(...): Rearrange image blocks into rows.

im2row_index(...): Computes indexes into a flattened image for building im2row.

make_convolution_fn(...): Like tf.nn.conv2d except applies batch of kernels to batch of x.

make_convolution_transpose_fn_with_dilation(...): Like tf.nn.conv2d except applies batch of kernels to batch of x.

make_convolution_transpose_fn_with_subkernels(...): Like tf.nn.conv2d except applies batch of kernels to batch of x.

make_convolution_transpose_fn_with_subkernels_matrix(...): Like tf.nn.conv2d except applies batch of kernels to batch of x.

make_fit_op(...): One training step.

make_kernel_bias(...): Creates kernel and bias as tf.Variables.

make_kernel_bias_posterior_mvn_diag(...): Create learnable posterior for Variational layers with kernel and bias.

make_kernel_bias_prior_spike_and_slab(...): Create prior for Variational layers with kernel and bias.

prepare_conv_args(...): Sanitizes use provided input.

prepare_tuple_argument(...): Helper which processes Tensors to tuples in standard form.

tfcompile(...): Centralizes TF compilation related options.

trace(...): Returns a function which prints info related to input.

tune_dataset(...): Sets generally recommended parameters for a tf.data.Dataset.

variables_load(...): Assigns values to structure of tf.Variables from filename.

variables_save(...): Saves structure of tf.Variables to filename.

variables_summary(...): Returns a list of summarizing strs.