TensorFlow Dataset
Tensorflow Dataset
2023-09-11 14:14:58 时间
TF官方文档地址:https://tensorflow.google.cn/guide/datasets
tensorflow dataset.shuffle dataset.batch dataset.repeat 理解 注意点
【Eager & Graph Execution】EagerTensor与Tensor,tf.function / tf.py_function / tf.numpy_function
https://tensorflow.google.cn/datasets/
Tensorflow Dataset API详解
tensorflow之dataset详解
import numpy as np import tensorflow as tf np.random.seed(0) x = np.random.sample((11,2)) # make a dataset from a numpy array print(x) dataset = tf.data.Dataset.from_tensor_slices(x) dataset = dataset.shuffle(2) # 将数据打乱,数值越大,混乱程度越大 dataset = dataset.batch(4) # 按照顺序取出4行数据,最后一次输出可能小于batch dataset = dataset.repeat() # 数据集重复了指定次数 # repeat()在batch操作输出完毕后再执行,若在之前,相当于先把整个数据集复制两次 #为了配合输出次数,一般默认repeat()空 # create the iterator iter = dataset.make_one_shot_iterator() el = iter.get_next() with tf.Session() as sess: for i in range(6): value = sess.run(el) print(value)
相关文章
- DL框架之TensorFlow:深度学习框架TensorFlow Core(低级别TensorFlow API)的简介、安装、使用方法之详细攻略
- 成功解决AttributeError: module 'tensorflow.python.keras' has no attribute 'Model'
- 成功解决AttributeError: module 'tensorflow.nn.rnn_cell' has no attribute 'linear'
- verbose=False(TensorFlow)
- tensorflow 实现逻辑回归——原以为TensorFlow不擅长做线性回归或者逻辑回归,原来是这么简单哇!
- 【TensorFlow】tf.nn.softmax_cross_entropy_with_logits的用法
- 【Python-Tensorflow】tf.data.Dataset的解析与使用
- tensorflow 制定 CPU 或GPU