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

Minor style bug: remove backticks in the section of code #2814

Open
Satyamkhadka opened this issue Mar 28, 2024 · 0 comments
Open

Minor style bug: remove backticks in the section of code #2814

Satyamkhadka opened this issue Mar 28, 2024 · 0 comments

Comments

@Satyamkhadka
Copy link
Contributor

On this page => https://pytorch.org/tutorials/beginner/introyt/introyt1_tutorial.html
in Datasets and Dataloaders section,

[Expected Result]

from torch.utils.data 
import ConcatDataset 
transform = transforms.Compose([transforms.ToTensor()]) 
trainset = torchvision.datasets.CIFAR10(root=’./data’, train=True,download=True, transform=transform)

#stack all train images together into a tensor of shape 
#(50000, 3, 32, 32) 
x = torch.stack([sample[0] for sample in ConcatDataset([trainset])])

#get the mean of each channel 
mean = torch.mean(x, dim=(0,2,3)) #tensor([0.4914, 0.4822, 0.4465]) 
std = torch.std(x, dim=(0,2,3)) #tensor([0.2470, 0.2435, 0.2616])

[ACTUAL RESULT]
```
from torch.utils.data
import ConcatDataset
transform = transforms.Compose([transforms.ToTensor()])
trainset = torchvision.datasets.CIFAR10(root=’./data’, train=True,download=True, transform=transform)

#stack all train images together into a tensor of shape
#(50000, 3, 32, 32)
x = torch.stack([sample[0] for sample in ConcatDataset([trainset])])

#get the mean of each channel
mean = torch.mean(x, dim=(0,2,3)) #tensor([0.4914, 0.4822, 0.4465])
std = torch.std(x, dim=(0,2,3)) #tensor([0.2470, 0.2435, 0.2616])
```

Satyamkhadka added a commit to Satyamkhadka/tutorials that referenced this issue Mar 28, 2024
removed commented code block and backticks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant