peal.architectures.basic_modules.OneHotEncoding

class peal.architectures.basic_modules.OneHotEncoding[source]

Bases: Module

One-hot encode integer inputs that arrive as a 2D tensor.

Parameters:

num_classes (int) – Size of the one-hot axis appended by torch.nn.functional.one_hot.

Methods

forward

Return one_hot(x) if x is 2D, otherwise x unchanged.

__init__(num_classes)[source]
forward(x)[source]

Return one_hot(x) if x is 2D, otherwise x unchanged.