Hi, I’m trying to get a feel for pytorch as a relatively new programmer using the iris dataset but I have an issue. I was running a few tests on training speed regarding CPU/GPU and num_workers and I get some interesting results.
As you can see it seems faster to run on the CPU with no subprocesses which shouldn’t be the case. Can someone explain why or if my implementation is wrong?
Here’s my code/model:
This file has been truncated.
import pandas as pd
from torch.utils.data import Dataset, DataLoader
import numpy as np
import matplotlib.pyplot as plt
device = torch.device('cuda')
xy = pd.read_csv('data/iris.data', header=None)
xy = xy.astype('category')
self.x = xy.iloc[:, :4].values
self.x_mu = np.mean(self.x, axis=0)
self.x_std = np.std(self.x, axis=0)
self.x = torch.from_numpy((self.x - self.x_mu) / self.x_std)
self.y = torch.from_numpy(np.array(xy.cat.codes, dtype='int64'))