From 6534788a41f462be78e330bf02d4c4173e32d24b Mon Sep 17 00:00:00 2001 From: Brandon Amos Date: Tue, 12 Jul 2016 11:45:15 -0400 Subject: [PATCH] Use torch.range instead of torch.linspace because of rounding issues. For #160 --- batch-represent/dataset.lua | 3 ++- training/dataset.lua | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/batch-represent/dataset.lua b/batch-represent/dataset.lua index 7dbff10..76a7f4d 100644 --- a/batch-represent/dataset.lua +++ b/batch-represent/dataset.lua @@ -218,7 +218,8 @@ function dataset:__init(...) if clsLength == 0 then error('Class has zero samples: ' .. self.classes[i]) else - self.classList[i] = torch.linspace(runningIndex + 1, runningIndex + clsLength, clsLength):long() + -- self.classList[i] = torch.linspace(runningIndex + 1, runningIndex + clsLength, clsLength):long() + self.classList[i] = torch.range(runningIndex + 1, runningIndex + clsLength):long() self.imageClass[{{runningIndex + 1, runningIndex + clsLength}}]:fill(i) end runningIndex = runningIndex + clsLength diff --git a/training/dataset.lua b/training/dataset.lua index b3dafef..b5f14d8 100644 --- a/training/dataset.lua +++ b/training/dataset.lua @@ -221,6 +221,7 @@ function dataset:__init(...) error('Class has zero samples: ' .. self.classes[i]) else self.classList[i] = torch.linspace(runningIndex + 1, runningIndex + clsLength, clsLength):long() + self.classList[i] = torch.range(runningIndex + 1, runningIndex + clsLength):long() self.imageClass[{{runningIndex + 1, runningIndex + clsLength}}]:fill(i) end runningIndex = runningIndex + clsLength