Skip to content

Commit

Permalink
Assert that dim is integer in Normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassa committed Apr 13, 2016
1 parent ded85de commit bae3b67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Normalize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
function Normalize:updateOutput(input)
assert(math.abs(self.dim) <= input:dim(),
'input has less dimensions than the normalization dimension')
assert(self.dim % 1 == 0, 'dimension should be an integer')
local dim = self.dim
if dim < 0 then
dim = input:dim() + dim + 1
Expand Down Expand Up @@ -47,6 +48,7 @@ end
function Normalize:updateGradInput(input, gradOutput)
assert(math.abs(self.dim) <= input:dim(),
'input has less dimensions than the normalization dimension')
assert(self.dim % 1 == 0, 'dimension should be an integer')
local dim = self.dim
if dim < 0 then
dim = input:dim() + dim + 1
Expand Down

0 comments on commit bae3b67

Please sign in to comment.