Skip to content

Commit

Permalink
Add gradInput nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
angli-ai committed May 12, 2016
1 parent 0e545aa commit 9c8f2bb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SplitTable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ end
function SplitTable:updateGradInput(input, gradOutput)
local dimension = self:_getPositiveDimension(input)
local slices = input:size(dimension)
self.gradInput:resizeAs(input)
if self.gradInput then
self.gradInput:resizeAs(input)

for i=1,slices do
local currentGradInput = gradOutput[i];
self.gradInput:select(dimension,i):copy(currentGradInput)
for i=1,slices do
local currentGradInput = gradOutput[i];
self.gradInput:select(dimension,i):copy(currentGradInput)
end
end
return self.gradInput
end

0 comments on commit 9c8f2bb

Please sign in to comment.