for e in range(args.epochs):
models['backbone'].train()
models['module'].train()
train_loss = 0.0
for batch_idx, (inputs, targets) in enumerate(trainloader):
inputs, targets = inputs.to(device), targets.to(device)
outputs, features = models['backbone'](inputs)
print(outputs.shape)
print(targets.shape)
target_loss = criterion(outputs, targets)
if args.epochs > args.epochs_loss:
# After args.epochs_loss, stop the gradient from the loss prediction module propagated to the target model.
features[0] = features[0].detach()
features[1] = features[1].detach()
features[2] = features[2].detach()
features[3] = features[3].detach()
features[4] = features[4].detach()
At the end of the last iteration of the data loader, specifically at the loss = criterion(outputs, targets) line, I received the following error “AttributeError: ‘tuple’ object has no attribute ‘log_softmax’”. Is there any way to solve this problem?