torchoutil.nn.modules.powerset module

class MultilabelToPowerset(
num_classes: int,
max_set_size: int,
)[source]

Bases: EModule

Module version of multilabel_to_powerset().

forward(
multilabel: 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.

property max_set_size: int
property num_classes: int
property num_powerset_classes: int
class PowersetToMultilabel(
num_classes: int,
max_set_size: int,
soft: bool = False,
)[source]

Bases: EModule

Module version of powerset_to_multilabel().

forward(
powerset: Tensor,
soft: bool | None = None,
) Tensor3D[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.

property max_set_size: int
property num_classes: int
property num_powerset_classes: int
property soft: bool