成功解决TypeError: only size-1 arrays can be converted to Python scalars

Problem Description:

base_action = [ 2.         -1.65909091  2.         -2.          2.          0.22669992
  2.         -2.         -1.62084658  2.         -0.40106834 -2.
 -0.19870362 -1.6288685  -2.          0.02443762 -2.         -1.7053572
  0.83902649 -1.48000453  2.         -1.44656077 -2.          2.
 -1.47518171 -2.          0.44459582 -0.51717101  2.          2.        ]

The dimension of the above data is (30,), if int(base_action) is used, the following error will be reported: TypeError: only size-1 arrays can be converted to Python scalars


solution:

Modify int(base_action) to (base_action).astype(np.int)

Guess you like

Origin blog.csdn.net/weixin_43283397/article/details/109640494