from_tensors合并输入并返回具有单个元素的数据集:
t = tf.constant([[1, 2], [3, 4]])ds = tf.data.Dataset.from_tensors(t) # [[1, 2], [3, 4]]
from_tensor_slices为输入张量的每一行创建一个具有单独元素的数据集:
t = tf.constant([[1, 2], [3, 4]])ds = tf.data.Dataset.from_tensor_slices(t) # [1, 2], [3, 4]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)