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
  • 相关阅读:
    Linux目录图解
    Linux-Monitor-Tools
    常用系统及工具下载
    vim 编辑器常规使用
    Win10 安装.NET framework 3.5
    Apache 2.4.6 新增虚拟目录
    html5
    CentOS 7 修改ssh端口
    CentOS7 设置密码复杂度
    CentOS 7安装 hping
  • 原文地址:https://www.cnblogs.com/noncoretime/p/13848606.html
Copyright © 2011-2022 走看看