torchoutil.nn.modules.multiclass module¶
- class IndexToName( )[source]¶
Bases:
Generic[T_Name],ModuleFor more information, see
index_to_name().- forward( ) List[T_Name][source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class IndexToOnehot(
- num_classes: int,
- *,
- padding_idx: int | None = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = torch.bool,
Bases:
EModuleFor more information, see
index_to_onehot().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward( ) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class NameToIndex( )[source]¶
Bases:
Generic[T_Name],ModuleFor more information, see
name_to_index().- forward(
- name: List[T_Name],
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class NameToOnehot(
- idx_to_name: Mapping[int, T_Name] | Sequence[T_Name],
- *,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = torch.bool,
Bases:
Generic[T_Name],ModuleFor more information, see
name_to_onehot().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- name: List[T_Name],
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class OnehotToIndex(
- dim: int = -1,
Bases:
EModuleFor more information, see
onehot_to_index().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- onehot: Tensor,
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class OnehotToName( )[source]¶
Bases:
Generic[T_Name],ModuleFor more information, see
onehot_to_name().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- onehot: Tensor,
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class ProbsToIndex(
- dim: int = -1,
Bases:
EModuleFor more information, see
probs_to_index().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- probs: Tensor,
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class ProbsToName( )[source]¶
Bases:
Generic[T_Name],ModuleFor more information, see
probs_to_name().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- probs: Tensor,
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class ProbsToOnehot(
- *,
- dim: int = -1,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = torch.bool,
Bases:
EModuleFor more information, see
probs_to_onehot().- extra_repr() str[source]¶
Set the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(
- probs: Tensor,
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.