【发布时间】:2020-09-03 05:40:02
【问题描述】:
我正在尝试复制here 提供的示例。不过,就我而言,当我执行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) 时,数据被正确读取。但是,在 documentation 中,shared 和 size 参数被指定为可选参数。是文档不是最新的还是我做错了什么?
【问题讨论】: