From 14daa4aec558fc7554d07a40a14b52a39d552cb8 Mon Sep 17 00:00:00 2001 From: Thomas Churchman Date: Fri, 17 Apr 2020 21:25:36 +0200 Subject: [PATCH] Explicitly delete device-converted tensors. Fixes https://github.com/dianchen96/LearningByCheating/issues/4. --- training/train_birdview.py | 3 +++ training/train_image_phase0.py | 3 +++ training/train_image_phase1.py | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/training/train_birdview.py b/training/train_birdview.py index 7853a563..e112f129 100644 --- a/training/train_birdview.py +++ b/training/train_birdview.py @@ -148,6 +148,9 @@ def train_or_eval(criterion, net, data, optim, is_train, config, is_first_epoch) tick = time.time() + del birdview, location, command, speed + del pred_location, loss, loss_mean + if is_first_epoch and i == 10: iterator_tqdm.close() break diff --git a/training/train_image_phase0.py b/training/train_image_phase0.py index f6929de4..4f7cc1a3 100644 --- a/training/train_image_phase0.py +++ b/training/train_image_phase0.py @@ -204,6 +204,9 @@ def train_or_eval(coord_converter, criterion, net, teacher_net, data, optim, is_ tick = time.time() + del rgb_image, birdview, location, command, speed + del _teac_location, _pred_location, pred_location, teac_location, loss, loss_mean + if is_first_epoch and i == 10: iterator_tqdm.close() break diff --git a/training/train_image_phase1.py b/training/train_image_phase1.py index 14d299b2..56a1a52a 100644 --- a/training/train_image_phase1.py +++ b/training/train_image_phase1.py @@ -224,6 +224,10 @@ def train_or_eval(coord_converter, criterion, net, teacher_net, data, optim, is_ tick = time.time() + del rgb_image, birdview, location, command, speed + del _teac_location, _teac_locations, _pred_location, _pred_locations, pred_location, pred_locations + del loss, loss_mean + if is_first_epoch and i == 10: iterator_tqdm.close() break