Dataset.batch() output shape

577 views
Skip to first unread message

Harald Husum

unread,
Aug 23, 2018, 5:34:37 AM8/23/18
to TensorFlow Developers
It makes sense that tf.data.Dataset.batch(drop_remainder=False).output_shape is None in the batch dimension, but is see no good reason why this should be the case for drop_remainder=True. Is this a well deliberated design choice, or just heritage from the time that argument didn't exist?

Jiri Simsa

unread,
Aug 26, 2018, 1:15:12 PM8/26/18
to harald...@gmail.com, devel...@tensorflow.org
Hello Harald,

This mailing list is meant for discussions pertinent to TensorFlow development and the right channel for questions like yours is either GitHub issue (if you believe this is a bug) or StackOverflow (for general TensorFlow questions).

Having said that, the output shape of the batch dataset is determined at graph construction time and if at that point the drop remainder argument evaluates to true, then the first dimension output shape should indeed be equivalent to the batch size (implemented here and tested here). If however, the drop remainder argument is a tensor itself, then its value is not known at graph construction time and the first dimension of the output shape will be unknown. 

If you would like to follow up, please create either a GitHub issue or StackOverflow question and reference it in your response.

Best,

On Thu, Aug 23, 2018 at 2:34 AM Harald Husum <harald...@gmail.com> wrote:
It makes sense that tf.data.Dataset.batch(drop_remainder=False).output_shape is None in the batch dimension, but is see no good reason why this should be the case for drop_remainder=True. Is this a well deliberated design choice, or just heritage from the time that argument didn't exist?

--
You received this message because you are subscribed to the Google Groups "TensorFlow Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/developers/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/developers/5197432f-d49d-4605-a8c7-7cdd291a213c%40tensorflow.org.
Reply all
Reply to author
Forward
0 new messages