blob: 6083957843fa8b2c97c0dda1dc4ff853d921f313 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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('nn.Threshold(threshold, value)')
end
end
function Threshold:updateOutput(input)
input.nn.Threshold_updateOutput(self, input)
return self.output
end
function Threshold:updateGradInput(input, gradOutput)
input.nn.Threshold_updateGradInput(self, input, gradOutput)
return self.gradInput
end
|