diff options
Diffstat (limited to 'CDivTable.lua')
-rw-r--r-- | CDivTable.lua | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/CDivTable.lua b/CDivTable.lua deleted file mode 100644 index bae13c6..0000000 --- a/CDivTable.lua +++ /dev/null @@ -1,30 +0,0 @@ - -local CDivTable, parent = torch.class('nn.CDivTable', 'nn.Module') - -function CDivTable:__init() - parent.__init(self) - self.gradInput = {} -end - -function CDivTable:forward(input) - self.output:resizeAs(input[1]):copy(input[1]) - self.output:cdiv(input[2]) - return self.output -end - -function CDivTable:backward(input, gradOutput) - self.gradInput[1] = self.gradInput[1] or torch.Tensor() - self.gradInput[2] = self.gradInput[2] or torch.Tensor() - self.gradInput[1]:resizeAs(input[1]):copy(gradOutput):cdiv(input[2]) - self.gradInput[2]:resizeAs(input[2]):zero():addcdiv(-1,self.gradInput[1],input[2]):cmul(input[1]) - return self.gradInput -end - -function CDivTable:write(file) - parent.write(self, file) -end - -function CDivTable:read(file) - parent.read(self, file) - self.gradInput = {} -end |