Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/optim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2013-03-13 22:26:15 +0400
committerClement Farabet <clement.farabet@gmail.com>2013-03-13 22:26:15 +0400
commitcac62adf32c00a3a1de0a2fc9c92d7a1874f4645 (patch)
tree2ae92a5ffa135249e4b9928df57061abb192898d
parent8807a75e345bcc563c92a81dc874edae318bc822 (diff)
Fixed copy (if input vectors are cuda, it was failing)1.0.2-0
-rw-r--r--ConfusionMatrix.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/ConfusionMatrix.lua b/ConfusionMatrix.lua
index 9a221ff..cb286ff 100644
--- a/ConfusionMatrix.lua
+++ b/ConfusionMatrix.lua
@@ -33,15 +33,15 @@ function ConfusionMatrix:add(prediction, target)
elseif type(target) == 'number' then
-- prediction is a vector, then target assumed to be an index
self.prediction_1d = self.prediction_1d or torch.FloatTensor(self.nclasses)
- self.prediction_1d[{}] = prediction
+ self.prediction_1d:copy(prediction)
local _,prediction = self.prediction_1d:max(1)
self.mat[target][prediction[1]] = self.mat[target][prediction[1]] + 1
else
-- both prediction and target are vectors
self.prediction_1d = self.prediction_1d or torch.FloatTensor(self.nclasses)
- self.prediction_1d[{}] = prediction
+ self.prediction_1d:copy(prediction)
self.target_1d = self.target_1d or torch.FloatTensor(self.nclasses)
- self.target_1d[{}] = target
+ self.target_1d:copy(target)
local _,prediction = self.prediction_1d:max(1)
local _,target = self.target_1d:max(1)
self.mat[target[1]][prediction[1]] = self.mat[target[1]][prediction[1]] + 1