Base class for networks which generate Distributions as their output.
input_tensor_spec, state_spec, output_spec, name
Returns the spec of the input to the network of type InputSpec.
Get the list of all (nested) sub-layers used in this Network.
Create a shallow copy of this network.
Note: Network layer weights are never copied. This method recreates
Network instance with the same arguments it was initialized with
(excepting any new kwargs).
Args to override when recreating this network. Commonly
overridden args include 'name'.
A shallow copy of this network.
Force creation of the network's variables.
Return output specs.
(Optional). Override or provide an input tensor spec
when creating variables.
Other arguments to
Output specs - a nested spec calculated from the outputs (excluding any
batch dimensions). If any of the output elements is a tfp
the associated spec entry returned is a
input_tensor_spec is provided, and the network did
not provide one during construction.
Returns an initial state usable by the network.
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
Retrieves a layer based on either its name (unique) or index.
index are both provided,
index will take precedence.
Indices are based on order of horizontal graph traversal (bottom-up).
String, name of layer.
Integer, index of layer.
A layer instance.
In case of invalid layer name or index.
line_length=None, positions=None, print_fn=None
Prints a string summary of the network.
Total length of printed lines
(e.g. set this to adapt the display to different
terminal window sizes).
Relative or absolute positions of log elements
in each line. If not provided,
[.33, .55, .67, 1.].
Print function to use. Defaults to
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.
summary() is called before the model is built.