tf_agents.utils.example_encoding.get_example_decoder
Stay organized with collections
Save and categorize content based on your preferences.
Get an example decoder function for a nested spec.
tf_agents.utils.example_encoding.get_example_decoder(
example_spec, batched=False, compress_image=False
)
Given a spec, returns an example decoder function. The decoder function parses
string serialized example protos into tensors according to the given spec.
Args |
example_spec
|
list/tuple/nest of ArraySpecs describing a single example.
|
batched
|
Boolean indicating if the decoder will receive batches of
serialized data.
|
compress_image
|
Whether to decompress image. It is assumed that any uint8
tensor of rank 3 with shape (w,h,c) is an image. If the tensor was
compressed in the encoder, it needs to be decompressed.
|
Returns |
Function
</td>
</tr>
<tr>
<td>
`decoder`<a id="decoder"></a>
</td>
<td>
`serialized_proto`
tf.tensor[string]) -> example_spec nest of tensors
|
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.example_encoding.get_example_decoder\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/example_encoding.py#L117-L178) |\n\nGet an example decoder function for a nested spec. \n\n tf_agents.utils.example_encoding.get_example_decoder(\n example_spec, batched=False, compress_image=False\n )\n\nGiven a spec, returns an example decoder function. The decoder function parses\nstring serialized example protos into tensors according to the given spec.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `example_spec` | list/tuple/nest of ArraySpecs describing a single example. |\n| `batched` | Boolean indicating if the decoder will receive batches of serialized data. |\n| `compress_image` | Whether to decompress image. It is assumed that any uint8 tensor of rank 3 with shape (w,h,c) is an image. If the tensor was compressed in the encoder, it needs to be decompressed. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Function \u003cbr /\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e `decoder`\u003ca id=\"decoder\"\u003e\u003c/a\u003e \u003c/td\u003e \u003ctd\u003e `serialized_proto` tf.tensor[string]) -\u003e example_spec nest of tensors \u003cbr /\u003e ||\n\n\u003cbr /\u003e"]]