Using the tf.data.Dataset.from_tensor_slices()
method, we can get fragments of an array as objects using tf.data.Dataset.from_tensor_slices ( )
.
Syntax:
tf.data.Dataset.from_tensor_slices (list)
Return : Return the objects of sliced elements.
Example # 1:
In this example, we can see that with tf.data.Dataset.from_tensor_slices ()
we can get fragments of a list or array.
|
Output:
1
2
3
4
5
Example # 2:
|
Output:
[5, 10]
[3, 6]