From dfbcbd53d637932197f699dcddfbfda18e65f5cc Mon Sep 17 00:00:00 2001 From: "Runtian (Rachel) Li" <115634891+Rachel0619@users.noreply.github.com> Date: Wed, 4 Jun 2025 07:16:09 +0000 Subject: [PATCH 1/3] Fix #2814: Remove Markdown backticks, use RST syntax for code block --- beginner_source/introyt/introyt1_tutorial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index 74675070708..cc5c534e499 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -304,7 +304,8 @@ def num_flat_features(self, x): # standard deviations (second tuple) of the rgb values of the images in # the dataset. You can calculate these values yourself by running these # few lines of code: -# ``` +# :: +# # from torch.utils.data import ConcatDataset # transform = transforms.Compose([transforms.ToTensor()]) # trainset = torchvision.datasets.CIFAR10(root='./data', train=True, @@ -317,8 +318,7 @@ def num_flat_features(self, x): # #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]) -# -# ``` +# # # There are many more transforms available, including cropping, centering, # rotation, and reflection. From 588184071660a9711322cc73311803bc1e3463e0 Mon Sep 17 00:00:00 2001 From: "Runtian (Rachel) Li" <115634891+Rachel0619@users.noreply.github.com> Date: Wed, 4 Jun 2025 21:16:25 +0000 Subject: [PATCH 2/3] Fix code block indentation by removing extra spaces before :: --- beginner_source/introyt/introyt1_tutorial.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index cc5c534e499..c87531bddbc 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -304,20 +304,20 @@ def num_flat_features(self, x): # standard deviations (second tuple) of the rgb values of the images in # the dataset. You can calculate these values yourself by running these # few lines of code: -# :: # -# from torch.utils.data import ConcatDataset -# transform = transforms.Compose([transforms.ToTensor()]) -# trainset = torchvision.datasets.CIFAR10(root='./data', train=True, +# :: +# 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])]) +# # 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]) +# # 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]) # # # There are many more transforms available, including cropping, centering, From 3ad621f3dbbc99b2f0bd30dc742e98752b0eb9ae Mon Sep 17 00:00:00 2001 From: "Runtian (Rachel) Li" <115634891+Rachel0619@users.noreply.github.com> Date: Thu, 5 Jun 2025 02:13:27 +0000 Subject: [PATCH 3/3] Fixes #2814: Fix RST code block indentation --- beginner_source/introyt/introyt1_tutorial.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index c87531bddbc..c01befb40cc 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -303,9 +303,8 @@ def num_flat_features(self, x): # The values passed to the transform are the means (first tuple) and the # standard deviations (second tuple) of the rgb values of the images in # the dataset. You can calculate these values yourself by running these -# few lines of code: +# few lines of code:: # -# :: # from torch.utils.data import ConcatDataset # transform = transforms.Compose([transforms.ToTensor()]) # trainset = torchvision.datasets.CIFAR10(root='./data', train=True,