parameters: (obj, encoding='utf-8', inplace=False)
docstring: All string in PaddlePaddle should be represented as a literal string.
      
      This function will convert object to a literal string without any encoding.
      Especially, if the object type is a list or set container, we will iterate
      all items in the object and convert them to literal string.
  
      In Python3:
          Decode the bytes type object to str type with specific encoding
  
      In Python2:
          Decode the str type object to unicode type with specific encoding
  
      Args:
          obj(unicode|str|bytes|list|set) : The object to be decoded.
          encoding(str) : The encoding format to decode a string
          inplace(bool) : If we change the original object or we create a new one
  
      Returns:
          Decoded result of obj
      
      Examples:
  
          .. code-block:: python
  
              import paddle
  
              data = "paddlepaddle"
              data = paddle.compat.to_text(data)
              # paddlepaddle
docstring_summary: All string in PaddlePaddle should be represented as a literal string.
      
      This function will convert object to a literal string without any encoding.
      Especially, if the object type is a list or set container, we will iterate
      all items in the object and convert them to literal string.
docstring_tokens: All string in PaddlePaddle should be represented as a literal string . This function will convert object to a literal string without any encoding . Especially if the object type is a list or set container we will iterate all items in the object and convert them to literal string .
function: def to_text(obj, encoding='utf-8', inplace=False):
      """
      All string in PaddlePaddle should be represented as a literal string.
      
      This function will convert object to a literal string without any encoding.
      Especially, if the object type is a list or set container, we will iterate
      all items in the object and convert them to literal string.
  
      In Python3:
          Decode the bytes type object to str type with specific encoding
  
      In Python2:
          Decode the str type object to unicode type with specific encoding
  
      Args:
          obj(unicode|str|bytes|list|set) : The object to be decoded.
          encoding(str) : The encoding format to decode a string
          inplace(bool) : If we change the original object or we create a new one
  
      Returns:
          Decoded result of obj
      
      Examples:
  
          .. code-block:: python
  
              import paddle
  
              data = "paddlepaddle"
              data = paddle.compat.to_text(data)
              # paddlepaddle
  
      """
      if obj is None:
          return obj
  
      if isinstance(obj, list):
          if inplace:
              for i in six.moves.xrange(len(obj)):
                  obj[i] = _to_text(obj[i], encoding)
              return obj
          else:
              return [_to_text(item, encoding) for item in obj]
      elif isinstance(obj, set):
          if inplace:
              for item in obj:
                  obj.remove(item)
                  obj.add(_to_text(item, encoding))
              return obj
          else:
              return set([_to_text(item, encoding) for item in obj])
      elif isinstance(obj, dict):
          if inplace:
              new_obj = {}
              for key, value in six.iteritems(obj):
                  new_obj[_to_text(key, encoding)] = _to_text(value, encoding)
              obj.update(new_obj)
              return obj
          else:
              new_obj = {}
              for key, value in six.iteritems(obj):
                  new_obj[_to_text(key, encoding)] = _to_text(value, encoding)
              return new_obj
      else:
          return _to_text(obj, encoding)
function_tokens: def to_text ( obj , encoding = 'utf-8' , inplace = False ) : if obj is None : return obj if isinstance ( obj , list ) : if inplace : for i in six . moves . xrange ( len ( obj ) ) : obj [ i ] = _to_text ( obj [ i ] , encoding ) return obj else : return [ _to_text ( item , encoding ) for item in obj ] elif isinstance ( obj , set ) : if inplace : for item in obj : obj . remove ( item ) obj . add ( _to_text ( item , encoding ) ) return obj else : return set ( [ _to_text ( item , encoding ) for item in obj ] ) elif isinstance ( obj , dict ) : if inplace : new_obj = { } for key , value in six . iteritems ( obj ) : new_obj [ _to_text ( key , encoding ) ] = _to_text ( value , encoding ) obj . update ( new_obj ) return obj else : new_obj = { } for key , value in six . iteritems ( obj ) : new_obj [ _to_text ( key , encoding ) ] = _to_text ( value , encoding ) return new_obj else : return _to_text ( obj , encoding )