onnxruntime/docs/api/objectivec/Classes/ORTValue.html
2021-12-10 17:37:56 -08:00

429 lines
22 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>ORTValue Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/objc/Class/ORTValue" class="dashAnchor"></a>
<a title="ORTValue Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">ONNX Runtime Objective-C API 1.10.0 Docs</a></p>
<p class="header-right"><a href="https://github.com/microsoft/onnxruntime"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p>
<div class="header-right">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</div>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">ONNX Runtime Objective-C API Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
ORTValue Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/ORTCoreMLExecutionProviderOptions.html">ORTCoreMLExecutionProviderOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTEnv.html">ORTEnv</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTRunOptions.html">ORTRunOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTSession.html">ORTSession</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTSessionOptions.html">ORTSessionOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTTensorTypeAndShapeInfo.html">ORTTensorTypeAndShapeInfo</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTValue.html">ORTValue</a>
</li>
<li class="nav-group-task">
<a href="../Classes/ORTValueTypeInfo.html">ORTValueTypeInfo</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/ORTGraphOptimizationLevel.html">ORTGraphOptimizationLevel</a>
</li>
<li class="nav-group-task">
<a href="../Enums/ORTLoggingLevel.html">ORTLoggingLevel</a>
</li>
<li class="nav-group-task">
<a href="../Enums/ORTTensorElementDataType.html">ORTTensorElementDataType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/ORTValueType.html">ORTValueType</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Functions.html">Functions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Functions.html#/c:@F@ORTIsCoreMLExecutionProviderAvailable">ORTIsCoreMLExecutionProviderAvailable</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>ORTValue</h1>
<div class="declaration">
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">@interface</span> <span class="nc">ORTValue</span> <span class="p">:</span> <span class="nc">NSObject</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">class</span> <span class="kt">ORTValue</span> <span class="p">:</span> <span class="kt">NSObject</span></code></pre>
</div>
</div>
<p>An ORT value encapsulates data used as an input or output to a model at runtime.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)ORTValue(im)init"></a>
<a name="//apple_ref/objc/Method/-init" class="dashAnchor"></a>
<a class="token discouraged" href="#/c:objc(cs)ORTValue(im)init">-init</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="aside aside-unavailable">
<p class="aside-title">Unavailable</p>
</div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span><span class="n">init</span> <span class="n">NS_UNAVAILABLE</span><span class="p">;</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)ORTValue(im)initWithTensorData:elementType:shape:error:"></a>
<a name="//apple_ref/objc/Method/-initWithTensorData:elementType:shape:error:" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)ORTValue(im)initWithTensorData:elementType:shape:error:">-initWithTensorData:<wbr>elementType:<wbr>shape:<wbr>error:<wbr></a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a value that is a tensor.
The tensor data is allocated by the caller.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nullable</span> <span class="n">instancetype</span><span class="p">)</span>
<span class="nf">initWithTensorData</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSMutableData</span> <span class="o">*</span><span class="p">)</span><span class="nv">tensorData</span>
<span class="nf">elementType</span><span class="p">:(</span><span class="n"><a href="../Enums/ORTTensorElementDataType.html">ORTTensorElementDataType</a></span><span class="p">)</span><span class="nv">elementType</span>
<span class="nf">shape</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n">NSNumber</span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">shape</span>
<span class="nf">error</span><span class="p">:(</span><span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">)</span><span class="nv">error</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="nf">init</span><span class="p">(</span><span class="nv">tensorData</span><span class="p">:</span> <span class="kt">NSMutableData</span><span class="p">,</span> <span class="nv">elementType</span><span class="p">:</span> <span class="kt"><a href="../Enums/ORTTensorElementDataType.html">ORTTensorElementDataType</a></span><span class="p">,</span> <span class="nv">shape</span><span class="p">:</span> <span class="p">[</span><span class="kt">NSNumber</span><span class="p">])</span> <span class="k">throws</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>tensorData</em>
</code>
</td>
<td>
<div>
<p>The tensor data.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>elementType</em>
</code>
</td>
<td>
<div>
<p>The tensor element data type.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>shape</em>
</code>
</td>
<td>
<div>
<p>The tensor shape.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>error</em>
</code>
</td>
<td>
<div>
<p>Optional error information set if an error occurs.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The instance, or nil if an error occurs.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)ORTValue(im)typeInfoWithError:"></a>
<a name="//apple_ref/objc/Method/-typeInfoWithError:" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)ORTValue(im)typeInfoWithError:">-typeInfoWithError:<wbr></a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Gets the type information.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nullable</span> <span class="n"><a href="../Classes/ORTValueTypeInfo.html">ORTValueTypeInfo</a></span> <span class="o">*</span><span class="p">)</span><span class="nf">typeInfoWithError</span><span class="p">:</span>
<span class="p">(</span><span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">)</span><span class="nv">error</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">typeInfo</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/ORTValueTypeInfo.html">ORTValueTypeInfo</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>error</em>
</code>
</td>
<td>
<div>
<p>Optional error information set if an error occurs.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The type information, or nil if an error occurs.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)ORTValue(im)tensorTypeAndShapeInfoWithError:"></a>
<a name="//apple_ref/objc/Method/-tensorTypeAndShapeInfoWithError:" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)ORTValue(im)tensorTypeAndShapeInfoWithError:">-tensorTypeAndShapeInfoWithError:<wbr></a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Gets the tensor type and shape information.
This assumes that the value is a tensor.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nullable</span> <span class="n"><a href="../Classes/ORTTensorTypeAndShapeInfo.html">ORTTensorTypeAndShapeInfo</a></span> <span class="o">*</span><span class="p">)</span><span class="nf">tensorTypeAndShapeInfoWithError</span><span class="p">:</span>
<span class="p">(</span><span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">)</span><span class="nv">error</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tensorTypeAndShapeInfo</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/ORTTensorTypeAndShapeInfo.html">ORTTensorTypeAndShapeInfo</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>error</em>
</code>
</td>
<td>
<div>
<p>Optional error information set if an error occurs.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The tensor type and shape information, or nil if an error occurs.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)ORTValue(im)tensorDataWithError:"></a>
<a name="//apple_ref/objc/Method/-tensorDataWithError:" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)ORTValue(im)tensorDataWithError:">-tensorDataWithError:<wbr></a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Gets the tensor data.
This assumes that the value is a tensor.</p>
<p>This returns the value&rsquo;s underlying data directly, not a copy of it.
The memory&rsquo;s lifetime may be tied to this value, i.e., if it was allocated
by ORT. On the other hand, the memory&rsquo;s lifetime is independent of the value
if the value was created with user-provided data.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nullable</span> <span class="n">NSMutableData</span> <span class="o">*</span><span class="p">)</span><span class="nf">tensorDataWithError</span><span class="p">:</span>
<span class="p">(</span><span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">)</span><span class="nv">error</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">tensorData</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">NSMutableData</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>error</em>
</code>
</td>
<td>
<div>
<p>Optional error information set if an error occurs.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The tensor data, or nil if an error occurs.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="https://www.onnxruntime.ai" target="_blank" rel="external noopener">ONNX Runtime Authors</a>. All rights reserved. (Last updated: 2021-12-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</html>