If the dataset is a numpy array or tensor then u can simply use: dataset.shape.
It’ll return a tuple with the shapes of the dataset at respective axis/dimensions, the 1st value of the tuple is the length of the dataset.
To get only the length of the dataset, u can use dataset.shape[0].