torchwrench.nn.modules.multilabel module

torchwrench.nn.modules.multilabel.IndicesToMultihot

alias of MultiIndicesToMultihot

torchwrench.nn.modules.multilabel.IndicesToMultinames

alias of MultiIndicesToMultinames

class torchwrench.nn.modules.multilabel.MultiIndicesToMultihot(num_classes: int, *, padding_idx: int | None = None, device: device | None | 'default' | 'cuda_if_available' | str | int = None, dtype: dtype | None | 'default' | str | DTypeEnum = torch.bool)[source]

Bases: Module

For more information, see indices_to_multihot().

extra_repr() str[source]

Return 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 torchwrench.nn.modules.multilabel.MultiIndicesToMultinames(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]

Return 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.

torchwrench.nn.modules.multilabel.MultihotToIndices

alias of MultihotToMultiIndices

class torchwrench.nn.modules.multilabel.MultihotToMultiIndices(*, padding_idx: int | None = None)[source]

Bases: Module

For more information, see multihot_to_indices().

extra_repr() str[source]

Return 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 torchwrench.nn.modules.multilabel.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.

torchwrench.nn.modules.multilabel.MultinamesToIndices

alias of MultinamesToMultiIndices

class torchwrench.nn.modules.multilabel.MultinamesToMultiIndices(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.

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

Bases: Generic[T_Name], Module

For more information, see multinames_to_multihot().

extra_repr() str[source]

Return 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.

torchwrench.nn.modules.multilabel.ProbsToIndices

alias of ProbsToMultiIndices

class torchwrench.nn.modules.multilabel.ProbsToMultiIndices(threshold: float | Tensor, *, padding_idx: int | None = None)[source]

Bases: Module

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 torchwrench.nn.modules.multilabel.ProbsToMultihot(threshold: float | Tensor, *, device: device | None | 'default' | 'cuda_if_available' | str | int = None, dtype: dtype | None | 'default' | str | DTypeEnum = torch.bool)[source]

Bases: Module

For more information, see probs_to_multihot().

extra_repr() str[source]

Return 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 torchwrench.nn.modules.multilabel.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.