code: def check_optimization_criteria(nnp, batch_size):
      def find_network(nnp, exe):
          net = None
          for network in nnp.protobuf.network:
              if network.name == exe.network_name:
                  net = network
          return net
  
      def get_input_info(exec_info, network):
          input_dict = collections.OrderedDict()
          for v in exec_info.data_variable:
              input_dict[v.variable_name] = []
          for v in network.variable:
              if v.name in input_dict:
                  shape = v.shape.dim
                  input_dict[v.name] = [
                      x if x > 0 else batch_size for x in shape
                  ]
          return input_dict
  
      state = {
          "NCHW_TO_NHWC": {
              "doc": "Convert the NCHW format to NHWC, and remove the extra nodes",
              "status": True,
          }
      }
      func_list = [
          "Convolution",
          "Deconvolution",
          "MaxPooling",
          "AveragePooling",
          "SumPooling",
          "Unpooling",
          "Interpolate",
          "RandomErase",
          "MaxPoolingBackward",
      ]
      func_cnt = collections.Counter()
      exec_info = nnp.protobuf.executor[0]
      network = find_network(nnp, exec_info)
      input_dict = get_input_info(exec_info, network)
      for k, shape in input_dict.items():
          if len(shape) != 4:
              state["NCHW_TO_NHWC"]["status"] = False
              break
      for func in network.function:
          if func.type in func_list:
              func_cnt[func.type] += 1
          for inp in func.input:
              if (
                  inp in input_dict
                  and len(func.ListFields()) > 4
                  and hasattr(func.ListFields()[-1][1], "base_axis")
                  and func.ListFields()[-1][1].base_axis != 1
              ):
                  state["NCHW_TO_NHWC"]["status"] = False
                  break
      if len(func_cnt) == 0:
          state["NCHW_TO_NHWC"]["status"] = False
      return state
  
file_path: nnabla/python/src/nnabla/utils/converter/tensorflow/common.py
imports: import collections
  from .refine_graph import RefineGraph
  from .refine_parser import RefineParser
label_desc: Use image node_id 3 for calling a global function with example usage: check_optimization_criteria(nnp, batch_size) and returns: state, net, input_dict