code: def _flatten(x):
      shape = x.shape
      if x.dim() == 2:
          flat_x = x
      else:
          flat_size = reduce(mul, shape[1:])
          flat_x = x.reshape(x.shape[0], flat_size)
  
      return shape, flat_x
  
file_path: advertorch/advertorch/attacks/blackbox/utils.py
imports: from math import inf
  from operator import mul
  from functools import reduce
  import numpy
  import torch
  from advertorch.utils import batch_clamp
label_desc: Use image node_id 3 for calling a global function with example usage: _flatten(x) and returns: shape,  flat_x