Skip to content

MultiTaskLoss

MultiTaskLoss

Bases: ModuleDict

forward

forward(
    yhats: Dict[str, Tensor],
    targets: Dict[str, Tensor],
    mask: Tensor = None,
    **kwargs,
) -> torch.Tensor

Compute the joint loss of the multi-task network.

Parameters:

Name Type Description Default
yhats Dict[str, Tensor]

Dictionary of head names mapped to the predicted masks. e.g. {"inst": (B, C, H, W), "type": (B, C, H, W)}.

required
targets Dict[str, Tensor]

Dictionary of head names mapped to the GT masks. e.g. {"inst": (B, C, H, W), "type": (B, C, H, W)}.

required
mask torch.Tensor, default=None

The mask for masked losses. Shape (B, H, W).

None

Returns:

Type Description
Tensor

torch.Tensor: Computed multi-task loss (Scalar).

extra_repr

extra_repr() -> str

Add info to print.