Module pearl.action_representation_modules.action_representation_module
Expand source code
from abc import ABC, abstractmethod
import torch
import torch.nn as nn
class ActionRepresentationModule(ABC, nn.Module):
"""
An abstract interface for action representation module.
"""
@abstractmethod
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass
Classes
class ActionRepresentationModule (*args, **kwargs)
-
An abstract interface for action representation module.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Expand source code
class ActionRepresentationModule(ABC, nn.Module): """ An abstract interface for action representation module. """ @abstractmethod def forward(self, x: torch.Tensor) -> torch.Tensor: pass
Ancestors
- abc.ABC
- torch.nn.modules.module.Module
Subclasses
- BinaryActionTensorRepresentationModule
- IdentityActionRepresentationModule
- OneHotActionTensorRepresentationModule
Methods
def forward(self, x: torch.Tensor) ‑> torch.Tensor
-
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the :class:
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.Expand source code
@abstractmethod def forward(self, x: torch.Tensor) -> torch.Tensor: pass