Difference between torch.Size([64]) and (64,)?
I created a Pytorch dataset class to store 64 lines of text. The file only has text, no label so I artificially generated an index list y (just to follow along with a tutorial https://medium.com/swlh/how-to-use-pytorch-dataloaders-to-work-with-enormously-large-text-files-bbd672e955a0#4fe0). After I created the dataset object and wrapped it around a dataloader, y.shape returned torch.Size([64]) while the tutorial said it would return (64,). (torch version is 1.8.1. torchvision version is 0.9.1. Python is 3.7.10.)
Is there a difference between torch.Size([64]) and (64,)? Thank you.
##### IMPORT PACKAGES #####
import nltk 
import string
from nltk import word_tokenize
from torch.utils.data import IterableDataset, DataLoader, Dataset

##### DEFINE CLASS #####
class CustomDataset(Dataset):
    # A Pytorch Dataset class to store text
    def __init__(self, filename):
        '''
        Input: filename (Each line is a string.)
        Output: member variable X (list of unprocessed strings) 
                member variable y (index list of X)
        '''
        # Open file and store contents in list
        with open(filename) as f:
            lines = f.read().split('\n')
        X, y = [], []
        i = 0
        for line in lines: 
          X.append(line)  
          y.append(i)
          i +=1
        # Store in member variables
        self.X = X 
        self.y = y 

     def preprocess(self, text): 
        '''
        Input: a string from X
        Output: a preprocessed string
        '''
        text_pp = text.lower() # lower case   
        return text_pp
    
    def __len__(self):
        return len(self.y)

    def __getitem__(self, index):
       '''
       Input: a number (within range of X's indices)
       Output: string at specified index
       '''
       return self.preprocess(self.X[index]), self.y[index]


##### CREATE OBJECT #####
dataset = CustomDataset('micro.txt')
dataloader = DataLoader(dataset, batch_size = 64, num_workers = 2)
for X, y in dataloader:
  print(y.shape) # torch.Size([64]) [Is it same as (64,)?]) 


In a way they are same thing. You are printing shape of a one dimensional tensor. Shape written in tutorial is shape format of one dimensional numpy array.
If shape of y is printed after converting it into numpy array, mentioned format will appear. You can see both format with following code.
print((torch.rand(64)).shape)  # torch.Size([64])
print((torch.rand(64)).numpy().shape)  # (64,)

