Core Module¶
baconian.core.core.Basic¶
-
class
baconian.core.core.Basic(name: str, status=None)¶ Basic class within the whole framework
-
INIT_STATUS= None¶
-
STATUS_LIST= ('TRAIN', 'TEST')¶
-
__init__(name: str, status=None)¶ Init a new Basic instance.
Parameters: - name (str) – name of the object, can be determined to generate log path, handle tensorflow name scope etc.
- status (Status) – A status instance
Statusto indicate the status of the object
-
allow_duplicate_name= False¶
-
get_status() → dict¶ Return the object’s status, a dictionary.
-
init(*args, **kwargs)¶ Initialize the object
-
load(*args, **kwargs)¶ Load the parameters from training checkpoints.
-
name¶ The name(id) of object, a string.
-
required_key_dict= ()¶
-
save(*args, **kwargs)¶ Save the parameters in training checkpoints.
-
set_status(val)¶ Set the object’s status.
-
status_list¶ Status list of the object, (‘TRAIN’, ‘TEST’).
-
baconian.core.core.Env¶
-
class
baconian.core.core.Env(name: str = 'env', copy_from_env=None)¶ Abstract class for environment
-
INIT_STATUS= 'CREATED'¶
-
STATUS_LIST= ('JUST_RESET', 'INITED', 'TRAIN', 'TEST', 'CREATED')¶
-
__init__(name: str = 'env', copy_from_env=None)¶
-
get_state()¶ Get the status of the environment.
-
init()¶ Set the status to ‘INITED’.
-
key_list= ()¶
-
reset()¶ Set the status to ‘JUST_RESET’, and update new reset point
-
seed(seed=None)¶ Parameters: seed (int) – seed to generate random number Returns: seed of the unwrapped environment Return type: int
-
step(action)¶ Parameters: action (method) – agent’s action, the environment will react responding to action
-
baconian.core.core.EnvSpec¶
-
class
baconian.core.core.EnvSpec(obs_space: baconian.common.spaces.base.Space, action_space: baconian.common.spaces.base.Space)¶ -
__init__(obs_space: baconian.common.spaces.base.Space, action_space: baconian.common.spaces.base.Space)¶
-
action_shape¶
-
action_space¶ Returns: Action space of environment Return type: Space
-
static
flat(space: baconian.common.spaces.base.Space, obs_or_action: (<class 'numpy.ndarray'>, <class 'list'>))¶ flat the input obs or action :param space: space of environment :type space: Space :param obs_or_action: action or observation space :type obs_or_action: (np.ndarray, list) :return: flatten action or observation space :rtype: Space
-
flat_action(action: (<class 'numpy.ndarray'>, <class 'list'>))¶ Parameters: action ((np.ndarray, list)) – action taken by agent Returns: flatten action parameter Return type: np.ndarray
-
flat_action_dim¶ Returns: the dimension(length) of flatten action space Return type: int
-
flat_obs(obs: (<class 'numpy.ndarray'>, <class 'list'>))¶ Parameters: obs ((np.ndarray, list)) – observation of the agent Returns: flatten observation parameter Return type: np.ndarray
-
flat_obs_dim¶ Returns: the dimension(length) of flatten observation space Return type: int
-
obs_shape¶
-
obs_space¶ Returns: Observation space of environment Return type: Space
-