d3rlpy.models.VectorEncoderFactory

class d3rlpy.models.VectorEncoderFactory(hidden_units=<factory>, activation='relu', use_batch_norm=False, dropout_rate=None, exclude_last_activation=False, last_activation=None)[source]

Vector encoder factory class.

This is the default encoder factory for vector observation.

Parameters:
  • hidden_units (list) – List of hidden unit sizes. If None, the standard architecture with [256, 256] is used.

  • activation (str) – activation function name.

  • use_batch_norm (bool) – Flag to insert batch normalization layers.

  • dropout_rate (float) – Dropout probability.

  • exclude_last_activation (bool) – Flag to exclude activation function at the last layer.

  • last_activation (str) – Activation function name for the last layer.

Methods

create(observation_shape)[source]

Returns PyTorch’s state enocder module.

Parameters:

observation_shape (Union[Sequence[int], Sequence[Sequence[int]]]) – observation shape.

Returns:

an enocder object.

Return type:

VectorEncoder

create_with_action(observation_shape, action_size, discrete_action=False)[source]

Returns PyTorch’s state-action enocder module.

Parameters:
  • observation_shape (Union[Sequence[int], Sequence[Sequence[int]]]) – observation shape.

  • action_size (int) – action size. If None, the encoder does not take action as input.

  • discrete_action (bool) – flag if action-space is discrete.

Returns:

an enocder object.

Return type:

VectorEncoderWithAction

classmethod deserialize(serialized_config)
Parameters:

serialized_config (str) –

Return type:

TConfig

classmethod deserialize_from_dict(dict_config)
Parameters:

dict_config (Dict[str, Any]) –

Return type:

TConfig

classmethod deserialize_from_file(path)
Parameters:

path (str) –

Return type:

TConfig

classmethod from_dict(kvs, *, infer_missing=False)
Parameters:

kvs (Optional[Union[dict, list, str, int, float, bool]]) –

Return type:

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters:

s (Union[str, bytes, bytearray]) –

Return type:

A

static get_type()[source]
Return type:

str

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters:
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type:

SchemaF[A]

serialize()
Return type:

str

serialize_to_dict()
Return type:

Dict[str, Any]

to_dict(encode_json=False)
Return type:

Dict[str, Optional[Union[dict, list, str, int, float, bool]]]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters:
Return type:

str

Attributes

activation: str = 'relu'
dropout_rate: Optional[float] = None
exclude_last_activation: bool = False
last_activation: Optional[str] = None
use_batch_norm: bool = False
hidden_units: List[int]