.. inclusion-marker-start-do-not-remove

Inference
=========

What about inference? Inference may be done outside of the Python script that was used to train the model. If you do this, it
will not have references to the Horovod library.

To run inference on a checkpoint generated by the Horovod-enabled training script you should optimize the graph and only
keep operations necessary for a forward pass through model. The `Optimize for Inference <https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/optimize_for_inference.py>`__
script from the TensorFlow repository will do that for you.

If you want to convert your checkpoint to `Frozen Graph <https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py>`__,
you should do so after doing the optimization described above, otherwise the `Freeze Graph <https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py>`__
script will fail to load Horovod op:

.. code-block:: bash

    ValueError: No op named HorovodAllreduce in defined operations.


.. inclusion-marker-end-do-not-remove
