Batch( obs: array([[ 3.87556586e+00, -1.39884560e+00, 3.90417171e+00, -1.42959780e+00, 2.50000000e+00, 4.00000000e+00, 8.59177895e-03, -1.61742055e-03, -8.72117713e-01, 7.03924209e-02, -1.29531812e-01, -2.94461078e-01, 8.61572789e-02, 3.94930195e-01, -4.20615077e-02, -6.41838507e+00, -1.65869727e+00, 8.98895966e-01, -4.98185009e-01, 5.14246542e-01, 2.90281950e+00, 1.09837612e-01, 1.17493326e-01, 8.70688482e-02]]), act: array([[-0.46321275, 0.92014786, -0.97776801, 0.05547555]]), rew: array([-25.02164498]), terminated: array([False]), truncated: array([False]), done: array([False]), obs_next: array([[ 3.87556586e+00, -1.39884560e+00, 3.90417171e+00, -1.42959780e+00, 2.50000000e+00, 4.00000000e+00, 8.59177895e-03, -1.61742055e-03, -8.72117713e-01, 7.03924209e-02, -1.29531812e-01, -2.94461078e-01, 8.61572789e-02, 3.94930195e-01, -4.20615077e-02, -6.41838507e+00, -1.65869727e+00, 8.98895966e-01, -4.98185009e-01, 5.14246542e-01, 2.90281950e+00, 1.09837612e-01, 1.17493326e-01, 8.70688482e-02]]), info: Batch( self.do_simulation(action, self.frame_skip): array([[-0.49878631, -0.73343635, -0.18061225, 0.59941456, 0.81610918, 0.24985782]]), dist_htg_after: array([5.60822881]), reward_dev: array([-0.51599685]), rew_arrive: array([0]), reward_ctrl: array([-0.00575235]), env_id: array([0]), self.state_k: array([4000]), rew_near: array([-25]), rewards: array([-25.02164498]), rew_forward: array([0.50010422]), ), policy: Batch(), )对其切片采样,提取出obs的列表
时间: 2024-02-14 14:05:22 浏览: 118
可以使用以下代码提取出 Batch 对象中的 observations 列表:
```
obs_list = Batch.obs.tolist()
```
该代码将 Batch 对象中的 obs 转换为列表,并赋值给变量 obs_list。可以通过以下代码来验证提取出的 obs_list 是否正确:
```
print(obs_list)
```
输出结果应该为:
```
[[3.87556586, -1.3988456, 3.90417171, -1.4295978, 2.5, 4.0, 0.00859177895, -0.00161742055, -0.872117713, 0.0703924209, -0.129531812, -0.294461078, 0.0861572789, 0.394930195, -0.0420615077, -6.41838507, -1.65869727, 0.898895966, -0.498185009, 0.514246542, 2.9028195, 0.109837612, 0.117493326, 0.0870688482]]
```
可以看到,输出结果为一个包含所有 observations 的列表。
阅读全文