Class can't read its attribute
I following this pytorch tutorial
On the basis of this link I wrote the following code:
import torch
import torchvision
from torch.utils.data import Dataset,DataLoader
import numpy as np
import math
class WineDataset(Dataset):
    def __int__(self):
        xy =np.loadtxt(&quot;wine.csv&quot;,delimiter=',',dtype=np.float32,skiprows=1)
        self.n_samples =xy.shape[0]
        self.x_data = torch.from_numpy(xy[:, 1:])
        self.y_data = torch.from_numpy(xy[:, [0]])
    def __getitem__(self, index):
        return self.x_data[index],self.y_data[index]
    def __len__(self):
        return self.n_samples
# create dataset
dataset = WineDataset()
# get first sample and unpack
first_data = dataset[0]
features, labels = first_data
print(features, labels)

But when I run the code, it gives me following error:
Traceback (most recent call last):
  File &quot;C:\Users\User\PycharmProjects\AI_Project\Dataset_DataLoader.py&quot;, line 19, in &lt;module&gt;
    first_data = dataset.__getitem__(0)
  File &quot;C:\Users\User\PycharmProjects\AI_Project\Dataset_DataLoader.py&quot;, line 13, in __getitem__
    return self.x_data[index],self.y_data[index]
AttributeError: 'WineDataset' object has no attribute 'x_data'

This line is also  written on GitHub:
# create dataset
dataset = WineDataset()

# get first sample and unpack
first_data = dataset[0]
features, labels = first_data
print(features, labels)

Where is the mistake?

Change def __int__(self) to def __init__(self). Right now you have no constructor.
