View source on GitHub |
Creates an instance of type value.type_
with the parameters in value
.
tf_agents.distributions.utils.make_from_parameters(
value: tf_agents.distributions.utils.Params
) -> Any
For more details, see the docstrings for get_parameters
and Params
.
This function may raise strange errors if value
is a Params
created from
a badly constructed object (one which does not set self._parameters
properly). For example:
class MyBadlyConstructedDistribution(tfp.distributions.Categorical):
def __init__(self, extra_arg, **kwargs):
super().__init__(**kwargs)
self._extra_arg = extra_arg
...
To fix this, make sure self._parameters
are properly set:
class MyProperlyConstructedDistribution(tfp.distributions.Categorical):
def __init__(self, extra_arg, **kwargs):
super().__init__(**kwargs)
# Ensure all arguments to `__init__` are in `self._parameters`.
self._parameters = dict(extra_arg=extra_arg, **kwargs)
self._extra_arg = extra_arg
...
Args | |
---|---|
value
|
A Params object; the output of get_parameters (or a modified
version thereof).
|
Returns | |
---|---|
An instance of value.type_ .
|