tf_agents.utils.common.function_in_tf1
Stay organized with collections
Save and categorize content based on your preferences.
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)
Args |
*args
|
Arguments for common.function.
|
**kwargs
|
Keyword arguments for common.function.
|
Returns |
A callable that wraps a function.
|
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.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.utils.common.function_in_tf1\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/common.py#L160-L202) |\n\nWrapper that returns common.function if using TF1. \n\n tf_agents.utils.common.function_in_tf1(\n *args, **kwargs\n )\n\nThis allows for code that assumes autodeps is available to be written once,\nin the same way, for both TF1 and TF2.\n\n#### Usage:\n\n train = function_in_tf1()(agent.train)\n loss = train(experience)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|----------------------------------------|\n| `*args` | Arguments for common.function. |\n| `**kwargs` | Keyword arguments for common.function. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A callable that wraps a function. ||\n\n\u003cbr /\u003e"]]