Datasets:
File size: 1,900 Bytes
faa3682 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
class Agent:
def __init__(self, obs_space, act_space, config):
pass
def init_train(self, batch_size):
raise NotImplementedError('init_train(batch_size) -> carry')
def init_report(self, batch_size):
raise NotImplementedError('init_report(batch_size) -> carry')
def init_policy(self, batch_size):
raise NotImplementedError('init_policy(batch_size) -> carry')
def train(self, carry, data):
raise NotImplementedError('train(carry, data) -> carry, out, metrics')
def report(self, carry, data):
raise NotImplementedError('report(carry, data) -> carry, metrics')
def policy(self, carry, obs, mode):
raise NotImplementedError('policy(carry, obs, mode) -> carry, act, out')
def stream(self, st):
raise NotImplementedError('stream(st) -> st')
def save(self):
raise NotImplementedError('save() -> data')
def load(self, data):
raise NotImplementedError('load(data) -> None')
class Env:
def __repr__(self):
return (
f'{self.__class__.__name__}('
f'obs_space={self.obs_space}, '
f'act_space={self.act_space})')
@property
def obs_space(self):
# The observation space must contain the keys is_first, is_last, and
# is_terminal. Commonly, it also contains the keys reward and image. By
# convention, keys starting with 'log/' are not consumed by the agent.
raise NotImplementedError('Returns: dict of spaces')
@property
def act_space(self):
# The action space must contain the reset key as well as any actions.
raise NotImplementedError('Returns: dict of spaces')
def step(self, action):
raise NotImplementedError('Returns: dict')
def close(self):
pass
class Stream:
def __iter__(self):
return self
def __next__(self):
raise NotImplementedError
def save(self):
raise NotImplementedError
def load(self, state):
raise NotImplementedError
|