日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批)

發布時間:2025/3/20 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

from python\data\ops\dataset_ops.py

def batch(self, batch_size, drop_remainder=False):"""Combines consecutive elements of this dataset into batches.將此數據集的連續元素合并為批。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.結果元素中的張量將具有一個附加的外部尺寸,該尺寸將為`batch_size`(或最后一個元素的`N%batch_size`,如果`batch_size`不能將輸入元素`N`的數量均勻劃分和`drop_remainder` 是“假”)。 如果您的程序依賴于具有相同外部尺寸的批次,則應將drop_remainder參數設置為True,以防止產生較小的批次。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標量tf.Tensor,表示要在單個批次中合并的此數據集的連續元素數。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標量tf.Tensor,表示如果最后一個批次的數量少于`batch_size`個元素,是否應刪除最后一個批次; 默認行為是不刪除較小的批次。Returns:Dataset: A `Dataset`. 數據集:一個“數據集”。"""return BatchDataset(self, batch_size, drop_remainder)

總結

以上是生活随笔為你收集整理的tensorflow dataset_ops batch()方法 (将此数据集的连续元素合并为批)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。