Commit 9217a746 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TensorFlower Gardener
Browse files

from_params and param_shapes for easy distribution construction

This CL enables users to programmatically switch between different distribution types (e.g. by command line flag) and have minimal custom logic for each distribution type, specifically knowing the names of the distribution parameters and their required constraints (e.g. positivity for a Normal's sigma).

This is done through 2 static functions: param_shapes, which returns the name and shape of parameters for a given desired sample shape, and from_params, which takes parameter kwargs, by default constrains them (e.g. apply softplus to the sigma parameter to make it positive), and returns an instance of the distribution with the (constrained) parameters.
Change: 130437416
parent 369d9dd5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment