From 57f5230abd85e4bf8ab07f3089af55c7942f053b Mon Sep 17 00:00:00 2001 From: Alex Hex Date: Tue, 23 Aug 2022 15:39:02 +0800 Subject: [PATCH] Feature remove code (#50) Remove redundant code 'net.train()' --- README.md | 2 ++ demo_MNIST_AMP_train_with_single_gpu.py | 2 -- demo_MNIST_train.py | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5b2a76c..4c4a4df 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ to **Non-Local_pytorch_0.3.1/**. 16. Verify that the code works well in **pytorch 1.12.0**. +17. Remove redundant the code `net.train()` in training code files. + ## Todo - Experiments on Charades dataset. - Experiments on COCO dataset. diff --git a/demo_MNIST_AMP_train_with_single_gpu.py b/demo_MNIST_AMP_train_with_single_gpu.py index 62760ec..4007708 100644 --- a/demo_MNIST_AMP_train_with_single_gpu.py +++ b/demo_MNIST_AMP_train_with_single_gpu.py @@ -82,8 +82,6 @@ total_acc += acc total_sample += img_batch.size(0) - net.train() - mean_acc = total_acc.item() * 1.0 / total_sample mean_loss = sum(total_loss) / total_loss.__len__() diff --git a/demo_MNIST_train.py b/demo_MNIST_train.py index 1af26f0..9ab5a59 100644 --- a/demo_MNIST_train.py +++ b/demo_MNIST_train.py @@ -67,8 +67,6 @@ total_acc += acc total_sample += img_batch.size(0) - net.train() - mean_acc = total_acc.item() * 1.0 / total_sample mean_loss = sum(total_loss) / total_loss.__len__()