reader.ptb_raw_data 出现 "AttributeError: 'str' object has no attribute 'decode

reader.ptb_raw_data 出现 "AttributeError: 'str' object has no attribute 'decode

这是因为文件不是unicode编码的,要先以二进制方式打开,读入比特流,再解码。

reader.ptb_raw_data 出现 "AttributeError: 'str' object has no attribute 'decode
将r改为rb
即改之前 with tf.gfile.GFile(filename, "r") as f:
改之后 with tf.gfile.GFile(filename, "rb") as f: #二进制方式打开

reader.ptb_raw_data 出现 "AttributeError: 'str' object has no attribute 'decode

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-04
  • 2021-06-28
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案