• Tensorflow Dataset API


    ------------恢复内容开始------------

    The tf.data.Dataset API supports writing descriptive and efficient input pipelines. Dataset usage follows a common pattern:

    1. Create a source dataset from your input data.
    2. Apply dataset transformations to preprocess the data.
    3. Iterate over the dataset and process the elements.

    ------------恢复内容结束------------

    Methods:

    1. batch 

    1 batch(
    2     batch_size, drop_remainder=False
    3 )

    Combines consecutive elements of this dataset into batches.

    把当前的dataset分割成连续的batches

    drop_remainder = true时把最后一组那些剩下的,除不尽的元素舍弃

    1 dataset = tf.data.Dataset.range(8)
    2 dataset = dataset.batch(3)
    3 list(dataset.as_numpy_iterator())

    输出:Array[[0, 1, 2], [3, 4, 5], [6, 7]]

    1 dataset = tf.data.Dataset.range(8)
    2 dataset = dataset.batch(3, drop_remainder=True)
    3 list(dataset.as_numpy_iterator())

    输出:Array[[0, 1, 2], [3, 4, 5]]

    never give up
  • 相关阅读:
    lnmp环境搭建
    Git常用命令
    博客园写随笔环境搭建
    Win常用软件
    Docker环境搭建
    ESP-8266 RTOS 环境搭建
    查看Linux信息
    博客园markdown语法
    Java后台技术(TDDL)
    Java后台技术(Dubbo入门)
  • 原文地址:https://www.cnblogs.com/noncoretime/p/13848606.html
Copyright © 2020-2023  润新知