diff options
author | Michael 'myrhev' Mathieu <michael.mathieu@ens.fr> | 2012-04-27 00:32:15 +0400 |
---|---|---|
committer | Michael 'myrhev' Mathieu <michael.mathieu@ens.fr> | 2012-04-27 00:50:18 +0400 |
commit | 300bd31b0ec5bc108ce78b4f3730f8c67fc5a8bc (patch) | |
tree | 1e740a1d333966c20315ced3ccf25bca1d1cbacb /Tic.lua | |
parent | c551b07dabd2beebdfe7e534e2a8dd247077c61d (diff) |
Add SpatialReSamplingEx (grouping all the Spatial*Sampling).
SpatialPadding can now pad on dimensions different than (2,3).
Add Tic/Toc modules, to time a network
Diffstat (limited to 'Tic.lua')
-rw-r--r-- | Tic.lua | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,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 |