Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Minus.lua - github.com/clementfarabet/lua---nnx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa1be52b51bddd0fe46a7139e85aa2bfc71c9671 (plain)
1
2
3
4
5
6
7
8
9
10
11
local Minus, parent = torch.class('nn.Minus', 'nn.Module')

function Minus:forward(input)
   self.output:resizeAs(input):copy(input):mul(-1)
   return self.output
end

function Minus:backward(input, gradOutput)
   self.gradInput:resizeAs(input):copy(gradOutput):mul(-1)
   return self.gradInput
end