Hello everyone, I’m training my custom data recently, but the loss only update at the first time, and I really don’t know where the problem is
here is the code
for epoch in range(cfg['epoch']):
		for phase in ['train', 'valid']:
			if phase == 'train':
				net.train()
			else:
				net.eval()

			running_loss, running_acc = 0.0, 0.0

			for i, (point, ans) in enumerate(all_loader[phase]):
				if cfg['use_cuda'] and torch.cuda.is_available():
					point = point.cuda()
					ans = ans.cuda()

				optimizer.zero_grad()
				with torch.set_grad_enabled(phase == 'train'):
					out = net(point.float())
					_, predicted = torch.max(out, 1)
					loss = criterion(out, ans.long())

					if phase == 'train':
						loss.backward()
						optimizer.step()

				running_loss += loss.item()
				running_acc += (predicted == ans.long()).sum().item()

the result is
train, Epochs [1/5], Loss: 0.2585
valid, Epochs [1/5], Loss: 0.2465
==================================================
train, Epochs [2/5], Loss: 0.2573
valid, Epochs [2/5], Loss: 0.2465
==================================================
train, Epochs [3/5], Loss: 0.2573
valid, Epochs [3/5], Loss: 0.2465
==================================================
train, Epochs [4/5], Loss: 0.2573
valid, Epochs [4/5], Loss: 0.2465
==================================================
train, Epochs [5/5], Loss: 0.2573
valid, Epochs [5/5], Loss: 0.2465
==================================================