Hello everyone,
I’m facing a speed up problem. In fact, I’m using DataLoader as a batch generator to train my network. Here is the concerned piece of code:
train_loader  = data.DataLoader(np.concatenate((X,Y), axis=1), batch_size=16, …)
for epoch in range(n_epochs):
for _, da in enumerate(train_loader, 0):
inputs  = torch.tensor(da[:,:-2].numpy())
targets = da[:,-2:]
optimizer.zero_grad()
…
optimizer.step()
I find the execution of this code relatively slow. Do you have any suggestion to improve it? Thank you in advance