问答交流

策略运行错误:GPU list index out of range

由yi12308创建,最终由yi12308 被浏览 42 用户

问题

直接从链接中克隆过来的,改了一下因子,运行后报如下错误

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-97f0ff14d64d> in <module>
      1 import tensorflow as tf
      2 gpus = tf.config.list_physical_devices("GPU")
----> 3 tf.config.experimental.set_memory_growth(gpus[0], True)

IndexError: list index out of range

解答

看起来是因为没有GPU,去掉如下GPU相关代码就可以了

gpus = tf.config.list_physical_devices("GPU")
tf.config.experimental.set_memory_growth(gpus[0], True)

可以在 资源中心 这里购买GPU,可显著加速深度学习速度

相关策略代码

https://bigquant.com/experimentshare/b40454251e78476f93e37e29dc478c53


\

标签

Python
评论
  • gpus = tf.config.list_physical_devices("GPU") tf.config.experimental.set_memory_growth(gpus\[0\], True) \ 这两行代码去掉即可
  • 看起来是因为没有GPU,去掉如下GPU相关代码就可以了 ```python gpus = tf.config.list_physical_devices("GPU") tf.config.experimental.set_memory_growth(gpus[0], True) ``` 可以在 [资源中心](https://bigquant.com/account/big_member/?from=navigation) 这里购买GPU,可显著加速深度学习速度