blob: db50e55c5039e278fddb1c5a92f6c4bb3f2407a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
require 'nn'
local Tic, parent = torch.class('nn.Tic', 'nn.Module')
function Tic:__init(name)
parent.__init(self)
self.name = name or 'default'
tic_modules = tic_modules or {}
tic_modules[self.name] = torch.Timer()
end
function Tic:updateOutput(input)
tic_modules[self.name]:reset()
self.output = input
return self.output
end
function Tic:updateGradInput(input, gradOutput)
self.gradInput = gradOutput
return self.gradInput
end
|