tf_agents.policies.async_policy_saver.AsyncPolicySaver
Stay organized with collections
Save and categorize content based on your preferences.
Triggers policy_saver
save calls in a separate thread asynchronously.
tf_agents.policies.async_policy_saver.AsyncPolicySaver(
policy_saver: tf_agents.policies.PolicySaver
)
Methods
close
View source
close()
Blocks until there is no saving happening and kills the save_thread.
flush
View source
flush()
Blocks until there is no saving happening.
save
View source
save(
export_dir: Text, blocking: bool = False
)
Triggers an async save of the policy to the given export_dir
.
Only one save can be triggered at a time. If save
or save_checkpoint
are called while another save of either kind is still ongoing the saving is
skipped.
If blocking is set then the call will block until any ongoing saves finish,
and then a new save will be made before returning.
Args |
export_dir
|
Directory path for the saved_model of the policy.
|
blocking
|
If True the call to save will block until a save can be
performed and finished. If a save was ongoing it will wait for that to
finish, and then do a blocking save before returning.
|
save_checkpoint
View source
save_checkpoint(
export_dir: Text, blocking: bool = False
)
Triggers an async save of the policy checkpoint.
Only one save can be triggered at a time. If save
or save_checkpoint
are called while another save of either kind is still ongoing the saving is
skipped.
If blocking is set then the call will block until any ongoing saves finish,
and then a new save will be made before returning.
Args |
export_dir
|
Directory path for the checkpoint of the policy.
|
blocking
|
If True the call to save will block until a save can be
performed and finished. If a save was ongoing it will wait for that to
finish, and then do a blocking save before returning.
|
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.
[[["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."],[],[],null,["# tf_agents.policies.async_policy_saver.AsyncPolicySaver\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/policies/async_policy_saver.py#L24-L151) |\n\nTriggers `policy_saver` save calls in a separate thread asynchronously. \n\n tf_agents.policies.async_policy_saver.AsyncPolicySaver(\n policy_saver: ../../../tf_agents/policies/PolicySaver\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|-----------------------------------------------------------------------------------------|\n| `policy_saver` | An instance of a [`policy_saver.PolicySaver`](../../../tf_agents/policies/PolicySaver). |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `close`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/policies/async_policy_saver.py#L139-L147) \n\n close()\n\nBlocks until there is no saving happening and kills the save_thread.\n\n### `flush`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/policies/async_policy_saver.py#L132-L137) \n\n flush()\n\nBlocks until there is no saving happening.\n\n### `save`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/policies/async_policy_saver.py#L71-L87) \n\n save(\n export_dir: Text, blocking: bool = False\n )\n\nTriggers an async save of the policy to the given `export_dir`.\n\nOnly one save can be triggered at a time. If `save` or `save_checkpoint`\nare called while another save of either kind is still ongoing the saving is\nskipped.\n\nIf blocking is set then the call will block until any ongoing saves finish,\nand then a new save will be made before returning.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `export_dir` | Directory path for the `saved_model` of the policy. |\n| `blocking` | If True the call to save will block until a save can be performed and finished. If a save was ongoing it will wait for that to finish, and then do a blocking save before returning. |\n\n\u003cbr /\u003e\n\n### `save_checkpoint`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/policies/async_policy_saver.py#L89-L105) \n\n save_checkpoint(\n export_dir: Text, blocking: bool = False\n )\n\nTriggers an async save of the policy checkpoint.\n\nOnly one save can be triggered at a time. If `save` or `save_checkpoint`\nare called while another save of either kind is still ongoing the saving is\nskipped.\n\nIf blocking is set then the call will block until any ongoing saves finish,\nand then a new save will be made before returning.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `export_dir` | Directory path for the checkpoint of the policy. |\n| `blocking` | If True the call to save will block until a save can be performed and finished. If a save was ongoing it will wait for that to finish, and then do a blocking save before returning. |\n\n\u003cbr /\u003e"]]