1,几种方法

Create a source dataset using one of the factory functions like Dataset.from_tensors, Dataset.from_tensor_slices or using objects that read from files like TextLineDataset or TFRecordDataset

2,自数组

ds_tensors = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6])

3,自文件

# Create a CSV file
import tempfile
_, filename = tempfile.mkstemp()

with open(filename, 'w') as f:
f.write("""Line 1
Line 2
Line 3
""")

ds_file = tf.data.TextLineDataset(filename)

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-06-17
  • 2021-11-26
相关资源
相似解决方案