code: def flatten_tensor(inputs, channel_first=False):
      """
      Flatten a Tensor
      Args:
          inputs (Tensor): 4-D Tensor with shape [N, C, H, W] or [N, H, W, C]
          channel_first (bool): If true the dimension order of Tensor is
              [N, C, H, W], otherwise is [N, H, W, C]
      Return:
          output_channel_last (Tensor): The flattened Tensor in channel_last style
      """
      if channel_first:
          input_channel_last = paddle.transpose(
              inputs, perm=[0, 2, 3, 1]
          )
      else:
          input_channel_last = inputs
      output_channel_last = paddle.flatten(
          input_channel_last, start_axis=0, stop_axis=2
      )
      return output_channel_last
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from ppdet.modeling import ops
  from functools import partial
label_desc: Use image node_id 1 for calling a global function with example usage: flatten_tensor(inputs, channel_first) and returns: output_channel_last