# tf_agents.utils.common.function_in_tf1

<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/utils/common.py#L160-L202) |

Wrapper that returns common.function if using TF1.

    tf_agents.utils.common.function_in_tf1(
        *args, **kwargs
    )

This allows for code that assumes autodeps is available to be written once,
in the same way, for both TF1 and TF2.

#### Usage:

    train = function_in_tf1()(agent.train)
    loss = train(experience)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `*args` | Arguments for common.function. |
| `**kwargs` | Keyword arguments for common.function. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A callable that wraps a function. ||

<br />