A table that can store Tensors or nested Tensors.
tf_agents.replay_buffers.table.Table(
tensor_spec, capacity, scope='Table'
)
Args |
tensor_spec
|
A nest of TensorSpec representing each value that can be
stored in the table.
|
capacity
|
Maximum number of values the table can store.
|
scope
|
Variable scope for the Table.
|
Raises |
ValueError
|
If the names in tensor_spec are empty or not unique.
|
Methods
read
View source
read(
rows, slots=None
)
Returns values for the given rows.
Args |
rows
|
A scalar/list/tensor of location(s) to read values from. If rows is
a scalar, a single value is returned without a batch dimension. If rows
is a list of integers or a rank-1 int Tensor a batch of values will be
returned with each Tensor having an extra first dimension equal to the
length of rows.
|
slots
|
Optional list/tuple/nest of slots to read from. If None, all
tensors at the given rows are retrieved and the return value has the
same structure as the tensor_spec. Otherwise, only tensors with names
matching the slots are retrieved, and the return value has the same
structure as slots.
|
Returns |
Values at given rows.
|
write
View source
write(
rows, values, slots=None
)
Returns ops for writing values at the given rows.
Args |
rows
|
A scalar/list/tensor of location(s) to write values at.
|
values
|
A nest of Tensors to write. If rows has more than one element,
values can have an extra first dimension representing the batch size.
Values must have the same structure as the tensor_spec of this class if
slots is None, otherwise it must have the same structure as slots .
|
slots
|
Optional list/tuple/nest of slots to write. If None, all tensors in
the table are updated. Otherwise, only tensors with names matching the
slots are updated.
|
Returns |
Ops for writing values at rows.
|