one_hot

dragon.vm.torch.one_hot(
  input,
  depth
)[source]

Return the one-hot representation for input.

\[\text{out}[i][j] = \begin{cases} \text{Val}_{off}, & \text{ if } \text{input}[i] \neq j \\ \text{Val}_{on}, & \text{ otherwise } \end{cases} \]
Parameters:
Returns:

dragon.vm.torch.Tensor – The output tensor.