slavavs
(slavavs)
#1
```
class NetDataset(Dataset):
def __init__(self):
xy = np.loadtxt('data_2d.txt', delimiter=';', dtype=np.float32)
self.len = xy.shape[0]
self.x_data = torch.from_numpy(xy[:, 0:-1])
self.y_data = torch.from_numpy(xy[:, [-1]])
def __getitem__(self, index):
return self.x_data[index], self.y_data[index]
def __len__(self):
return self.len
```

`self.x_data = torch.from_numpy(xy[:, 0:-1])`

it gives me the following view [0.1 0.4 0.5 0.2 0.8 0.5]

How can i get this [[0.1 0.4 0.5][0.2 0.8 0.5]]?

albanD
(Alban D)
#2
Hi,

What is `xy[:, 0:-1]`

supposed to do?

Also `xy[:, [-1]]`

?

slavavs
(slavavs)
#3
```
dataset = NetDataset()
train_loader = DataLoader(dataset=dataset, batch_size=128, shuffle=True)
```

…

```
for i, (inputs, labels) in enumerate(train_loader):
y_pred = model(inputs)
loss = criterion(y_pred, labels)
```

slavavs
(slavavs)
#4
I am currently using nn.linear. I want to use nn.gru [[0.1 0.4 0.5][0.2 0.8 0.5]] - the sequence is 2

albanD
(Alban D)
#5
Sorry, what I meant was,

What do you expect `xy`

to be here?

And what do you expect `xy[:, 0:-1]`

to give you?

I am not familiar with such notation.