File size: 436 Bytes
e9fe176 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
local Print, parent = torch.class('nn.Print', 'nn.Module')
function Print:__init()
parent.__init(self)
end
function Print:updateOutput(input)
print(#input)
print(input[1])
self.output = input
return self.output
end
function Print:updateGradInput(input, gradOutput)
self.gradInput = gradOutput
return self.gradInput
end
function Print:__tostring__()
return string.format('%s()', torch.type(self))
end
|