human
I am working on the file "DL0110EN/2.6.2_multiple_linear_regression_training.ipynb".
The first task is:
<a id="ref0"></a>
<h2 align=center>Make Some Data </h2>

Create a dataset class with two-dimensional features:
Can you write Python code for it?
assistant
#Here is the Python code you requested.

from torch.utils.data import Dataset, DataLoader
class Data2D(Dataset):
    def __init__(self):
            self.x=torch.zeros(20,2)
            self.x[:,0]=torch.arange(-1,1,0.1)
            self.x[:,1]=torch.arange(-1,1,0.1)
            self.w=torch.tensor([ [1.0],[1.0]])
            self.b=1
            self.f=torch.mm(self.x,self.w)+self.b
            
            self.y=self.f+0.1*torch.randn((self.x.shape[0],1))
            self.len=self.x.shape[0]

    def __getitem__(self,index):          
        return self.x[index],self.y[index]
    
    def __len__(self):
        return self.len