python - 如何更改我的 RL 模型的输出形状?
问题描述
我在 Google Colab 上使用 python 和 kerasrl-2。我正在研究 Gym BipedalWalker-v3 环境。但我得到了这个错误:
--> 385 self.joints[0].motorSpeed = float(SPEED_HIP * np.sign(action[0]))
386 self.joints[0].maxMotorTorque = float(MOTORS_TORQUE * np.clip(np.abs(action[0]), 0, 1))
387 self.joints[1].motorSpeed = float(SPEED_KNEE * np.sign(action[1]))
TypeError: 'int' object is not subscriptable
我认为我的问题的根源是我的输出形状:
Layer (type) Output Shape Param #
=================================================================
flatten_13 (Flatten) (None, 24) 0
_________________________________________________________________
dense_55 (Dense) (None, 32) 800
_________________________________________________________________
dense_56 (Dense) (None, 30) 990
_________________________________________________________________
dense_57 (Dense) (None, 24) 744
_________________________________________________________________
dense_58 (Dense) (None, 4) 100
(None, 4) # This is my output shape
这是环境的动作信息:
env = gym.make('BipedalWalker-v3')
env.action_space # (Box(-1.0, 1.0, (4,), float32))
env.action_space.sample() # array([-0.07326526, 0.73222667, 0.6016823, 0.4056189, dtype=float32)
env.action_space.shape # (4,)
如果我的想法不对,你能告诉我我哪里错了吗?
解决方案
推荐阅读
- video - 在特定地区屏蔽视频
- vhdl - 实体在 Modelsim 仿真中没有架构
- python - 如何在python中清除存储在套接字中的数据
- postgresql - AutoMigrate 不生成自引用外键
- pytorch - RuntimeError:输入类型(torch.FloatTensor)和权重类型(torch.cuda.FloatTensor)即使在放置模型和输入到cuda之后也应该相同
- python - 如何使用 pyTelegramBotAPI 获取照片?
- c - 在双指针中加入
- asp.net-core - 如何在 ASP.NET Core Razor Pages 的路由段中定义允许的选项?
- java - 如何在 Spring Boot 中重用自定义响应
- power-automate - 访问 get api 时出现 Power 自动化错误