code: def _prune_input_spec(input_spec, program, targets):
      # try to prune static program to figure out pruned input spec
      # so we perform following operations in static mode
      device = paddle.get_device()
      paddle.enable_static()
      paddle.set_device(device)
      pruned_input_spec = [{}]
      program = program.clone()
      program = program._prune(targets=targets)
      global_block = program.global_block()
      for name, spec in input_spec[0].items():
          try:
              v = global_block.var(name)
              pruned_input_spec[0][name] = spec
          except Exception:
              pass
      paddle.disable_static(place=device)
      return pruned_input_spec
  
file_path: PaddleDetection/ppdet/engine/export_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import yaml
  from collections import OrderedDict
  import paddle
  from ppdet.data.source.category import get_categories
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 2 for calling a global function with example usage: _prune_input_spec(input_spec, program, targets) and returns: pruned_input_spec