I have started to learn tensorflow to increase my machine learning skills. In tensorflow understanding pipeline what is use of take(1) in
for feature_batch, label_batch in train_ds.take(1)
I have started to learn tensorflow to increase my machine learning skills. In tensorflow understanding pipeline what is use of take(1) in
for feature_batch, label_batch in train_ds.take(1)
It essentially "takes" that many elements from the dataset. I'm guessing that in this specific example, someone wanted to show what the data looked like and took only one element. If you don't use take, all elements will eventually be fetched:
Now, if you take one element only:
From the documentation of
tf.data.Dataset.take
: