MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / maybe_batch_join

Function maybe_batch_join

tensorflow/python/training/input.py:1195–1244  ·  view source on GitHub ↗

Runs a list of tensors to conditionally fill a queue to create batches. See docstring in `batch_join` for more details. Args: tensors_list: A list of tuples or dictionaries of tensors to enqueue. keep_input: A `bool` Tensor. This tensor controls whether the input is added to the

(tensors_list, keep_input, batch_size, capacity=32,
                     enqueue_many=False, shapes=None, dynamic_pad=False,
                     allow_smaller_final_batch=False, shared_name=None,
                     name=None)

Source from the content-addressed store, hash-verified

1193 "`tf.data.Dataset.interleave(...).filter(...).batch(batch_size)` (or "
1194 "`padded_batch(...)` if `dynamic_pad=True`).")
1195def maybe_batch_join(tensors_list, keep_input, batch_size, capacity=32,
1196 enqueue_many=False, shapes=None, dynamic_pad=False,
1197 allow_smaller_final_batch=False, shared_name=None,
1198 name=None):
1199 """Runs a list of tensors to conditionally fill a queue to create batches.
1200
1201 See docstring in `batch_join` for more details.
1202
1203 Args:
1204 tensors_list: A list of tuples or dictionaries of tensors to enqueue.
1205 keep_input: A `bool` Tensor. This tensor controls whether the input is
1206 added to the queue or not. If it is a scalar and evaluates `True`, then
1207 `tensors` are all added to the queue. If it is a vector and `enqueue_many`
1208 is `True`, then each example is added to the queue only if the
1209 corresponding value in `keep_input` is `True`. This tensor essentially
1210 acts as a filtering mechanism.
1211 batch_size: An integer. The new batch size pulled from the queue.
1212 capacity: An integer. The maximum number of elements in the queue.
1213 enqueue_many: Whether each tensor in `tensor_list_list` is a single
1214 example.
1215 shapes: (Optional) The shapes for each example. Defaults to the
1216 inferred shapes for `tensor_list_list[i]`.
1217 dynamic_pad: Boolean. Allow variable dimensions in input shapes.
1218 The given dimensions are padded upon dequeue so that tensors within a
1219 batch have the same shapes.
1220 allow_smaller_final_batch: (Optional) Boolean. If `True`, allow the final
1221 batch to be smaller if there are insufficient items left in the queue.
1222 shared_name: (Optional) If set, this queue will be shared under the given
1223 name across multiple sessions.
1224 name: (Optional) A name for the operations.
1225
1226 Returns:
1227 A list or dictionary of tensors with the same number and types as
1228 `tensors_list[i]`.
1229
1230 Raises:
1231 ValueError: If the `shapes` are not specified, and cannot be
1232 inferred from the elements of `tensor_list_list`.
1233 """
1234 return _batch_join(
1235 tensors_list,
1236 batch_size,
1237 keep_input,
1238 capacity=capacity,
1239 enqueue_many=enqueue_many,
1240 shapes=shapes,
1241 dynamic_pad=dynamic_pad,
1242 allow_smaller_final_batch=allow_smaller_final_batch,
1243 shared_name=shared_name,
1244 name=name)
1245
1246
1247@tf_export(v1=["train.shuffle_batch"])

Callers

nothing calls this directly

Calls 1

_batch_joinFunction · 0.85

Tested by

no test coverage detected