torchoutil.nn.modules.multilabel module

class IndicesToMultihot(
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,
)[source]

Bases: EModule

For more information, see indices_to_multihot().

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(
indices: List[List[int]] | List[Tensor],
) 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class IndicesToMultinames(
idx_to_name: Mapping[int, T_Name],
*,
padding_idx: int | None = None,
)[source]

Bases: Generic[T_Name], Module

For more information, see indices_to_multinames().

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(
indices: List[List[int]] | List[Tensor],
) List[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class MultihotToIndices(
*,
padding_idx: int | None = None,
)[source]

Bases: EModule

For more information, see multihot_to_indices().

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(
multihot: Tensor,
) List | LongTensor[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class MultihotToMultinames(
idx_to_name: Mapping[int, T_Name],
)[source]

Bases: Generic[T_Name], Module

For more information, see multihot_to_multinames().

forward(
multihot: Tensor,
) List[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class MultinamesToIndices(
idx_to_name: Mapping[int, T_Name],
)[source]

Bases: Generic[T_Name], Module

For more information, see multinames_to_indices().

forward(
names: List[List[T_Name]],
) List[List[int]][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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class MultinamesToMultihot(
idx_to_name: Mapping[int, T_Name],
*,
device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
dtype: dtype | None | Literal['default'] | str | DTypeEnum = torch.bool,
)[source]

Bases: Generic[T_Name], Module

For more information, see multinames_to_multihot().

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(
names: List[List[T_Name]],
) 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
class ProbsToIndices(
threshold: float | Tensor,
*,
padding_idx: int | None = None,
)[source]

Bases: EModule

For more information, see probs_to_indices().

forward(
probs: Tensor,
) List | LongTensor[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class ProbsToMultihot(
threshold: float | Tensor,
*,
device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
dtype: dtype | None | Literal['default'] | str | DTypeEnum = torch.bool,
)[source]

Bases: EModule

For more information, see probs_to_multihot().

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,
) 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class ProbsToMultinames(
threshold: float | Tensor,
idx_to_name: Mapping[int, T_Name],
)[source]

Bases: Generic[T_Name], Module

For more information, see probs_to_multinames().

forward(
probs: Tensor,
) List[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool