我正在尝试复制提供这里的示例。然而,在我的例子中,当我做torch.CharStorage('hello.txt')时,我得到了[torch.CharStorage of size 0]。这是完整的输出
$ echo "Hello World" > hello.txt
$ th
______ __ | Torch7
/_ __/__ ________/ / | Scientific computing for Lua.
/ / / _ \/ __/ __/ _ \ | Type ? for help
/_/ \___/_/ \__/_//_/ | https://github.com/torch
| http://torch.ch
th> x = torch.CharStorage('hello.txt')
[0.0001s]
th> x
[torch.CharStorage of size 0]我还注意到,当我执行torch.CharStorage('hello.txt', false, 11)时,数据是正确读取的。但是,在文档中,shared和size参数指定为可选参数。是因为文档不是最新的,还是我做错了什么?
发布于 2020-05-18 00:14:32
您似乎正在运行由commit 6a35cd9引入的发行版bug #245。正如torch7 bug #1064中所述,您可以通过更新pkg/torch子模块来提交89ede3b或更新,或者将其回滚以提交2186e41或更高版本,从而绕过它。
https://stackoverflow.com/questions/61852391
复制相似问题