tf_agents.distributions.utils.make_from_parameters
Stay organized with collections
Save and categorize content based on your preferences.
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_ .
|
Raises |
Exception
|
If value is a Params object and the initializer of
value.type_ does not recognize accept the args structure given in
value.params . This can happen if, e.g., value.type_.__init__ does not
properly set self._parameters or self.parameters to match the
arguments it expects.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-26 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]