def one_hot_encoding(input_tensor, num_labels):
xview = input_tensor.view(-<NUM_LIT:1>, <NUM_LIT:1>).to(torch.long)<EOL>onehot = torch.zeros(xview.size(<NUM_LIT:0>), num_labels, device=input_tensor.device, dtype=torch.float)<EOL>onehot.scatter_(<NUM_LIT:1>, xview, <NUM_LIT:1>)<EOL>return onehot.view(list(input_tensor.shape) + [-<NUM_LIT:1>])<EOL>
One-hot encode labels from input