human/typedoc/classes/GraphModel.html

88 lines
40 KiB
HTML

<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GraphModel | @vladmandic/human - v2.5.4</title><meta name="description" content="Documentation for @vladmandic/human - v2.5.4"/><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 async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></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 - v2.5.4</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">@vladmandic/human - v2.5.4</a></li><li><a href="GraphModel.html">GraphModel</a></li></ul><h1>Class GraphModel</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>A <code>tf.GraphModel</code> is a directed, acyclic graph built from a
SavedModel GraphDef and allows inference execution.</p>
</div><div><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><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;}</p>
</dd></dl></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="target">GraphModel</span></li></ul></section><section class="tsd-panel"><h3>Implements</h3><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">InferenceModel</span></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="GraphModel.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section "><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#inputNodes" class="tsd-kind-icon">input<wbr/>Nodes</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#inputs" class="tsd-kind-icon">inputs</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#metadata" class="tsd-kind-icon">metadata</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#modelSignature" class="tsd-kind-icon">model<wbr/>Signature</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#modelVersion" class="tsd-kind-icon">model<wbr/>Version</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#outputNodes" class="tsd-kind-icon">output<wbr/>Nodes</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#outputs" class="tsd-kind-icon">outputs</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#weights" class="tsd-kind-icon">weights</a></li></ul></section><section class="tsd-index-section "><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#dispose" class="tsd-kind-icon">dispose</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#execute" class="tsd-kind-icon">execute</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#executeAsync" class="tsd-kind-icon">execute<wbr/>Async</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#loadSync" class="tsd-kind-icon">load<wbr/>Sync</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#predict" class="tsd-kind-icon">predict</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#save" class="tsd-kind-icon">save</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"><a id="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">new <wbr/>Graph<wbr/>Model<span class="tsd-signature-symbol">(</span>modelUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span>, loadOptions<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">LoadOptions</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="GraphModel.html" class="tsd-signature-type" data-tsd-kind="Class">GraphModel</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:59</li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>modelUrl: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>url for the model, or an <code>io.IOHandler</code>.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> loadOptions: <span class="tsd-signature-type">LoadOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="GraphModel.html" class="tsd-signature-type" data-tsd-kind="Class">GraphModel</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group "><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="inputNodes" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> input<wbr/>Nodes</h3><div class="tsd-signature tsd-kind-icon">input<wbr/>Nodes<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:43</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="inputs" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> inputs</h3><div class="tsd-signature tsd-kind-icon">inputs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><p>Implementation of InferenceModel.inputs</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:45</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="metadata" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> metadata</h3><div class="tsd-signature tsd-kind-icon">metadata<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:48</li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="modelSignature" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> model<wbr/>Signature</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Signature<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:49</li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="modelVersion" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> model<wbr/>Version</h3><div class="tsd-signature tsd-kind-icon">model<wbr/>Version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:42</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="outputNodes" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> output<wbr/>Nodes</h3><div class="tsd-signature tsd-kind-icon">output<wbr/>Nodes<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:44</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="outputs" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> outputs</h3><div class="tsd-signature tsd-kind-icon">outputs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">TensorInfo</span><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources"><p>Implementation of InferenceModel.outputs</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:46</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="weights" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagReadonly">Readonly</span> weights</h3><div class="tsd-signature tsd-kind-icon">weights<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NamedTensorsMap</span></div><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:47</li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="dispose" class="tsd-anchor"></a><h3>dispose</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">dispose<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></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:199</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Releases the memory used by the weight tensors and resourceManager.</p>
</div><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;}</p>
</dd></dl></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="execute" class="tsd-anchor"></a><h3>execute</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">execute<span class="tsd-signature-symbol">(</span>inputs<span class="tsd-signature-symbol">: </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span>, outputs<span class="tsd-signature-symbol">?: </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 class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Implementation of InferenceModel.execute</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:175</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Executes inference for the model for given input tensors.</p>
</div><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;}</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>inputs: <a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>tensor, tensor array or tensor map of the inputs for the
model, keyed by the input node names.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> outputs: <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></h5><div class="tsd-comment tsd-typography"><div class="lead">
<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></li></ul><h4 class="tsd-returns-title">Returns <a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span></h4><div><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></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="executeAsync" class="tsd-anchor"></a><h3>execute<wbr/>Async</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">execute<wbr/>Async<span class="tsd-signature-symbol">(</span>inputs<span class="tsd-signature-symbol">: </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span>, outputs<span class="tsd-signature-symbol">?: </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 class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:192</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<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><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;}</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>inputs: <a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>tensor, tensor array or tensor map of the inputs for the
model, keyed by the input node names.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> outputs: <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></h5><div class="tsd-comment tsd-typography"><div class="lead">
<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></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><div><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></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="load" class="tsd-anchor"></a><h3>load</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<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">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:65</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Loads the model and weight files, construct the in memory weight map and
compile the inference graph.</p>
</div></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="loadSync" class="tsd-anchor"></a><h3>load<wbr/>Sync</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">load<wbr/>Sync<span class="tsd-signature-symbol">(</span>artifacts<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ModelArtifacts</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:72</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Synchronously construct the in memory weight map and
compile the inference graph. Also initialize hashtable if any.</p>
</div><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;, ignoreCI: true}</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>artifacts: <span class="tsd-signature-type">ModelArtifacts</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="predict" class="tsd-anchor"></a><h3>predict</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">predict<span class="tsd-signature-symbol">(</span>inputs<span class="tsd-signature-symbol">: </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span>, config<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">ModelPredictConfig</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Implementation of InferenceModel.predict</p><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:156</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Execute the inference for the input tensors.</p>
</div><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;}</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>inputs: <a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> config: <span class="tsd-signature-type">ModelPredictConfig</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Prediction configuration for specifying the batch size and
output node names. Currently the batch size option is ignored for graph
model.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><a href="Tensor.html" class="tsd-signature-type" data-tsd-kind="Class">Tensor</a><span class="tsd-signature-symbol">&lt;</span><a href="../enums/Rank.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Rank</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NamedTensorMap</span></h4><div><p>Inference result tensors. The output would be single <code>tf.Tensor</code>
if model has single output node, otherwise Tensor[] or NamedTensorMap[]
will be returned for model with multiple outputs.</p>
</div></li></ul></section><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="save" class="tsd-anchor"></a><h3>save</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon">save<span class="tsd-signature-symbol">(</span>handlerOrURL<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span>, config<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">SaveConfig</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">&lt;</span><span class="tsd-signature-type">SaveResult</span><span class="tsd-signature-symbol">&gt;</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in node_modules/.pnpm/@tensorflow+tfjs-converter@3.11.0_@tensorflow+tfjs-core@3.11.0/node_modules/@tensorflow/tfjs-converter/dist/executor/graph_model.d.ts:117</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Save the configuration and/or weights of the GraphModel.</p>
</div><div><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 (&quot;artifacts&quot;) that represent the
model&#39;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 &#39;localstorage://&#39; and
&#39;indexeddb://&#39;.</p>
<p>Example 1: Save <code>model</code>&#39;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">&#39;https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/model.json&#39;</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">&#39;localstorage://my-model-1&#39;</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">&#39;localstorage://my-model-1&#39;</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">&#39;Prediction from loaded model:&#39;</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></pre>
</div><dl class="tsd-comment-tags"><dt>doc</dt><dd><p>{heading: &#39;Models&#39;, subheading: &#39;Classes&#39;, ignoreCI: true}</p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>handlerOrURL: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>An instance of <code>IOHandler</code> or a URL-like,
scheme-based string shortcut for <code>IOHandler</code>.</p>
</div></div></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> config: <span class="tsd-signature-type">SaveConfig</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>Options for saving the model.</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">SaveResult</span><span class="tsd-signature-symbol">&gt;</span></h4><div><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&#39;s
topology and weight values.</p>
</div></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Exports</a></li><li class=" tsd-kind-namespace"><a href="../modules/Tensor.html">Tensor</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="GraphModel.html" class="tsd-kind-icon">Graph<wbr/>Model</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class"><a href="GraphModel.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#inputNodes" class="tsd-kind-icon">input<wbr/>Nodes</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#inputs" class="tsd-kind-icon">inputs</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#metadata" class="tsd-kind-icon">metadata</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#modelSignature" class="tsd-kind-icon">model<wbr/>Signature</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#modelVersion" class="tsd-kind-icon">model<wbr/>Version</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#outputNodes" class="tsd-kind-icon">output<wbr/>Nodes</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#outputs" class="tsd-kind-icon">outputs</a></li><li class="tsd-kind-property tsd-parent-kind-class"><a href="GraphModel.html#weights" class="tsd-kind-icon">weights</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#dispose" class="tsd-kind-icon">dispose</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#execute" class="tsd-kind-icon">execute</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#executeAsync" class="tsd-kind-icon">execute<wbr/>Async</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#load" class="tsd-kind-icon">load</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#loadSync" class="tsd-kind-icon">load<wbr/>Sync</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#predict" class="tsd-kind-icon">predict</a></li><li class="tsd-kind-method tsd-parent-kind-class"><a href="GraphModel.html#save" class="tsd-kind-icon">save</a></li></ul></li></ul></nav></div></div></div><footer class=""><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="overlay"></div><script src="../assets/main.js"></script></body></html>