class_docstr: Convert to one-hot vector.
  
  Args:
      depth (int): Dimension of one-hot vector.
class_docstr_tok: ["Convert","to","one-hot","vector",".","Args",":","depth","(","int",")",":","Dimension","of","one-hot","vector","."]
docstr: Calculate forward propagation.
  
  Args:
      x (LongTensor): long tensor variable with the shape  (B, T)
  
  Returns:
      Tensor: float tensor variable with the shape (B, depth, T)
docstr_tok: ["Calculate","forward","propagation",".","Args",":","x","(","LongTensor",")",":","long","tensor","variable","with","the","shape","(","B",",","T",")","Returns",":","Tensor",":","float","tensor","variable","with","the","shape","(","B",",","depth",",","T",")"]
code: def forward(self, x):
      """Calculate forward propagation.
  
      Args:
          x (LongTensor): long tensor variable with the shape  (B, T)
  
      Returns:
          Tensor: float tensor variable with the shape (B, depth, T)
  
      """
      x = x % self.depth
      x = torch.unsqueeze(x, 2)
      x_onehot = x.new_zeros(x.size(0), x.size(1), self.depth).float()
  
      return x_onehot.scatter_(2, x, 1)
  
imports: import logging
  import sys
  import time
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 2 for calling the OneHot obj's underlying member method code with example usage: obj.forward(x) and returns: x_onehot