randconv package

Submodules

randconv.loss module

randconv.loss.consistency_loss(lamb: float, y1: torch.Tensor, y2: torch.Tensor, y3: torch.Tensor)torch.Tensor[source]

Consistency loss:

\[ \begin{align}\begin{aligned}\lambda * \sum_{i=1}^{3} KLDivergence(y_i | y_k)\\y_i = (y_1 + y_2 + y_3) / 3\end{aligned}\end{align} \]
Parameters
  • lamb (float) – lambda from the paper

  • y1 – Output after random label

  • y2 – Output after random label

  • y3 – Output after random label

randconv.randconv module

randconv.randconv.randconv(image: torch.Tensor, K: int, mix: bool, p: float)torch.Tensor[source]

Outputs the image or the random convolution applied on the image.

Parameters
  • image (torch.Tensor) – input image

  • K (int) – maximum kernel size of the random convolution