I load features and labels from my training dataset. Both of them are originally numpy arrays, but I change them to the torch tensor using torch.from _numpy(features.copy()) and torch.tensor(labels.astype(np.bool)).
And I notice that torch.autograd.Variable is something like placeholder in tensorflow.
When I train my network, first I tried
features = features.cuda() labels = labels.cuda() outputs = Config.MODEL(features) loss = Config.LOSS(outputs, labels) Then I tried
features = features.cuda() labels = labels.cuda() input_var = Variable(features) target_var = Variable(labels) outputs = Config.MODEL(input_var) loss = Config.LOSS(outputs, target_var) Both blocks succeed in activating training, but I worried that there might be trivial difference.