can’t convert np.ndarray of type numpy.uint64. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
for i in range(1, n_episodes + 1):
obs = env.reset()
R = 0 # return (sum of rewards)
t = 0 # time step
while True:
# Uncomment to watch the behavior in a GUI window
# env.render()
#action = agent.act(torch.FloatTensor(obs))
obs = np.array(obs , dtype=np.float32)
obs = torch.from_numpy(obs)
action = agent.act(obs)
#action = np.array(action, dtype=int)
#action = action.squeeze()
next_obs, reward, done, _ = env.step(np.asarray(action).reshape(1,))
#obs, reward, done, _ = env.step(torch.from_numpy(np.asarray(action)))
R += reward
t += 1
reset = t == max_episode_len
#print(type(agent))
#agent = np.array(agent)
#agent = torch.from_numpy(agent)
agent.observe(
next_obs,
reward,
done,
reset
)
if done or reset:
break
if i % 10 == 0:
print('episode:', i, 'R:', R)
if i % 50 == 0:
print('statistics:', agent.get_statistics())
print('Finished.')