module moplayground.moppo.networks


function flatten_model

flatten_model(target_params)

function count_params

count_params(params)

Count the total number of parameters in a Flax model.


class MLP

MLP(obs_dim: int, hidden_sizes: Sequence[int], action_dim: int, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None)

method MLP.__init__

__init__(
    obs_dim: int,
    hidden_sizes: Sequence[int],
    action_dim: int,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
)  None

property MLP.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> MLP.variables

Returns the variables in this module. 




---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/src/moplayground/moppo/networks.py#L61"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `Hypernet`
Hypernet(target_model_dict: flax.linen.module.Module, num_objs: int, obs_dim: int, hypersize: tuple, num_features: int = 8, W_variance: float = 0.0, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None) 

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/__init__"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `Hypernet.__init__`

```python
__init__(
    target_model_dict: flax.linen.module.Module,
    num_objs: int,
    obs_dim: int,
    hypersize: tuple,
    num_features: int = 8,
    W_variance: float = 0.0,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
) → None

property Hypernet.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> Hypernet.variables

Returns the variables in this module. 



---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/setup#L69"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `Hypernet.setup`

```python
setup()

class HypernetMLP

HypernetMLP(target_model_dict: dict, num_objs: int, obs_dim: int, hypersize: tuple, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None)

method HypernetMLP.__init__

__init__(
    target_model_dict: dict,
    num_objs: int,
    obs_dim: int,
    hypersize: tuple,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
)  None

property HypernetMLP.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> HypernetMLP.variables

Returns the variables in this module. 



---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/setup#L134"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `HypernetMLP.setup`

```python
setup()

class FakeHypernet

FakeHypernet(target_model_dict: dict, num_objs: int, obs_dim: int, hypersize: tuple, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None)

method FakeHypernet.__init__

__init__(
    target_model_dict: dict,
    num_objs: int,
    obs_dim: int,
    hypersize: tuple,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
)  None

property FakeHypernet.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> FakeHypernet.variables

Returns the variables in this module. 



---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/setup#L179"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `FakeHypernet.setup`

```python
setup()

class ActorCriticHypernet

ActorCriticHypernet(target_policy_dict: dict, target_value_dict: dict, num_objs: int, obs_dim: int, hypersize: tuple = (128, 128), num_features: int = 8, W_variance: float = 0.0, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None)

method ActorCriticHypernet.__init__

__init__(
    target_policy_dict: dict,
    target_value_dict: dict,
    num_objs: int,
    obs_dim: int,
    hypersize: tuple = (128, 128),
    num_features: int = 8,
    W_variance: float = 0.0,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
)  None

property ActorCriticHypernet.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> ActorCriticHypernet.variables

Returns the variables in this module. 



---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/setup#L231"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `ActorCriticHypernet.setup`

```python
setup()

method ActorCriticHypernet.unflatten_params

unflatten_params(flat_params, target_network, single)

class DualA2CHypernet

DualA2CHypernet(target_policy_dict: dict, target_value_dict: dict, num_objs: int, obs_dim: int, hypersize: tuple = (128, 128), num_features: int = 8, W_variance: float = 0.0, parent: Union[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel, NoneType] = <flax.linen.module._Sentinel object at 0x797df2f46930>, name: Optional[str] = None)

method DualA2CHypernet.__init__

__init__(
    target_policy_dict: dict,
    target_value_dict: dict,
    num_objs: int,
    obs_dim: int,
    hypersize: tuple = (128, 128),
    num_features: int = 8,
    W_variance: float = 0.0,
    parent: Optional[flax.linen.module.Module, flax.core.scope.Scope, flax.linen.module._Sentinel] = <flax.linen.module._Sentinel object at 0x797df2f46930>,
    name: Optional[str] = None
)  None

property DualA2CHypernet.path

Get the path of this Module. Top-level root modules have an empty path (). Note that this method can only be used on bound modules that have a valid scope.

Example usage:


   >>> import flax.linen as nn    >>> import jax, jax.numpy as jnp 

   >>> class SubModel(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'SubModel path: {self.path}')    ...     return x 

   >>> class Model(nn.Module):    ...   @nn.compact    ...   def __call__(self, x):    ...     print(f'Model path: {self.path}')    ...     return SubModel()(x) 

   >>> model = Model()    >>> variables = model.init(jax.random.key(0), jnp.ones((1, 2)))    Model path: ()    SubModel path: ('SubModel_0',) 

---

#### <kbd>property</kbd> DualA2CHypernet.variables

Returns the variables in this module. 



---

<a href="https://github.com/dynamicmobility/moplayground/blob/main/moplayground/moppo/networks/setup#L316"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `DualA2CHypernet.setup`

```python
setup()

method DualA2CHypernet.unflatten_params

unflatten_params(flat_params, target_network, single)

This site uses Just the Docs, a documentation theme for Jekyll.