Lua 代码解释(涉及到循环神经网络)

我正在尝试理解 JcJohnson/Karpathy 写的Lua和Torch中RNN的部分代码。如果您感兴趣,可以在这里找到完整的项目:github链接:https://github.com/jcjohnson/torch-rnn

我需要帮助的部分如下所示,来自于LanguageModel.lua文件:

if #start_text > 0 then
    if verbose > 0 then
      print('Seeding with: "' .. start_text .. '"')
    end
    local x = self:encode_string(start_text):view(1, -1)
    local T0 = x:size(2)
    sampled[{{}, {1, T0}}]:copy(x)
    scores = self:forward(x)[{{}, {T0, T0}}]
    first_t = T0 + 1
else

例如,我不知道这些代码的含义:

:view((1, -1)
:size(2)
:copy(x)
sampled[]

您知道这些代码的含义或者在哪里可以找到这些代码的参考资料吗?

谢谢

点赞
用户7194361
用户7194361

你可以参考这里的 Torch 教程 here ,或者查看 Torch 的 github repo 文档 github repo

2017-11-18 12:24:58