Skip to content

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

Closed
@Satyamkhadka

Description

@Satyamkhadka

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])
```

cc @svekars @sekyondaMeta @AlannaBurke

Metadata

Metadata

Assignees

Labels

docathon-h1-2025A label for the docathon in H1 2025easywebsiteIssues related to website rendering

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions