-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvs.py
More file actions
17 lines (15 loc) · 707 Bytes
/
Copy pathenvs.py
File metadata and controls
17 lines (15 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np
from dm_control import suite
def create_env(domain, task=None, verbose=False):
if task is not None:
assert (domain, task) in suite.BENCHMARKING, 'Cannot find domain {} task {}.'.format(domain, task)
if verbose:
print('Loading environment: domain {} task {}.'.format(domain, task))
return suite.load(domain, task)
domains = np.array([d for (d, t) in suite.BENCHMARKING])
assert domain in domains, 'Cannot find domain {} task {}.'.format(domain, task)
i = np.where(domains == domain)[0][0]
d, t = suite.BENCHMARKING[i]
if verbose:
print('Loading environment: domain {} task {}.'.format(d, t))
return suite.load(d, t)