Skip to content

Commit 42c3b42

Browse files
authored
Allow gpu batched parallel render (#1790)
1 parent 72da302 commit 42c3b42

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

alf/trainers/policy_trainer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ def _step(algorithm,
10421042
recorder.clear_cache()
10431043

10441044
elif render:
1045-
if env.batch_size > 1:
1045+
if env.batch_size > 1 and hasattr(env, "envs"):
10461046
env.envs[0].render(mode='human')
10471047
else:
10481048
env.render(mode='human')
@@ -1147,6 +1147,7 @@ def play(root_dir,
11471147
batch_size = env.batch_size
11481148
recorder = None
11491149
if record_file is not None:
1150+
# TODO: support for batched environments
11501151
assert batch_size == 1, 'video recording is not supported for parallel play'
11511152
# Note that ``VideoRecorder`` will import ``matplotlib`` which might have
11521153
# some side effects on xserver (if its backend needs graphics).
@@ -1158,7 +1159,7 @@ def play(root_dir,
11581159
append_blank_frames=append_blank_frames,
11591160
path=record_file)
11601161
elif render:
1161-
if batch_size > 1:
1162+
if batch_size > 1 and hasattr(env, "envs"):
11621163
env.envs[0].render(mode='human')
11631164
else:
11641165
# pybullet_envs need to render() before reset() to enable mode='human'

0 commit comments

Comments
 (0)