0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

memo: ChainerRLでCuPyのエラー

Posted at

ChainerRLについてのメモです。

環境

sudo pip3 freezeで調べたもの。

  • chainer==6.1.0
  • chainerrl==0.7.0
  • cupy==6.1.0

概要

ChainerRLのTRPOでMountain Carを解くプログラム(参考コード; ほぼ同一)を実行したら、こんなエラーが出ました。

Traceback (most recent call last):
  File "mc_trpo.py", line 211, in <module>
    main()
  File "mc_trpo.py", line 158, in main
    policy.xp.zeros_like(obs_space.low, dtype=np.float32)[None],
  File "/usr/local/lib/python3.5/dist-packages/cupy/creation/basic.py", line 205, in zeros_like
    order, strides, memptr = _new_like_order_and_strides(a, dtype, order)
  File "/usr/local/lib/python3.5/dist-packages/cupy/creation/basic.py", line 35, in _new_like_order_and_strides
    order = chr(_update_order_char(a, ord(order)))
TypeError: Argument 'x' has incorrect type (expected cupy.core.core.ndarray, got numpy.ndarray)

変えたところといえば環境の引数くらい(自作MC環境)でして、あとはExampleまんまなんですけど……

解決策(暫定)

CuPyを5.4.0(適当)にダウングレード。

sudo pip3 install cupy==5.4.0

すると、バージョン不整合の警告は出るものの、動きました。うーん……?
動いたのでよしとします。なんかよい解決策を見つけたら追記します。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?