tf_agents.replay_buffers.reverb_replay_buffer.truncate_reshape_rows_by_num_steps
Stay organized with collections
Save and categorize content based on your preferences.
Reshapes tensors in sample
to have shape [rows, num_steps, ...]
.
tf_agents.replay_buffers.reverb_replay_buffer.truncate_reshape_rows_by_num_steps(
sample, num_steps
)
This function takes a structure sample
and for each tensor t
, it truncates
the tensor's outer dimension to be the highest possible multiple of
num_steps
.
This is done by first calculating rows = tf.shape(t[0]) // num_steps
, then
truncating the tensor
to shape t_trunc = t[: (rows * num_steps), ...]
.
For each tensor, it returns tf.reshape(t_trunc, [rows, num_steps, ...])
.
Args |
sample
|
Nest of tensors.
|
num_steps
|
Python integer.
|
Returns |
A next with tensors reshaped to [rows, num_steps, ...] .
|
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."],[],[]]