d3rlpy.models.encoders.DenseEncoderFactory

class d3rlpy.models.encoders.DenseEncoderFactory(activation='relu', use_batch_norm=False, dropout_rate=None)[source]

DenseNet encoder factory class.

This is an alias for DenseNet architecture proposed in D2RL. This class does exactly same as follows.

from d3rlpy.encoders import VectorEncoderFactory

factory = VectorEncoderFactory(hidden_units=[256, 256, 256, 256],
                               use_dense=True)

For now, this only supports vector observations.

References

Parameters
  • activation (str) – activation function name.

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

  • dropout_rate (float) – dropout probability.

Methods

create(observation_shape)[source]

Returns PyTorch’s state enocder module.

Parameters

observation_shape (Sequence[int]) – observation shape.

Returns

an enocder object.

Return type

d3rlpy.models.torch.encoders.VectorEncoder

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

Returns PyTorch’s state-action enocder module.

Parameters
  • observation_shape (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

d3rlpy.models.torch.encoders.VectorEncoderWithAction

get_params(deep=False)[source]

Returns encoder parameters.

Parameters

deep (bool) – flag to deeply copy the parameters.

Returns

encoder parameters.

Return type

Dict[str, Any]

get_type()

Returns encoder type.

Returns

encoder type.

Return type

str

Attributes

TYPE: ClassVar[str] = 'dense'