Keras layer enabling plumbing TFP distributions through Keras models

layer_distribution_lambda(
  object,
  make_distribution_fn,
  convert_to_tensor_fn = tfp$distributions$Distribution$sample,
  ...
)

Arguments

object

Model or layer object

make_distribution_fn

A callable that takes previous layer outputs and returns a tfd$distributions$Distribution instance.

convert_to_tensor_fn

A callable that takes a tfd$Distribution instance and returns a tf$Tensor-like object. Default value: tfd$distributions$Distribution$sample.

...

Additional arguments passed to args of keras::create_layer.

Value

a Keras layer

See also