salina.agents.gyma
salina.agents.gyma.GymAgent (TAgent)
Create an Agent from a gyn environment
__init__(self, make_env_fn=None, make_env_args={}, n_envs=None, input='action', output='env/', use_seed=True)
special
Create an agent from a Gym environment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
make_env_fn |
[function that returns a gym.Env] |
The function to create a single gym environments |
None |
make_env_args |
dict |
The arguments of the function that creates a gym.Env |
{} |
n_envs |
[int] |
The number of environments to create. |
None |
input |
str |
[the name of the action variable in the workspace]. Defaults to "action". |
'action' |
output |
str |
[the output prefix of the environment]. Defaults to "env/". |
'env/' |
use_seed |
bool |
[If True, then the seed is chained to the environments, and each environment will have its own seed]. Defaults to True. |
True |
Source code in salina/agents/gyma.py
def __init__(
self,
make_env_fn=None,
make_env_args={},
n_envs=None,
input="action",
output="env/",
use_seed=True
):
""" Create an agent from a Gym environment
Args:
make_env_fn ([function that returns a gym.Env]): The function to create a single gym environments
make_env_args (dict): The arguments of the function that creates a gym.Env
n_envs ([int]): The number of environments to create.
input (str, optional): [the name of the action variable in the workspace]. Defaults to "action".
output (str, optional): [the output prefix of the environment]. Defaults to "env/".
use_seed (bool, optional): [If True, then the seed is chained to the environments, and each environment will have its own seed]. Defaults to True.
"""
super().__init__()
self.use_seed=use_seed
assert n_envs > 0
self.envs = None
self.env_args = make_env_args
self._seed = 0
self.n_envs = n_envs
self.output = output
self.input = input
self.make_env_fn = make_env_fn
self.ghost_params = torch.nn.Parameter(torch.randn(()))
salina.agents.gyma.GymAgent (TAgent)
Create an Agent from a gyn environment
__init__(self, make_env_fn=None, make_env_args={}, n_envs=None, input='action', output='env/', use_seed=True)
special
Create an agent from a Gym environment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
make_env_fn |
[function that returns a gym.Env] |
The function to create a single gym environments |
None |
make_env_args |
dict |
The arguments of the function that creates a gym.Env |
{} |
n_envs |
[int] |
The number of environments to create. |
None |
input |
str |
[the name of the action variable in the workspace]. Defaults to "action". |
'action' |
output |
str |
[the output prefix of the environment]. Defaults to "env/". |
'env/' |
use_seed |
bool |
[If True, then the seed is chained to the environments, and each environment will have its own seed]. Defaults to True. |
True |
Source code in salina/agents/gyma.py
def __init__(
self,
make_env_fn=None,
make_env_args={},
n_envs=None,
input="action",
output="env/",
use_seed=True
):
""" Create an agent from a Gym environment
Args:
make_env_fn ([function that returns a gym.Env]): The function to create a single gym environments
make_env_args (dict): The arguments of the function that creates a gym.Env
n_envs ([int]): The number of environments to create.
input (str, optional): [the name of the action variable in the workspace]. Defaults to "action".
output (str, optional): [the output prefix of the environment]. Defaults to "env/".
use_seed (bool, optional): [If True, then the seed is chained to the environments, and each environment will have its own seed]. Defaults to True.
"""
super().__init__()
self.use_seed=use_seed
assert n_envs > 0
self.envs = None
self.env_args = make_env_args
self._seed = 0
self.n_envs = n_envs
self.output = output
self.input = input
self.make_env_fn = make_env_fn
self.ghost_params = torch.nn.Parameter(torch.randn(()))