Hi,
I saw so many methods the training/validation part of a CNN and here is mine actually :
model.train()
for e in range(epoch):
    train_sum_loss=0.0
    validation_sum_loss=0.0
    for inputs, labels in train_loader:
        inputs = inputs.to(device)
        labels = labels.to(device)
        optimizer.zero_grad()
        outputs = model.forward(inputs)
        batch_loss = loss(outputs.squeeze(),labels)
        batch_loss.backward()
        optimizer.step()
        train_sum_loss += batch_loss.item()

    model.eval()
    for inputs, labels in validation_loader:
        inputs = inputs.to(device)
        labels = labels.to(device)
        outputs = model.forward(inputs)
        batch_loss = loss(outputs.squeeze(),labels)
        validation_sum_loss += batch_loss.item()

Results seems good, the network converge, no overfitting.
But if I put the model.train() just before the for training loop (like the validation loop), the NN overfit really fastly.
Which one of these methods is the good one ? On which result I can work ?
Thanks for helping.