code: def unwrap(tensor):
    
    while isinstance(tensor, (PrettyTensor, Loss)):
      tensor = tensor.tensor
    return tensor
docs: Returns the underlying tensor if tensor is wrapped or tensor.
  
    Args:
      tensor: The tensor to unwrap.
    Returns:
      Tensor or if it is a pretty tensor, the unwrapped version.
    Raises:
      ValueError: if tensor holds a sequence.