can't rescale in itorch

27 views
Skip to first unread message

Mata Fu

unread,
Oct 17, 2017, 10:01:49 AM10/17/17
to torch7
When I want to visualize the weights in my network, I found the original kernel size(3*3) is too small. So I want to resize it.



dis
= m11:get(1).weight

for i = 1,dis:size(1) do
    img
= dis[i]
   
print(img:size())
    itorch
.image(img)
    res_image
= image.scale(img,100)
    itorch
.image(res_img)
end

I have already
require 'image'

and load image successful. But still not work in scale command and had the error below. Can someone help me?

 
/home/fzehua/torch/install/share/lua/5.1/image/init.lua:731: attempt to index field 'image' (a nil value)
stack traceback:
/home/fzehua/torch/install/share/lua/5.1/image/init.lua:731: in function 'scale'
[string "for i = 1,dis:size(1) do..."]:5: in main chunk
[C]: in function 'xpcall'
/home/fzehua/torch/install/share/lua/5.1/itorch/main.lua:210: in function </home/fzehua/torch/install/share/lua/5.1/itorch/main.lua:174>
/home/fzehua/torch/install/share/lua/5.1/lzmq/poller.lua:80: in function 'poll'
/home/fzehua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
/home/fzehua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/home/fzehua/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
/home/fzehua/torch/install/share/lua/5.1/itorch/main.lua:389: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: at 0x00406670

Mata Fu

unread,
Oct 18, 2017, 10:49:10 AM10/18/17
to torch7
I found the reason. I need to convert the data type to float first (the original one is cuda).

在 2017年10月17日星期二 UTC+2下午4:01:49,Mata Fu写道:
Reply all
Reply to author
Forward
0 new messages