torch:不同大小的张量的结构是什么?

table?但是将大的张量插入到表中不高效,甚至在我的情况下不可能因为内存问题。这很完美,但它很丑陋:

local s_ = 0
s_ = s_ + 1local X_py_1 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir,scales[s_]))
s_ = s_ + 1local X_py_2 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir,scales[s_]))
s_ = s_ + 1local X_py_3 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir,scales[s_]))
s_ = s_ + 1local X_py_4 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir,scales[s_]))
s_ = s_ + 1local X_py_5 = fromfile(('%s/x_py_%.2f.bin'):format(data_dir,scales[s_]))
s_ = s_ + 1local 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}
点赞
用户4988149
用户4988149
显示我的代码...请帮忙

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

```

简单地使用表格,你需要吗?

2016-06-28 18:03:10
用户2866910
用户2866910
这是可行的:

X_py = {} for s, scale in ipairs(scales) do X_py[s] = fromfile(('%s/x_py_%.2f.bin'):format(data_dir, scale)) end

```

2016-06-29 09:12:33