Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Data Science by (17.6k points)

Like pandas_df.shape is there any way for tensorflow.data.Dataset? Thanks.

1 Answer

0 votes
by (41.4k points)

If you want to retrieve shapes you can use Dataset._tensors attribute for it as depicted in the below code:

import tensorflow as tf

def dataset_shapes(dataset):

    try:

        return [x.get_shape().as_list() for x in dataset._tensors]

    except TypeError:

        return dataset._tensors.get_shape().as_list()

If you wish to know TensorFlow visit this TensorFlow Tutorial.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.7k users

Browse Categories

...