code: def TranslateFlatten(layer, pretrained_blobs, is_test, **kwargs):
      param = layer.flatten_param
      if param.end_axis != -1:
          raise NotImplementedError(
              "flatten_param.end_axis not supported yet."
          )
  
      if param.axis == 0:
          caffe_op = BaseTranslate(layer, "FlattenToVec")
      elif param.axis == 1:
          caffe_op = BaseTranslate(layer, "Flatten")
      else:
          # This could be a Reshape op, but dim size is not known here.
          raise NotImplementedError(
              "Not supported yet for flatten_param.axis {}.".format(
                  param.axis
              )
          )
  
      return caffe_op, []
  
imports: import argparse
  import copy
  import logging
  import re
  import numpy
  from caffe2.proto import caffe2_pb2, caffe2_legacy_pb2
  from caffe.proto import caffe_pb2
  from caffe2.python import core, utils, workspace
  from google.protobuf import text_format
label_desc: Use image node_id 37 for calling a global function with example usage: TranslateFlatten(layer, pretrained_blobs, is_test) and returns: caffe_op,  list