Skip to content

Commit bae3b67

Browse files
committed
Assert that dim is integer in Normalize
1 parent ded85de commit bae3b67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Normalize.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ end
1212
function Normalize:updateOutput(input)
1313
assert(math.abs(self.dim) <= input:dim(),
1414
'input has less dimensions than the normalization dimension')
15+
assert(self.dim % 1 == 0, 'dimension should be an integer')
1516
local dim = self.dim
1617
if dim < 0 then
1718
dim = input:dim() + dim + 1
@@ -47,6 +48,7 @@ end
4748
function Normalize:updateGradInput(input, gradOutput)
4849
assert(math.abs(self.dim) <= input:dim(),
4950
'input has less dimensions than the normalization dimension')
51+
assert(self.dim % 1 == 0, 'dimension should be an integer')
5052
local dim = self.dim
5153
if dim < 0 then
5254
dim = input:dim() + dim + 1

0 commit comments

Comments
 (0)