# tf_agents.distributions.utils.make_from_parameters

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/distributions/utils.py#L323-L376) |

Creates an instance of type `value.type_` with the parameters in `value`.

    tf_agents.distributions.utils.make_from_parameters(
        value: https://www.tensorflow.org/agents/api_docs/python/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

      ...

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | A `Params` object; the output of `get_parameters` (or a modified version thereof). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An instance of `value.type_`. ||

<br />

<br />

<br />

<br />

| ## 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. |

<br />