def sg_one_hot(tensor, opt):
    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`.
    """
    assert opt.depth is not None, 'depth is mandatory.'
    return tf.one_hot(tensor, opt.depth, name=opt.name)
def sg_one_hot ( tensor , opt ) : assert opt . depth is not None , 'depth is mandatory.' return tf . one_hot ( tensor , opt . depth , name = opt . name )
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`.