'Initialise the export process.
Example:
.. code-block:: python
from mnist_superresolution import Model
from tensorpack.tfutils import export
e = ModelExport(Model(), [\'lowres\'], [\'prediction\'])
e.export(\'train_log/mnist_superresolution/checkpoint\', \'export/first_export\')
Will generate a model for TensorFlow serving with input \'lowres\' and
output \'prediction\'. The model is in the directory \'export\' and can be
loaded by
.. code-block:: python
import tensorflow as tf
from tensorflow.python.saved_model import tag_constants
export_dir = \'export/first_export\'
with tf.Session(graph=tf.Graph(), config=tf.ConfigProto(allow_soft_placement=True)) as sess:
tf.saved_model.loader.load(sess, [tag_constants.SERVING], export_dir)
prediction = tf.get_default_graph().get_tensor_by_name(\'prediction:0\')
lowres = tf.get_default_graph().get_tensor_by_name(\'lowres:0\')
prediction = sess.run(prediction, {lowres: ...})[0]
Args:
model (ModelDesc): the model description which should be exported
input_names (list(str)): names of input tensors
output_names (list(str)): names of output tensors'

def __init__(self, model, input_names, output_names):

    assert isinstance(input_names, list)
    assert isinstance(output_names, list)
    assert isinstance(model, ModelDesc)
    logger.info('[export]    prepare    new    model    export')
    super(ModelExport, self).__init__()
    self.model = model
    self.input = PlaceholderInput()
    self.input.setup(self.model.get_inputs_desc())
    self.output_names = output_names
    self.input_names = input_names
