<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/bijectors/highway_flow.py#L42-L121) |

Builds a HighwayFlow parameterized by trainable variables.

    tfp.experimental.bijectors.build_trainable_highway_flow(
        width,
        residual_fraction_initial_value=0.5,
        activation_fn=None,
        gate_first_n=None,
        seed=None,
        validate_args=False
    )

The variables are transformed to enforce the following parameter constraints:

- `residual_fraction` is bounded between 0 and 1.
- `upper_diagonal_weights_matrix` is a randomly initialized (lower) diagonal matrix with positive diagonal of size `width x width`.
- `lower_diagonal_weights_matrix` is a randomly initialized lower diagonal matrix with ones on the diagonal of size `width x width`;
- `bias` is a randomly initialized vector of size `width`.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `width` | Input dimension of the bijector. |
| `residual_fraction_initial_value` | Initial value for gating parameter, must be between 0 and 1. |
| `activation_fn` | Callable invertible activation function (e.g., [`tf.nn.softplus`](https://www.tensorflow.org/api_docs/python/tf/math/softplus)), or `None`. |
| `gate_first_n` | Decides which part of the input should be gated (useful for example when using auxiliary variables). |
| `seed` | Seed for random initialization of the weights. |
| `validate_args` | Python `bool`. Whether to validate input with runtime assertions. Default value: `False`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `trainable_highway_flow` | The initialized bijector. |

<br />