zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    stm32 usart 串口
    stm32 usart 串口
    stm32 PWM
    stm32 PWM
    stm32 定时器 通用定时器
    stm32 定时器 通用定时器
    stm32 外部中断
    linux+jre+apache+mysql+tomcat调优
    Cent OS服务器配置(JDK+Tomcat+MySQL)
    linux---文本编辑vi
  • 原文地址:https://www.cnblogs.com/noncoretime/p/13848606.html
Copyright © 2011-2022 走看看