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

github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ZeroGrad.lua')
-rw-r--r--ZeroGrad.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/ZeroGrad.lua b/ZeroGrad.lua
index 83f88d2..446b25d 100644
--- a/ZeroGrad.lua
+++ b/ZeroGrad.lua
@@ -1,4 +1,9 @@
-local ZeroGrad, parent = torch.class("nn.ZeroGrad", "nn.Module")
+local ZeroGrad, parent
+if nn.ZeroGrad then -- prevent name conflicts with rnn
+ ZeroGrad, parent = nn.ZeroGrad, nn.Module
+else
+ ZeroGrad, parent = torch.class('nn.ZeroGrad', 'nn.Module')
+end
local function recursiveZero(t1,t2)
if torch.type(t2) == 'table' then