Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua 如何使用火炬生成的模型进行预测?_Lua_Neural Network_Deep Learning_Torch - Fatal编程技术网

Lua 如何使用火炬生成的模型进行预测?

Lua 如何使用火炬生成的模型进行预测?,lua,neural-network,deep-learning,torch,Lua,Neural Network,Deep Learning,Torch,我已经执行了命令。现在我有了这个模型,我想用我自己的一些手写图像来测试它。但是我已经尝试了很多方法来存储权重,现在通过使用存储完整的模型 但是现在我尝试使用model:forward(testImageTensor) 你有两个选择 一个。使用封装的邮件转发您的: 两个。将你的火炬.张量封装成a,并通过你的: 在torch中,它是直截了当的,就像你试图做的那样。这似乎是使用“dp”包的副作用。也许《dp》的作者能帮上忙。 ...ches/torch/install/share/lua/5.1/dp

我已经执行了命令。现在我有了这个模型,我想用我自己的一些手写图像来测试它。但是我已经尝试了很多方法来存储权重,现在通过使用存储完整的模型

但是现在我尝试使用
model:forward(testImageTensor)

你有两个选择

一个。使用封装的邮件转发您的:

两个。将你的火炬.张量封装成a,并通过你的:


在torch中,它是直截了当的,就像你试图做的那样。这似乎是使用“dp”包的副作用。也许《dp》的作者能帮上忙。
...ches/torch/install/share/lua/5.1/dp/model/sequential.lua:30: attempt to index local 'carry' (a nil value)
stack traceback:
        ...ches/torch/install/share/lua/5.1/dp/model/sequential.lua:30: in function '_forward'
        ...s/torches/torch/install/share/lua/5.1/dp/model/model.lua:60: in function 'forward'
        [string "model:forward(testImageTensor)"]:1: in main chunk
        [C]: in function 'xpcall'
        ...aries/torches/torch/install/share/lua/5.1/trepl/init.lua:588: in function 'repl'
        ...ches/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
        [C]: at 0x0804d650
mlp2 = mlp:toModule(datasource:trainSet():sub(1,2))
input = testImageTensor:view(1, 1, 32, 32)
output = mlp2:forward(input)
inputView = dp.ImageView('bchw', testImageTensor:view(1, 1, 32, 32))
outputView = mlp:forward(inputView, dp.Carry{nSample=1})
output = outputView:forward('b')