如何在 step 方法中为 TF-Agents 环境提供一组动作?

问题描述

我想对我的环境进行建模,使每个操作由 3 个可能的子操作组成。

我已将 _action_spectf_agents.environments.py_environment.PyEnvironment 定义为:

self._action_spec = tf_agents.specs.BoundedArraySpec(
            shape=(3,),dtype=np.int32,name="action",minimum=[0,0],maximum=[10,11,12])

我在 step 方法中失败了,我正在尝试:

env = NetworkEnv(discount=0.9)
tf_env = TFPyEnvironment(env)
print(tf_env.reset())
action = tf.constant([3,3,3],dtype=tf.int32,shape=(3,name='action')
print(tf_env.step(action))
tf_env.close()

但它给了 ValueError: cannot select an axis to squeeze out which has size not equal to one

我应该如何为 step 方法提供操作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)