class_docstr: Dice loss for segmentation
docstr: Creates one binary mask per class
docstr_tok: ["Creates","one","binary","mask","per","class"]
code: def _one_hot(
      x: Tensor,  # Non one-hot encoded targs
      classes: int,  # The number of classes
      axis: int = 1,  # The axis to stack for encoding (class dimension)
  ) -> Tensor:
      "Creates one binary mask per class"
      return torch.stack(
          [torch.where(x == c, 1, 0) for c in range(classes)], axis=axis
      )
  
imports: from __future__ import annotations
  from .imports import *
  from .torch_imports import *
  from .torch_core import *
  from .layers import *
label_desc: Use image node_id 3 for calling the DiceLoss obj's underlying member method code with example usage: obj._one_hot(x, classes, axis) and returns: torch