mirror of https://github.com/vladmandic/human
125 lines
61 KiB
HTML
125 lines
61 KiB
HTML
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GraphModel | @vladmandic/human - v3.2.2</title><meta name="description" content="Documentation for @vladmandic/human"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@vladmandic/human - v3.2.2</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human</a></li><li><a href="GraphModel.html">GraphModel</a></li></ul><h1>Class GraphModel<ModelURL></h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>A <code>tf.GraphModel</code> is a directed, acyclic graph built from a
|
||
SavedModel GraphDef and allows inference execution.</p>
|
||
<p>A <code>tf.GraphModel</code> can only be created by loading from a model converted from
|
||
a <a href="https://www.tensorflow.org/guide/saved_model">TensorFlow SavedModel</a> using
|
||
the command line converter tool and loaded via <code>tf.loadGraphModel</code>.</p>
|
||
</div><div class="tsd-comment tsd-typography"><h4>Doc</h4></div></section> <section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="ModelURL" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">ModelURL</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Url</span> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">io.IOHandler</span></span></li></ul></section> <section class="tsd-panel"><h4>Implements</h4><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">InferenceModel</span></li></ul></section><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:34</li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="GraphModel.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Accessors</h3><div class="tsd-index-list"><a href="GraphModel.html#inputNodes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>input<wbr/>Nodes</span></a>
|
||
<a href="GraphModel.html#inputs" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>inputs</span></a>
|
||
<a href="GraphModel.html#metadata" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>metadata</span></a>
|
||
<a href="GraphModel.html#modelSignature" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Signature</span></a>
|
||
<a href="GraphModel.html#modelStructuredOutputKeys" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Structured<wbr/>Output<wbr/>Keys</span></a>
|
||
<a href="GraphModel.html#modelVersion" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Version</span></a>
|
||
<a href="GraphModel.html#outputNodes" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>output<wbr/>Nodes</span></a>
|
||
<a href="GraphModel.html#outputs" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>outputs</span></a>
|
||
<a href="GraphModel.html#weights" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>weights</span></a>
|
||
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="GraphModel.html#dispose" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a>
|
||
<a href="GraphModel.html#disposeIntermediateTensors" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose<wbr/>Intermediate<wbr/>Tensors</span></a>
|
||
<a href="GraphModel.html#execute" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>execute</span></a>
|
||
<a href="GraphModel.html#executeAsync" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>execute<wbr/>Async</span></a>
|
||
<a href="GraphModel.html#getIntermediateTensors" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Intermediate<wbr/>Tensors</span></a>
|
||
<a href="GraphModel.html#load" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load</span></a>
|
||
<a href="GraphModel.html#loadSync" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Sync</span></a>
|
||
<a href="GraphModel.html#predict" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>predict</span></a>
|
||
<a href="GraphModel.html#predictAsync" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>predict<wbr/>Async</span></a>
|
||
<a href="GraphModel.html#save" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>save</span></a>
|
||
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors</h2><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_GraphModel" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Graph<wbr/>Model</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">modelUrl</span>, <span class="tsd-kind-parameter">loadOptions</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">tfio</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="GraphModel.html" class="tsd-signature-type tsd-kind-class">GraphModel</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a><span class="tsd-signature-symbol">></span><a href="#constructor.new_GraphModel" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="constructor.new_GraphModel.ModelURL-1" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">ModelURL</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Url</span> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">modelUrl</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a></span><div class="tsd-comment tsd-typography"><p>url for the model, or an <code>io.IOHandler</code>.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">loadOptions</span>: <span class="tsd-signature-type">LoadOptions</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">tfio</span>: <span class="tsd-signature-type">__module</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="GraphModel.html" class="tsd-signature-type tsd-kind-class">GraphModel</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:66</li></ul></aside></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Accessors</h2><section class="tsd-panel tsd-member"><a id="inputNodes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>input<wbr/>Nodes</span><a href="#inputNodes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="inputNodes.inputNodes-1"><span class="tsd-signature-keyword">get</span> inputNodes<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:49</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="inputs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>inputs</span><a href="#inputs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="inputs.inputs-1"><span class="tsd-signature-keyword">get</span> inputs<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><p>Implementation of InferenceModel.inputs</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:51</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="metadata" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>metadata</span><a href="#metadata" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="metadata.metadata-1"><span class="tsd-signature-keyword">get</span> metadata<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{}</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{}</span></h4><ul class="tsd-parameters"></ul><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:54</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="modelSignature" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>model<wbr/>Signature</span><a href="#modelSignature" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="modelSignature.modelSignature-1"><span class="tsd-signature-keyword">get</span> modelSignature<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{}</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{}</span></h4><ul class="tsd-parameters"></ul><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:55</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="modelStructuredOutputKeys" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>model<wbr/>Structured<wbr/>Output<wbr/>Keys</span><a href="#modelStructuredOutputKeys" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="modelStructuredOutputKeys.modelStructuredOutputKeys-1"><span class="tsd-signature-keyword">get</span> modelStructuredOutputKeys<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{}</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{}</span></h4><ul class="tsd-parameters"></ul><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:56</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="modelVersion" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>model<wbr/>Version</span><a href="#modelVersion" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="modelVersion.modelVersion-1"><span class="tsd-signature-keyword">get</span> modelVersion<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:48</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="outputNodes" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>output<wbr/>Nodes</span><a href="#outputNodes" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="outputNodes.outputNodes-1"><span class="tsd-signature-keyword">get</span> outputNodes<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:50</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="outputs" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>outputs</span><a href="#outputs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="outputs.outputs-1"><span class="tsd-signature-keyword">get</span> outputs<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><p>Implementation of InferenceModel.outputs</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:52</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="weights" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>weights</span><a href="#weights" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature" id="weights.weights-1"><span class="tsd-signature-keyword">get</span> weights<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">NamedTensorsMap</span></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">NamedTensorsMap</span></h4><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:53</li></ul></aside></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods</h2><section class="tsd-panel tsd-member"><a id="dispose" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose</span><a href="#dispose" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="dispose.dispose-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#dispose.dispose-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Releases the memory used by the weight tensors and resourceManager.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:268</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="disposeIntermediateTensors" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>dispose<wbr/>Intermediate<wbr/>Tensors</span><a href="#disposeIntermediateTensors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="disposeIntermediateTensors.disposeIntermediateTensors-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">dispose<wbr/>Intermediate<wbr/>Tensors</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#disposeIntermediateTensors.disposeIntermediateTensors-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Dispose intermediate tensors for model debugging mode (flag
|
||
KEEP_INTERMEDIATE_TENSORS is true).</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:261</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="execute" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>execute</span><a href="#execute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="execute.execute-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">execute</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inputs</span>, <span class="tsd-kind-parameter">outputs</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><a href="#execute.execute-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Executes inference for the model for given input tensors.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">inputs</span>: <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></span><div class="tsd-comment tsd-typography"><p>tensor, tensor array or tensor map of the inputs for the
|
||
model, keyed by the input node names.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">outputs</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>output node name from the TensorFlow model, if no
|
||
outputs are specified, the default outputs of the model would be used.
|
||
You can inspect intermediate nodes of the model by adding them to the
|
||
outputs array.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span></h4><p>A single tensor if provided with a single output or no outputs
|
||
are provided and there is only one default output, otherwise return a
|
||
tensor array. The order of the tensor array is the same as the outputs
|
||
if provided, otherwise the order of outputNodes attribute of the model.</p>
|
||
<div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><p>Implementation of InferenceModel.execute</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:230</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="executeAsync" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>execute<wbr/>Async</span><a href="#executeAsync" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="executeAsync.executeAsync-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">execute<wbr/>Async</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inputs</span>, <span class="tsd-kind-parameter">outputs</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span><a href="#executeAsync.executeAsync-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Executes inference for the model for given input tensors in async
|
||
fashion, use this method when your model contains control flow ops.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">inputs</span>: <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></span><div class="tsd-comment tsd-typography"><p>tensor, tensor array or tensor map of the inputs for the
|
||
model, keyed by the input node names.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">outputs</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>output node name from the TensorFlow model, if no outputs
|
||
are specified, the default outputs of the model would be used. You can
|
||
inspect intermediate nodes of the model by adding them to the outputs
|
||
array.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4><p>A Promise of single tensor if provided with a single output or
|
||
no outputs are provided and there is only one default output, otherwise
|
||
return a tensor map.</p>
|
||
<div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:247</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="getIntermediateTensors" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Intermediate<wbr/>Tensors</span><a href="#getIntermediateTensors" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getIntermediateTensors.getIntermediateTensors-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Intermediate<wbr/>Tensors</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">NamedTensorsMap</span><a href="#getIntermediateTensors.getIntermediateTensors-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Get intermediate tensors for model debugging mode (flag
|
||
KEEP_INTERMEDIATE_TENSORS is true).</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">NamedTensorsMap</span></h4><div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:254</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="load" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>load</span><a href="#load" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="load.load-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">load</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">UrlIOHandler</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IOHandlerSync</span><br/><span> </span><span class="tsd-signature-symbol">? </span><span class="tsd-signature-type">boolean</span><br/><span> </span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span><a href="#load.load-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Loads the model and weight files, construct the in memory weight map and
|
||
compile the inference graph.</p>
|
||
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">UrlIOHandler</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="GraphModel.html#constructor.new_GraphModel.ModelURL-1">ModelURL</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">IOHandlerSync</span><br/><span> </span><span class="tsd-signature-symbol">? </span><span class="tsd-signature-type">boolean</span><br/><span> </span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:72</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="loadSync" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>load<wbr/>Sync</span><a href="#loadSync" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="loadSync.loadSync-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">load<wbr/>Sync</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">artifacts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><a href="#loadSync.loadSync-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Synchronously construct the in memory weight map and
|
||
compile the inference graph.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">artifacts</span>: <span class="tsd-signature-type">ModelArtifacts</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4><div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:79</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="predict" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>predict</span><a href="#predict" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="predict.predict-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">predict</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inputs</span>, <span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span><a href="#predict.predict-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Execute the inference for the input tensors.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">inputs</span>: <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">config</span>: <span class="tsd-signature-type">ModelPredictConfig</span></span><div class="tsd-comment tsd-typography"><p>Prediction configuration for specifying the batch size.
|
||
Currently the batch size option is ignored for graph model.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></h4><p>Inference result tensors. If the model is converted and it
|
||
originally had structured_outputs in tensorflow, then a NamedTensorMap
|
||
will be returned matching the structured_outputs. If no structured_outputs
|
||
are present, the output will be single <code>tf.Tensor</code> if the model has single
|
||
output node, otherwise Tensor[].</p>
|
||
<div class="tsd-comment tsd-typography"><h4>See</h4><p><a href="GraphModel.html#inputNodes" class="tsd-kind-accessor">GraphModel.inputNodes</a></p>
|
||
<p>You can also feed any intermediate nodes using the NamedTensorMap as the
|
||
input type. For example, given the graph
|
||
InputNode => Intermediate => OutputNode,
|
||
you can execute the subgraph Intermediate => OutputNode by calling
|
||
model.execute('IntermediateNode' : tf.tensor(...));</p>
|
||
<p>This is useful for models that uses tf.dynamic_rnn, where the intermediate
|
||
state needs to be fed manually.</p>
|
||
<p>For batch inference execution, the tensors for each input need to be
|
||
concatenated together. For example with mobilenet, the required input shape
|
||
is [1, 244, 244, 3], which represents the [batch, height, width, channel].
|
||
If we are provide a batched data of 100 images, the input tensor should be
|
||
in the shape of [100, 244, 244, 3].</p>
|
||
<h4>Doc</h4></div><aside class="tsd-sources"><p>Implementation of InferenceModel.predict</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:167</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="predictAsync" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>predict<wbr/>Async</span><a href="#predictAsync" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="predictAsync.predictAsync-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">predict<wbr/>Async</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">inputs</span>, <span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span><span class="tsd-signature-symbol">></span><a href="#predictAsync.predictAsync-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Execute the inference for the input tensors in async fashion, use this
|
||
method when your model contains control flow ops.</p>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">inputs</span>: <a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></span></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">config</span>: <span class="tsd-signature-type">ModelPredictConfig</span></span><div class="tsd-comment tsd-typography"><p>Prediction configuration for specifying the batch size.
|
||
Currently the batch size option is ignored for graph model.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><a href="Tensor-1.html" class="tsd-signature-type tsd-kind-class">Tensor</a><span class="tsd-signature-symbol"><</span><a href="../enums/Rank.html" class="tsd-signature-type tsd-kind-enum">Rank</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span><span class="tsd-signature-symbol">></span></h4><p>A Promise of inference result tensors. If the model is converted
|
||
and it originally had structured_outputs in tensorflow, then a
|
||
NamedTensorMap will be returned matching the structured_outputs. If no
|
||
structured_outputs are present, the output will be single <code>tf.Tensor</code> if
|
||
the model has single output node, otherwise Tensor[].</p>
|
||
<div class="tsd-comment tsd-typography"><h4>See</h4><p><a href="GraphModel.html#inputNodes" class="tsd-kind-accessor">GraphModel.inputNodes</a></p>
|
||
<p>You can also feed any intermediate nodes using the NamedTensorMap as the
|
||
input type. For example, given the graph
|
||
InputNode => Intermediate => OutputNode,
|
||
you can execute the subgraph Intermediate => OutputNode by calling
|
||
model.execute('IntermediateNode' : tf.tensor(...));</p>
|
||
<p>This is useful for models that uses tf.dynamic_rnn, where the intermediate
|
||
state needs to be fed manually.</p>
|
||
<p>For batch inference execution, the tensors for each input need to be
|
||
concatenated together. For example with mobilenet, the required input shape
|
||
is [1, 244, 244, 3], which represents the [batch, height, width, channel].
|
||
If we are provide a batched data of 100 images, the input tensor should be
|
||
in the shape of [100, 244, 244, 3].</p>
|
||
<h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:208</li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="save" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>save</span><a href="#save" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="save.save-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">save</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">handlerOrURL</span>, <span class="tsd-kind-parameter">config</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SaveResult</span><span class="tsd-signature-symbol">></span><a href="#save.save-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Save the configuration and/or weights of the GraphModel.</p>
|
||
<p>An <code>IOHandler</code> is an object that has a <code>save</code> method of the proper
|
||
signature defined. The <code>save</code> method manages the storing or
|
||
transmission of serialized data ("artifacts") that represent the
|
||
model's topology and weights onto or via a specific medium, such as
|
||
file downloads, local storage, IndexedDB in the web browser and HTTP
|
||
requests to a server. TensorFlow.js provides <code>IOHandler</code>
|
||
implementations for a number of frequently used saving mediums, such as
|
||
<code>tf.io.browserDownloads</code> and <code>tf.io.browserLocalStorage</code>. See <code>tf.io</code>
|
||
for more details.</p>
|
||
<p>This method also allows you to refer to certain types of <code>IOHandler</code>s
|
||
as URL-like string shortcuts, such as 'localstorage://' and
|
||
'indexeddb://'.</p>
|
||
<p>Example 1: Save <code>model</code>'s topology and weights to browser <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage">local
|
||
storage</a>;
|
||
then load it back.</p>
|
||
<pre><code class="language-js"><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">modelUrl</span><span class="hl-1"> =</span><br/><span class="hl-1"> </span><span class="hl-3">'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json'</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">model</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-5">tf</span><span class="hl-1">.</span><span class="hl-6">loadGraphModel</span><span class="hl-1">(</span><span class="hl-5">modelUrl</span><span class="hl-1">);</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">zeros</span><span class="hl-1"> = </span><span class="hl-5">tf</span><span class="hl-1">.</span><span class="hl-6">zeros</span><span class="hl-1">([</span><span class="hl-7">1</span><span class="hl-1">, </span><span class="hl-7">224</span><span class="hl-1">, </span><span class="hl-7">224</span><span class="hl-1">, </span><span class="hl-7">3</span><span class="hl-1">]);</span><br/><span class="hl-5">model</span><span class="hl-1">.</span><span class="hl-6">predict</span><span class="hl-1">(</span><span class="hl-5">zeros</span><span class="hl-1">).</span><span class="hl-6">print</span><span class="hl-1">();</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">saveResults</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-5">model</span><span class="hl-1">.</span><span class="hl-6">save</span><span class="hl-1">(</span><span class="hl-3">'localstorage://my-model-1'</span><span class="hl-1">);</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">loadedModel</span><span class="hl-1"> = </span><span class="hl-4">await</span><span class="hl-1"> </span><span class="hl-5">tf</span><span class="hl-1">.</span><span class="hl-6">loadGraphModel</span><span class="hl-1">(</span><span class="hl-3">'localstorage://my-model-1'</span><span class="hl-1">);</span><br/><span class="hl-5">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-3">'Prediction from loaded model:'</span><span class="hl-1">);</span><br/><span class="hl-5">model</span><span class="hl-1">.</span><span class="hl-6">predict</span><span class="hl-1">(</span><span class="hl-5">zeros</span><span class="hl-1">).</span><span class="hl-6">print</span><span class="hl-1">();</span>
|
||
</code><button>Copy</button></pre>
|
||
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">handlerOrURL</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span></span><div class="tsd-comment tsd-typography"><p>An instance of <code>IOHandler</code> or a URL-like,
|
||
scheme-based string shortcut for <code>IOHandler</code>.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">config</span>: <span class="tsd-signature-type">SaveConfig</span></span><div class="tsd-comment tsd-typography"><p>Options for saving the model.</p>
|
||
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">SaveResult</span><span class="tsd-signature-symbol">></span></h4><p>A <code>Promise</code> of <code>SaveResult</code>, which summarizes the result of
|
||
the saving, such as byte sizes of the saved artifacts for the model's
|
||
topology and weight values.</p>
|
||
<div class="tsd-comment tsd-typography"><h4>Doc</h4></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@4.17.0_@tensorflow+tfjs-core@4.17.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:126</li></ul></aside></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a><a href="#inputNodes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>input<wbr/>Nodes</span></a><a href="#inputs" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>inputs</span></a><a href="#metadata" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>metadata</span></a><a href="#modelSignature" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Signature</span></a><a href="#modelStructuredOutputKeys" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Structured<wbr/>Output<wbr/>Keys</span></a><a href="#modelVersion" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>model<wbr/>Version</span></a><a href="#outputNodes" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>output<wbr/>Nodes</span></a><a href="#outputs" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>outputs</span></a><a href="#weights" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>weights</span></a><a href="#dispose" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose</span></a><a href="#disposeIntermediateTensors" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>dispose<wbr/>Intermediate<wbr/>Tensors</span></a><a href="#execute" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>execute</span></a><a href="#executeAsync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>execute<wbr/>Async</span></a><a href="#getIntermediateTensors" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Intermediate<wbr/>Tensors</span></a><a href="#load" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load</span></a><a href="#loadSync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>load<wbr/>Sync</span></a><a href="#predict" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>predict</span></a><a href="#predictAsync" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>predict<wbr/>Async</span></a><a href="#save" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>save</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@vladmandic/human - v3.2.2</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html> |