UnboundLocalError: local variable 'loss' referenced before assignment
Opened this issue · 0 comments
hello,
i trying to traong a netwrk with the following
for i, (inputs, target) in tqdm(enumerate(train_iter)): # training loop (changed "label" to "target")
output, count = decolle_assistant.train(inputs, target) # corrected "label" to "target"
test_iter = iter(test_loader)
for i, (inputs, target) in tqdm(enumerate(test_iter)): # testing loop (changed "label" to "target")
output, count = decolle_assistant.test(inputs, target) # corrected "label" to "target"
but always get the error
--> 212 += loss.cpu().data.item() * readout.cpu().shape[0]
213 if self.classifier is not None: # classification
214 self.stats.testing.correct_samples += torch.sum(
215 self.classifier(readout) == target_idx
216 ).cpu().data.item()
UnboundLocalError: local variable 'loss' referenced before assignment
Please, I appreciate your help .
bahgat