Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagar_M_Waghmare authored and Sagar_M_Waghmare committed Feb 4, 2016
1 parent 7618306 commit 39a5740
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions SpatialRegionDropout.lua
Expand Up @@ -34,23 +34,27 @@ function SpatialRegionDropout:updateOutput(input)
if self.regionType == 1 then
self.noise[{{}, {}, {1, math.floor(height*self.p)}}]:fill(0)
elseif self.regionType == 2 then
self.noise[{{}, {}, {height-math.floor(height*self.p)+1, height}}]:fill(0)
self.noise[{{}, {},
{height-math.floor(height*self.p)+1, height}}]:fill(0)
elseif self.regionType == 3 then
self.noise[{{}, {}, {}, {1, math.floor(width*self.p)}}]:fill(0)
elseif self.regionType == 4 then
self.noise[{{}, {}, {}, {width-math.floor(width*self.p)+1, width}}]:fill(0)
self.noise[{{}, {}, {},
{width-math.floor(width*self.p)+1, width}}]:fill(0)
end
elseif input:dim() == 3 then
local height = input:size(2)
local width = input:size(3)
if self.regionType == 1 then
self.noise[{{}, {1, math.floor(height*self.p)}}]:fill(0)
elseif self.regionType == 2 then
self.noise[{{}, {height-math.floor(height*self.p)+1, height}}]:fill(0)
self.noise[{{},
{height-math.floor(height*self.p)+1, height}}]:fill(0)
elseif self.regionType == 3 then
self.noise[{{}, {}, {1, math.floor(width*self.p)}}]:fill(0)
elseif self.regionType == 4 then
self.noise[{{}, {}, {width-math.floor(width*self.p)+1, width}}]:fill(0)
self.noise[{{}, {},
{width-math.floor(width*self.p)+1, width}}]:fill(0)
end
else
error('Input must be 4D (nbatch, nfeat, h, w) or 3D (nfeat, h, w)')
Expand Down

0 comments on commit 39a5740

Please sign in to comment.