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

github.com/soumith/cudnn.torch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart van Merriƫnboer <bart.vanmerrienboer@gmail.com>2016-08-12 17:34:36 +0300
committerGitHub <noreply@github.com>2016-08-12 17:34:36 +0300
commit47377878446036024f1deea7186911c6667e9705 (patch)
tree534f6c99d7354a202ab45abe4da369fdad398250
parent59ac9afc330e3b848fb204afeb8d6f2835902540 (diff)
Lua 5.3 compatibility
It seems like Lua 5.3 doesn't like it when you put floats into long tensors. Simply taking the floor explicitly (which is what Lua 5.2 does implicitly) seems to work.
-rw-r--r--RNN.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/RNN.lua b/RNN.lua
index 7f89da9..f515caa 100644
--- a/RNN.lua
+++ b/RNN.lua
@@ -57,7 +57,7 @@ function RNN:reset(stdv)
self.xDescs[0],
weightSize:data(),
self.datatype)
- weightSize[1] = (weightSize[1] + 3) / 4 -- sizeof(float)
+ weightSize[1] = torch.floor((weightSize[1] + 3) / 4) -- sizeof(float)
self.weight:resize(weightSize[1])
self.weight:uniform(-stdv, stdv)
self.gradWeight:resizeAs(self.weight):zero()
@@ -332,7 +332,7 @@ function RNN:updateOutput(input)
self.seqLength,
self.xDescs,
workspaceSize:data())
- workspaceSize[1] = (workspaceSize[1] + 3) / 4 -- sizeof(float)
+ workspaceSize[1] = torch.floor((workspaceSize[1] + 3) / 4) -- sizeof(float)
if self.workspace:size(1) < workspaceSize[1] then
self.workspace:resize(workspaceSize[1])
end
@@ -345,7 +345,7 @@ function RNN:updateOutput(input)
self.seqLength,
self.xDescs,
reserveSize:data())
- reserveSize[1] = (reserveSize[1] + 3) / 4 -- sizeof(float)
+ reserveSize[1] = torch.floor((reserveSize[1] + 3) / 4) -- sizeof(float)
if self.reserve:dim() == 0 or
self.reserve:size(1) < reserveSize[1] then
self.reserve:resize(reserveSize[1])