code: def export(
      model,
      args,
      directory=None,
      export_params=True,
      graph_name="Graph",
  ):
      """(Experimental) Export a computational graph as Caffe format.
  
      Args:
          model (~chainer.Chain): The model object you want to export in Caffe
              format. It should have :meth:`__call__` method because the second
              argument ``args`` is directly given to the model by the ``()``
              accessor.
          args (list of ~chainer.Variable): The arguments which are given to the
              model directly.
          directory (str): The directory used for saving the resulting Caffe
              model. If None, nothing is saved to the disk.
          export_params (bool): If True, this function exports all the parameters
              included in the given model at the same time. If False, the
              exported Caffe model doesn't include any parameter values.
          graph_name (str): A string to be used for the ``name`` field of the
              graph in the exported Caffe model.
  
      .. note::
          Currently, this function supports networks that created by following
          layer functions.
  
          - :func:`~chainer.functions.linear`
          - :func:`~chainer.functions.convolution_2d`
          - :func:`~chainer.functions.deconvolution_2d`
          - :func:`~chainer.functions.max_pooling_2d`
          - :func:`~chainer.functions.average_pooling_2d`
          - :func:`~chainer.functions.batch_normalization`
          - :func:`~chainer.functions.local_response_normalization`
          - :func:`~chainer.functions.relu`
          - :func:`~chainer.functions.leaky_relu`
          - :func:`~chainer.functions.concat`
          - :func:`~chainer.functions.softmax`
          - :func:`~chainer.functions.reshape`
          - :func:`~chainer.functions.add`
  
          This function can export at least following networks.
  
          - GoogLeNet
          - ResNet
          - VGG
  
          And, this function use testing (evaluation) mode.
  
      .. admonition:: Example
  
         >>> from chainer.exporters import caffe
         >>>
         >>> class Model(chainer.Chain):
         ...    def __init__(self):
         ...        super(Model, self).__init__()
         ...        with self.init_scope():
         ...            self.l1 = L.Convolution2D(None, 1, 1, 1, 0)
         ...            self.b2 = L.BatchNormalization(1)
         ...            self.l3 = L.Linear(None, 1)
         ...
         ...    def __call__(self, x):
         ...        h = F.relu(self.l1(x))
         ...        h = self.b2(h)
         ...        return self.l3(h)
         ...
         >>> x = chainer.Variable(np.zeros((1, 10, 10, 10), np.float32))
         >>> caffe.export(Model(), [x], None, True, 'test')
  
      """
  
      assert isinstance(args, (tuple, list))
      if len(args) != 1:
          raise NotImplementedError()
      for i in args:
          assert isinstance(i, variable.Variable)
      with function.force_backprop_mode(), chainer.using_config(
          "train", False
      ):
          output = model(*args)
  
      if isinstance(output, variable.Variable):
          output = [output]
      assert isinstance(output, (tuple, list))
      for i in output:
          assert isinstance(i, variable.Variable)
  
      prototxt = None
      caffemodel = None
      if directory is not None:
          prototxt = os.path.join(directory, "chainer_model.prototxt")
          if export_params:
              caffemodel = os.path.join(
                  directory, "chainer_model.caffemodel"
              )
      retriever = _RetrieveAsCaffeModel(prototxt, caffemodel)
      retriever(graph_name, args, output)
  
imports: import collections
  import heapq
  import os
  import numpy
  import six
  import chainer
  from chainer import function
  from chainer import function_node
  from chainer.links.caffe.protobuf3 import caffe_pb2
  from chainer import variable
label_desc: Use image node_id 3 for calling a global function with example usage: export(model, args, directory, export_params, graph_name) without return types