Generates a tfp.distribution.Normal by predicting a mean and std.

Inherits From: DistributionNetwork, Network

sample_spec A tensor_spec.BoundedTensorSpec detailing the shape and dtypes of samples pulled from the output distribution.
activation_fn Activation function to use in dense layer.
init_means_output_factor Output factor for initializing action means weights.
std_bias_initializer_value Initial value for the bias of the stddev_projection_layer or the direct bias_layer depending on the state_dependent_std flag.
mean_transform Transform to apply to the calculated means. Uses tanh_squash_to_spec by default.
std_transform Transform to apply to the stddevs.
state_dependent_std If true, stddevs will be produced by MLP from state. else, stddevs will be an independent variable.
scale_distribution Whether or not to use a bijector chain to scale distributions to match the sample spec. Note the TransformedDistribution does not support certain operations required by some agents or policies such as KL divergence calculations or Mode.
seed seed used for Keras kernal initializers.
seed_stream_class The seed stream class. This is almost always tfp.util.SeedStream, except for in unit testing, when one may want to seed all the layers deterministically.
name A string representing name of the network.

input_tensor_spec Returns the spec of the input to the network of type InputSpec.
layers Get the list of all (nested) sub-layers used in this Network.




View source

Create a shallow copy of this network.

**kwargs Args to override when recreating this network. Commonly overridden args include 'name'.

A shallow copy of this network.


View source

Force creation of the network's variables.

Return output specs.

input_tensor_spec (Optional). Override or provide an input tensor spec when creating variables.
**kwargs Other arguments to, e.g. training=True.

Output specs - a nested spec calculated from the outputs (excluding any batch dimensions). If any of the output elements is a tfp Distribution, the associated spec entry returned is a DistributionSpec.

ValueError If no input_tensor_spec is provided, and the network did not provide one during construction.


View source

Returns an initial state usable by the network.

batch_size Tensor or constant: size of the batch dimension. Can be None in which case not dimensions gets added.

A nested object of type self.state_spec containing properly initialized Tensors.


View source

Retrieves a layer based on either its name (unique) or index.

If name and index are both provided, index will take precedence. Indices are based on order of horizontal graph traversal (bottom-up).

name String, name of layer.
index Integer, index of layer.

A layer instance.

ValueError In case of invalid layer name or index.


View source

Prints a string summary of the network.

line_length Total length of printed lines (e.g. set this to adapt the display to different terminal window sizes).
positions Relative or absolute positions of log elements in each line. If not provided, defaults to [.33, .55, .67, 1.].
print_fn Print function to use. Defaults to print. It will be called on each line of the summary. You can set it to a custom function in order to capture the string summary.

ValueError if summary() is called before the model is built.