Ask Your Question
2

What are the varying shapes in the Tensorflow Dataset from_generator?

asked 2022-04-19 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-02-27 22:00:00 +0000

qstack gravatar image

The shapes of the dataset returned by from_generator depend on the shapes of the elements generated by the generator function. Each element must have the same nested structure and shapes, and the resulting dataset will have the same structure but with batch dimension added to each shape. For example, if the generator function returns a tuple of two tensors with shapes (1, 32, 32, 3) and (1, 10), respectively, the resulting dataset will have a nested structure of (TensorShape([None, 32, 32, 3]), TensorShape([None, 10])), where the None dimension represents the batch size.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-19 11:00:00 +0000

Seen: 12 times

Last updated: Feb 27 '23