浏览代码

Add support for clearState() in w2nn.LeakyReLU

nagadomi 9 年之前
父节点
当前提交
223dcead67
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      lib/LeakyReLU.lua

+ 6 - 1
lib/LeakyReLU.lua

@@ -17,7 +17,7 @@ function LeakyReLU:updateOutput(input)
    
    return self.output
 end
- 
+
 function LeakyReLU:updateGradInput(input, gradOutput)
    self.gradInput:resizeAs(gradOutput)
    -- filter positive
@@ -29,3 +29,8 @@ function LeakyReLU:updateGradInput(input, gradOutput)
    
    return self.gradInput
 end
+
+function LeakyReLU:clearState()
+   nn.utils.clear(self, 'negative')
+   return parent.clearState(self)
+end