From 2cd71b6058f2fd3b620fa5a5b58d6246a2d4a46c Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Wed, 22 Apr 2020 17:57:22 +0200 Subject: [PATCH] Fixed a problem where ConfigDataset was not giving batches --- torch_modules/src/ConfigDataset.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/torch_modules/src/ConfigDataset.cpp b/torch_modules/src/ConfigDataset.cpp index 3a4e646..30dce0e 100644 --- a/torch_modules/src/ConfigDataset.cpp +++ b/torch_modules/src/ConfigDataset.cpp @@ -137,6 +137,10 @@ void ConfigDataset::computeNbToGive() smallestSize = sizeLeft; } for (auto & it : holders) - nbToGive[it.first] = std::floor(1.0*it.second.sizeLeft()/smallestSize); + { + nbToGive[it.first] = std::max<int>(1,std::floor(1.0*it.second.sizeLeft()/smallestSize)); + if (it.second.sizeLeft() == 0) + nbToGive[it.first] = 0; + } } -- GitLab