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

Method batch

tensorflow/python/data/ops/dataset_ops.py:1070–1091  ·  view source on GitHub ↗

Combines consecutive elements of this dataset into batches. The components of the resulting element will have an additional outer dimension, which will be `batch_size` (or `N % batch_size` for the last element if `batch_size` does not divide the number of input elements `N` evenly a

(self, batch_size, drop_remainder=False)

Source from the content-addressed store, hash-verified

1068 return ShardDataset(self, num_shards, index)
1069
1070 def batch(self, batch_size, drop_remainder=False):
1071 """Combines consecutive elements of this dataset into batches.
1072
1073 The components of the resulting element will have an additional outer
1074 dimension, which will be `batch_size` (or `N % batch_size` for the last
1075 element if `batch_size` does not divide the number of input elements `N`
1076 evenly and `drop_remainder` is `False`). If your program depends on the
1077 batches having the same outer dimension, you should set the `drop_remainder`
1078 argument to `True` to prevent the smaller batch from being produced.
1079
1080 Args:
1081 batch_size: A `tf.int64` scalar `tf.Tensor`, representing the number of
1082 consecutive elements of this dataset to combine in a single batch.
1083 drop_remainder: (Optional.) A `tf.bool` scalar `tf.Tensor`, representing
1084 whether the last batch should be dropped in the case it has fewer than
1085 `batch_size` elements; the default behavior is not to drop the smaller
1086 batch.
1087
1088 Returns:
1089 Dataset: A `Dataset`.
1090 """
1091 return BatchDataset(self, batch_size, drop_remainder)
1092
1093 def padded_batch(self,
1094 batch_size,

Callers 15

build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
build_model_inputFunction · 0.45
mainFunction · 0.45
generate_input_dataFunction · 0.45

Calls 1

BatchDatasetClass · 0.70