From dbbae6f1037dd972075e88e2ae269e495dfa7170 Mon Sep 17 00:00:00 2001 From: Mayank Mittal Date: Fri, 20 Dec 2024 22:25:05 +0100 Subject: [PATCH] fixes tensor max ep length --- rsl_rl/runners/on_policy_runner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rsl_rl/runners/on_policy_runner.py b/rsl_rl/runners/on_policy_runner.py index 4fe58bf..c2bc00c 100644 --- a/rsl_rl/runners/on_policy_runner.py +++ b/rsl_rl/runners/on_policy_runner.py @@ -87,8 +87,10 @@ class OnPolicyRunner: raise AssertionError("logger type not found") if init_at_random_ep_len: + if isinstance(self.env.max_episode_length, float): + raise ValueError("Cannot initialize at random episode length with float max_episode_length!") self.env.episode_length_buf = torch.randint_like( - self.env.episode_length_buf, high=int(self.env.max_episode_length) + self.env.episode_length_buf, high=self.env.max_episode_length ) obs, extras = self.env.get_observations() critic_obs = extras["observations"].get("critic", obs)