human
I am working on the file "DL0110EN/2.3.2mini-batch gradient descent_v2.ipynb".
The first task is:
Create <code>Data</code> class
Can you write Python code for it?
assistant
#Here is the Python code you requested.

# Create class Data

class Data(Dataset):
    
    # Constructor
    def __init__(self):
        self.x = torch.arange(-3, 3, 0.1).view(-1, 1)
        self.y = 1 * X - 1
        self.len = self.x.shape[0]
        
    # Getter
    def __getitem__(self, index):    
        return self.x[index], self.y[index]
    
    # Get length
    def __len__(self):
        return self.len