parameters: (np_tensor, input_format, out_format='HWC')
return_statement: return out_tensor
docstring: Convert the image format.
  
      Args:
          np_tensor (Tensor): The image data.
          input_format (str): Input data format.
          out_format (str): The output data format. Default: 'HWC'.
  
      Returns:
          Tensor, return format image.
docstring_summary: Convert the image format.
docstring_tokens: Convert the image format .
function: def _convert_image_format(np_tensor, input_format, out_format='HWC'):
      """
      Convert the image format.
  
      Args:
          np_tensor (Tensor): The image data.
          input_format (str): Input data format.
          out_format (str): The output data format. Default: 'HWC'.
  
      Returns:
          Tensor, return format image.
      """
      input_format = input_format.upper()
  
      # convert the NCHW
      if input_format != 'NCHW':
          index = [input_format.find(c) for c in 'NCHW']
          tensor_nchw = np_tensor.transpose(index)
      else:
          tensor_nchw = np_tensor
  
      # make grid to expand N
      tensor_chw = _make_canvas_for_imgs(tensor_nchw)
  
      # convert to out format
      out_index = ['CHW'.find(c) for c in out_format]
      out_tensor = tensor_chw.transpose(out_index)
      return out_tensor
function_tokens: def _convert_image_format ( np_tensor , input_format , out_format = 'HWC' ) : input_format = input_format . upper ( ) # convert the NCHW if input_format != 'NCHW' : index = [ input_format . find ( c ) for c in 'NCHW' ] tensor_nchw = np_tensor . transpose ( index ) else : tensor_nchw = np_tensor # make grid to expand N tensor_chw = _make_canvas_for_imgs ( tensor_nchw ) # convert to out format out_index = [ 'CHW' . find ( c ) for c in out_format ] out_tensor = tensor_chw . transpose ( out_index ) return out_tensor