diff options
author | Boris Fomitchev <bfomitchev@nvidia.com> | 2015-10-15 04:23:47 +0300 |
---|---|---|
committer | Boris Fomitchev <bfomitchev@nvidia.com> | 2015-10-15 04:23:47 +0300 |
commit | 6d601d11b55e8ce18190b9ff02d27e046cbd52f7 (patch) | |
tree | c470d0938e4e85d79fd54f14e280e20978e9fa48 | |
parent | ab763a99d1a7e04f329a117916d1ea4a798f7f1e (diff) |
Natalias contiguity fix
-rw-r--r-- | SpatialSoftMax.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/SpatialSoftMax.lua b/SpatialSoftMax.lua index 57470cf..f874cd3 100644 --- a/SpatialSoftMax.lua +++ b/SpatialSoftMax.lua @@ -68,7 +68,12 @@ function SpatialSoftMax:updateOutput(input) end function SpatialSoftMax:updateGradInput(input, gradOutput) - assert(gradOutput:isContiguous()); + if not gradOutput:isContiguous() then + self._gradOutput = self._gradOutput or gradOutput.new() + self._gradOutput:resizeAs(gradOutput):copy(gradOutput) + gradOutput = self._gradOutput + end + self:createIODescriptors(input) errcheck('cudnnSoftmaxBackward', cudnn.getHandle(), |