code: def sg_one_hot(tensor, opt):
      r
      assert opt.depth is not None, 'depth is mandatory.'
      return tf.one_hot(tensor, opt.depth, name=opt.name)
docs: r"""Converts a tensor into a one-hot tensor.
      
      See `tf.one_hot()` in tensorflow.
  
      Args:
        tensor: A `Tensor` ( automatically given by chain )
        opt:
          depth: The number of classes.
          name: If provided, replace current tensor's name.
  
      Returns:
          A `Tensor`.