actor#


class ActorFactory[source]#
abstract create_module(envs: Environments, device: str | device) BaseActor | Module[source]#
create_module_opt(envs: Environments, device: str | device, optim_factory: OptimizerFactory, lr: float) ModuleOpt[source]#

Creates the actor module along with its optimizer for the given learning rate.

Parameters:
  • envs – the environments

  • device – the torch device

  • optim_factory – the optimizer factory

  • lr – the learning rate

Returns:

a container with the actor module and its optimizer

class ActorFactoryContinuous[source]#

Serves as a type bound for actor factories that are suitable for continuous action spaces.

class ActorFactoryContinuousDeterministicNet(hidden_sizes: ~collections.abc.Sequence[int], activation: type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>)[source]#
create_module(envs: Environments, device: str | device) BaseActor[source]#
class ActorFactoryContinuousGaussianNet(hidden_sizes: ~collections.abc.Sequence[int], unbounded: bool = True, conditioned_sigma: bool = False, activation: type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>)[source]#
create_module(envs: Environments, device: str | device) BaseActor[source]#
class ActorFactoryDefault(continuous_actor_type: ~tianshou.highlevel.module.actor.ContinuousActorType, hidden_sizes: ~collections.abc.Sequence[int] = (64, 64), hidden_activation: type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>, continuous_unbounded: bool = False, continuous_conditioned_sigma: bool = False, discrete_softmax: bool = True)[source]#

An actor factory which, depending on the type of environment, creates a suitable MLP-based policy.

DEFAULT_HIDDEN_SIZES = (64, 64)#
create_module(envs: Environments, device: str | device) BaseActor[source]#
class ActorFactoryDiscreteNet(hidden_sizes: ~collections.abc.Sequence[int], softmax_output: bool = True, activation: type[~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>)[source]#
create_module(envs: Environments, device: str | device) BaseActor[source]#
class ActorFactoryTransientStorageDecorator(actor_factory: ActorFactory, actor_future: ActorFuture)[source]#

Wraps an actor factory, storing the most recently created actor instance such that it can be retrieved.

create_module(envs: Environments, device: str | device) BaseActor | Module[source]#
class ActorFuture(actor: BaseActor | Module | None = None)[source]#

Container, which, in the future, will hold an actor instance.

actor: BaseActor | Module | None = None#
class ActorFutureProviderProtocol(*args, **kwargs)[source]#
get_actor_future() ActorFuture[source]#
class ContinuousActorType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
DETERMINISTIC = 'deterministic'#
GAUSSIAN = 'gaussian'#
UNSUPPORTED = 'unsupported'#
class IntermediateModuleFactoryFromActorFactory(actor_factory: ActorFactory)[source]#
create_intermediate_module(envs: Environments, device: str | device) IntermediateModule[source]#