Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - <title> TypeError when using len(train_dataloader.dataset) in Quickstart PyTorch tutorial #3226

Open
hoangziet opened this issue Jan 10, 2025 · 2 comments
Labels
bug core Tutorials of any level of difficulty related to the core pytorch functionality intro

Comments

@hoangziet
Copy link

hoangziet commented Jan 10, 2025

Add Link

https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html

Describe the bug

When using len(train_dataloader.dataset) to get the dataset size in the Google Colab notebook from Quickstart PyTorch, I encountered the following error:

TypeError: 'FashionMNIST' object is not callable

I think we can use another way to take the size we need:

train_dataloader.dataset.data.shape[0]
```

### Describe your environment

Google Colab
Torch version: 2.5.1+cu121

cc @subramen @albanD @jbschlosser
@hoangziet hoangziet added the bug label Jan 10, 2025
@hoangziet hoangziet changed the title [BUG] - <title> **TypeError** when using `len(train_dataloader.dataset) in Quickstart PyTorch tutorial [BUG] - <title> TypeError when using len(train_dataloader.dataset) in Quickstart PyTorch tutorial Jan 10, 2025
@svekars svekars added intro core Tutorials of any level of difficulty related to the core pytorch functionality labels Jan 10, 2025
@svekars
Copy link
Contributor

svekars commented Jan 13, 2025

Both methods seem to work for me and return the same thing. Not sure if anything needs to be changed here cc: @albanD

@albanD
Copy link
Contributor

albanD commented Jan 13, 2025

Yes all seems to work for me as well.
@hoangziet are you sure you didn't overwrite the variable or something like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug core Tutorials of any level of difficulty related to the core pytorch functionality intro
Projects
None yet
Development

No branches or pull requests

3 participants