火炬:不同尺寸张量的结构是什么?

时间:2016-06-28 11:56:46

标签: lua lua-table torch

表?但是将大张量插入表中效率不高,甚至不可能因为我的情况下的内存。这很好用,但很难看:

local s_ = 0
s_ = s_ + 1; local X_py_1 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
s_ = s_ + 1; local X_py_2 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
s_ = s_ + 1; local X_py_3 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
s_ = s_ + 1; local X_py_4 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
s_ = s_ + 1; local X_py_5 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
s_ = s_ + 1; local X_py_6 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[s_]))
X_py = {X_py_1, X_py_2, X_py_3, X_py_4, X_py_5, X_py_6}

2 个答案:

答案 0 :(得分:0)

显示我的代码..请帮助你

X_py = {X_py_1, X_py_2, X_py_3, X_py_4, X_py_5, X_py_6}
for i, v in ipairs(X_py) do
    v = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scales[i-1]))
end

只需使用表格,你想要吗?

答案 1 :(得分:0)

好的,这很简单:

{ resp ->
   println resp.status
}