tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批)
生活随笔
收集整理的這篇文章主要介紹了
tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
from python\data\ops\dataset_ops.py
def batch(self, batch_size, drop_remainder=False):"""Combines consecutive elements of this dataset into batches.將此數(shù)據(jù)集的連續(xù)元素合并為批。The tensors in the resulting element will have an additional outerdimension, which will be `batch_size` (or `N % batch_size` for the lastelement if `batch_size` does not divide the number of input elements `N`evenly and `drop_remainder` is `False`). If your program depends on thebatches having the same outer dimension, you should set the `drop_remainder`argument to `True` to prevent the smaller batch from being produced.結(jié)果元素中的張量將具有一個附加的外部尺寸,該尺寸將為`batch_size`(或最后一個元素的`N%batch_size`,如果`batch_size`不能將輸入元素`N`的數(shù)量均勻劃分和`drop_remainder` 是“假”)。 如果您的程序依賴于具有相同外部尺寸的批次,則應(yīng)將drop_remainder參數(shù)設(shè)置為True,以防止產(chǎn)生較小的批次。Args:batch_size: A `tf.int64` scalar `tf.Tensor`, representing the number ofconsecutive elements of this dataset to combine in a single batch.tf.int64標(biāo)量tf.Tensor,表示要在單個批次中合并的此數(shù)據(jù)集的連續(xù)元素數(shù)。drop_remainder: (Optional.) A `tf.bool` scalar `tf.Tensor`, representingwhether the last batch should be dropped in the case its has fewer than`batch_size` elements; the default behavior is not to drop the smallerbatch.tf.bool標(biāo)量tf.Tensor,表示如果最后一個批次的數(shù)量少于`batch_size`個元素,是否應(yīng)刪除最后一個批次; 默認(rèn)行為是不刪除較小的批次。Returns:Dataset: A `Dataset`. 數(shù)據(jù)集:一個“數(shù)據(jù)集”。"""return BatchDataset(self, batch_size, drop_remainder)總結(jié)
以上是生活随笔為你收集整理的tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tensorflow dataset_o
- 下一篇: Intel Realsense pyth