Element-Research / rnn

Recurrent Neural Network library for Torch7's nn
BSD 3-Clause "New" or "Revised" License
941 stars 313 forks source link

Problem with RAM implementation #333

Closed ZENGXH closed 8 years ago

ZENGXH commented 8 years ago

Hi, I am recently running the recurrent-visual-attention.lua and find that in the examples we have locator:add(nn.MulConstant(opt.unitPixels*2/ds:imageSize("h"))) which will have output locations in range [-opt.unitPixels_2/ds:imageSize("h"), opt.unitPixels_2/ds:imageSize("h")] in stead of [-1, 1]

but then the nn.SpatialGlimpse by default receives normalized input in range [-1, 1] based on

      local yx = location[sampleIdx]
      -- (-1,-1) top left corner, (1,1) bottom right corner of image
      local y, x = yx:select(1,1), yx:select(1,2)
      -- (0,0), (1,1)
      y, x = (y+1)/2, (x+1)/2

I am wondering that whether there is some mismatch between the codes? Or I have some mis-understanding in this part?

Thanks in advance!

-- found that I makes a stupid mistakes.. sorry about that

nicholas-leonard commented 8 years ago

@ZENGXH No problem!