# Run inference

Source: [https://docs.qualcomm.com/doc/80-70014-54/topic/run-inference.html](https://docs.qualcomm.com/doc/80-70014-54/topic/run-inference.html)

You can use the TensorFlow Lite C++ APIs to create an application, load a TensorFlow
        Lite model, and execute the model on hardware using delegates.

A typical application created using C++ APIs to run a TensorFlow Lite model involves the
            following steps:

Figure : Workflow to create an application and run a TensorFlow Lite model
            
            <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export tensorflow-lite-model-application-flow.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="12.2639in" height="1.19444in" viewbox="0 0 883 86" xml:space="preserve" color-interpolation-filters="sRGB" class="st7"><v:documentproperties v:langid="1033" v:viewmarkup="false">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-1 .st1 { fill: #f7f8fa; stroke: #f7f8fa; stroke-width: 1 }
.svg-1 .st2 { fill: none; stroke: #3253dc; stroke-width: 1 }
.svg-1 .st3 { fill: #000000; font-family: Arial; font-size: 0.833336em }
.svg-1 .st4 { font-size: 1em }
.svg-1 .st5 { marker-end: url("#mrkr4-27"); stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st6 { fill: #3253dc; fill-opacity: 1; stroke: #3253dc; stroke-opacity: 1; stroke-width: 0.28409090909091 }
.svg-1 .st7 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend4">		<path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"></path>	</g>	<marker id="mrkr4-27" class="st6" v:arrowtype="4" v:arrowsize="2" v:setback="7.04" refx="-7.04" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend4" transform="scale(-3.52,-3.52) "></use>	</marker></defs><g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<v:userdefs>		<v:ud v:nameu="msvThemeOrder" v:val="VT0(0):26"></v:ud>	</v:userdefs>	<title>Page-1</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<v:layer v:name="Callout" v:index="0"></v:layer>	<v:layer v:name="Connector" v:index="1"></v:layer>	<g id="group14-1" transform="translate(18,-18)" v:mid="14" v:groupcontext="group">		<title></title>		<g id="shape13-2" v:mid="13" v:groupcontext="shape">			<title></title>			<rect x="0" y="36" width="847" height="50" class="st1"></rect>		</g>		<g id="shape3-4" v:mid="3" v:groupcontext="shape" transform="translate(1.5,-1.75)">			<title></title>			<desc>Load a TensorFlow Lite model</desc>			<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>			<v:textrect cx="71" cy="62.75" width="142" height="46.5"></v:textrect>			<rect x="0" y="39.5" width="142" height="46.5" class="st2"></rect>			<text x="18.75" y="59.75" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Load a TensorFlow Lite <tspan x="57.38" dy="1.2em" class="st4">model</tspan></text>			</g>		<g id="shape5-8" v:mid="5" v:groupcontext="shape" transform="translate(177,-1.75)">			<title></title>			<desc>Create a TensorFlow Lite interpreter</desc>			<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>			<v:textrect cx="71" cy="62.75" width="142" height="46.5"></v:textrect>			<rect x="0" y="39.5" width="142" height="46.5" class="st2"></rect>			<text x="14.86" y="59.75" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Create a TensorFlow Lite <tspan x="48.21" dy="1.2em" class="st4">interpreter</tspan></text>			</g>		<g id="shape6-12" v:mid="6" v:groupcontext="shape" transform="translate(352.5,-1.75)">			<title></title>			<desc>Prepare a model with a chosen delegate</desc>			<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>			<v:textrect cx="71" cy="62.75" width="142" height="46.5"></v:textrect>			<rect x="0" y="39.5" width="142" height="46.5" class="st2"></rect>			<text x="19.58" y="59.75" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Prepare a model with a <tspan x="34.3" dy="1.2em" class="st4">chosen delegate</tspan></text>			</g>		<g id="shape7-16" v:mid="7" v:groupcontext="shape" transform="translate(528,-1.75)">			<title></title>			<desc>Prepare input/output buffers</desc>			<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>			<v:textrect cx="71" cy="62.75" width="142" height="46.5"></v:textrect>			<rect x="0" y="39.5" width="142" height="46.5" class="st2"></rect>			<text x="9.01" y="65.75" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Prepare input/output buffers</text>			</g>		<g id="shape8-19" v:mid="8" v:groupcontext="shape" transform="translate(703.5,-1.75)">			<title></title>			<desc>Run a model</desc>			<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>			<v:textrect cx="71" cy="62.75" width="142" height="46.5"></v:textrect>			<rect x="0" y="39.5" width="142" height="46.5" class="st2"></rect>			<text x="42.65" y="65.75" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Run a model</text>			</g>		<g id="shape9-22" v:mid="9" v:groupcontext="shape" v:layermember="1" transform="translate(143.5,-16)">			<title></title>			<path d="M0 77 L26.46 77" class="st5"></path>		</g>		<g id="shape10-28" v:mid="10" v:groupcontext="shape" v:layermember="1" transform="translate(319,-16)">			<title></title>			<path d="M0 77 L26.46 77" class="st5"></path>		</g>		<g id="shape11-33" v:mid="11" v:groupcontext="shape" v:layermember="1" transform="translate(494.5,-16)">			<title></title>			<path d="M0 77 L26.46 77" class="st5"></path>		</g>		<g id="shape12-38" v:mid="12" v:groupcontext="shape" v:layermember="1" transform="translate(670,-16)">			<title></title>			<path d="M0 77 L26.46 77" class="st5"></path>		</g>	</g></g>
</svg>

- **[Load a TensorFlow Lite model](https://docs.qualcomm.com/doc/80-70014-54/topic/load-a-tensorflow-lite-model.html)**  

A TensorFlow Lite model is a FlatBuffers file that contains information on model         operators and any associated weights and biases.
- **[Create a TensorFlow Lite interpreter](https://docs.qualcomm.com/doc/80-70014-54/topic/create-a-tensorflow-lite-interpreter.html)**  

Using the TensorFlow C/C++ APIs, you can build an interpreter to run the         model.
- **[Prepare a model with a chosen delegate](https://docs.qualcomm.com/doc/80-70014-54/topic/prepare-a-model-with-a-chosen-delegate.html)**  

After creating an interpreter and allocating the necessary memory to run the model,         prepare the model with a chosen delegate. This step creates an execution graph from the         model loaded before and uses the underlying library to perform inference on the delegate         hardware.
- **[Prepare input/output buffers](https://docs.qualcomm.com/doc/80-70014-54/topic/prepare-input-output-buffers.html)**  

When building a standalone TensorFlow Lite application, the pipeline to execute         TensorFlow Lite models requires preparing input data, for example, camera         frames.
- **[Run a model](https://docs.qualcomm.com/doc/80-70014-54/topic/execute-a-model.html)**  

To run inference, invoke a delegate using the `Invoke()` API. Before         invoking this API, create the appropriate input and output buffers and provide them to the         interpreter.

**Parent Topic:** [TensorFlow Lite developer workflow](https://docs.qualcomm.com/doc/80-70014-54/topic/tensorflow-lite-developer-workflow.html)

Last Published: Jul 12, 2024

[Previous Topic
Convert using offline converter tool (CLI)](https://docs.qualcomm.com/bundle/publicresource/80-70014-54/topics/convert-using-offline-converter-tool-cli.md) [Next Topic
Load a TensorFlow Lite model](https://docs.qualcomm.com/bundle/publicresource/80-70014-54/topics/load-a-tensorflow-lite-model.md)