diff options
Diffstat (limited to 'Threshold.lua')
-rw-r--r-- | Threshold.lua | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/Threshold.lua b/Threshold.lua deleted file mode 100644 index fbd5c54..0000000 --- a/Threshold.lua +++ /dev/null @@ -1,36 +0,0 @@ -local Threshold, parent = torch.class('nn.Threshold','nn.Module') - -function Threshold:__init(th,v) - parent.__init(self) - self.threshold = th or 1e-6 - self.val = v or 0 - if (th and type(th) ~= 'number') or (v and type(v) ~= 'number') then - error(xlua.usage('nn.Threshold', - 'a threhold module, if input < threshold, then output = value', - nil, - {type='number', help='threshold'}, - {type='number', help='value'})) - end -end - -function Threshold:forward(input) - input.nn.Threshold_forward(self, input) - return self.output -end - -function Threshold:backward(input, gradOutput) - input.nn.Threshold_backward(self, input, gradOutput) - return self.gradInput -end - -function Threshold:write(file) - parent.write(self,file) - file:writeDouble(self.threshold) - file:writeDouble(self.val) -end - -function Threshold:read(file) - parent.read(self,file) - self.threshold = file:readDouble() - self.val = file:readDouble() -end |