当前位置:网站首页>TF generates (feature, label) set through feature and label, tf.data.Dataset.from_tensor_slices

TF generates (feature, label) set through feature and label, tf.data.Dataset.from_tensor_slices

2022-08-11 07:51:00 phac123

Numpy and Tensor formats can be used to read data with this statement

data = tf.data.Dataset.from_tensor_slices((Enter feature , tag ))

Code

import tensorflow as tffeatures = tf.constant([12, 23, 10, 17])labels = tf.constant([0, 1, 1, 0])dataset = tf.data.Dataset.from_tensor_slices((features, labels))print(dataset)for element in dataset:print(element)

insert image description here

原网站

版权声明
本文为[phac123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110645027632.html