<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>TensorFlow.Tensor</title><linkhref="ocean.css"rel="stylesheet"type="text/css"title="Ocean"/><scriptsrc="haddock-util.js"type="text/javascript"></script><scripttype="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_TensorFlow-Tensor.html");};
</script></head><body><divid="package-header"><ulclass="links"id="page-menu"><li><ahref="index.html">Contents</a></li><li><ahref="doc-index.html">Index</a></li></ul><pclass="caption">tensorflow-0.1.0.0: TensorFlow bindings.</p></div><divid="content"><divid="module-header"><tableclass="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><pclass="caption">TensorFlow.Tensor</p></div><divid="synopsis"><pid="control.syn"class="caption expander"onclick="toggleSection('syn')">Synopsis</p><ulid="section.syn"class="hide"onclick="toggleSection('syn')"><liclass="src short"><spanclass="keyword">data</span><ahref="#t:Tensor">Tensor</a> v a <spanclass="keyword">where</span><ulclass="subs"><li><ahref="#v:Tensor">Tensor</a> :: <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v => { <ulclass="subs"><li><ahref="#v:tensorOutput">tensorOutput</a> :: v <ahref="TensorFlow-Output.html#t:Output">Output</a></li></ul> } -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</li></ul></li><liclass="src short"><spanclass="keyword">newtype</span><ahref="#t:Value">Value</a> a = <ahref="#v:Value">Value</a> {<ulclass="subs"><li><ahref="#v:runValue">runValue</a> :: a</li></ul>}</li><liclass="src short"><spanclass="keyword">newtype</span><ahref="#t:Ref">Ref</a> a = <ahref="#v:Ref">Ref</a> {<ulclass="subs"><li><ahref="#v:runRef">runRef</a> :: a</li></ul>}</li><liclass="src short"><ahref="#v:value">value</a> :: <ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a> a -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a> a</li><liclass="src short"><ahref="#v:renderValue">renderValue</a> :: <ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a> a)</li><liclass="src short"><spanclass="keyword">data</span><ahref="#t:Feed">Feed</a> = <ahref="#v:Feed">Feed</a><ahref="TensorFlow-Output.html#t:Output">Output</a><ahref="TensorFlow-Internal-FFI.html#t:TensorData">TensorData</a></li><liclass="src short"><spanclass="keyword">class</span><ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v =><ahref="#t:Rendered">Rendered</a> v <spanclass="keyword">where</span><ulclass="subs"><li><ahref="#v:rendered">rendered</a> :: v a -> a</li></ul></li><liclass="src short"><ahref="#v:renderedOutput">renderedOutput</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Output.html#t:Output">Output</a></li><liclass="src short"><ahref="#v:tensorNodeName">tensorNodeName</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a></li><liclass="src short"><ahref="#v:feed">feed</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Types.html#t:TensorData">TensorData</a> a -><ahref="TensorFlow-Tensor.html#t:Feed">Feed</a></li><liclass="src short"><ahref="#v:tensorFromName">tensorFromName</a> :: <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v => Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</li><liclass="src short"><ahref="#v:tensorValueFromName">tensorValueFromName</a> :: Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a> a</li><liclass="src short"><ahref="#v:tensorRefFromName">tensorRefFromName</a> :: Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a> a</li><liclass="src short"><spanclass="keyword">type</span><ahref="#t:TensorList">TensorList</a> v = <a
parameter <code>v</code> is either:</p><ul><li><code><ahref="TensorFlow-Build.html#t:Build">Build</a></code>: An unrendered, immutable value.</li><li><code><ahref="TensorFlow-Tensor.html#t:Value">Value</a></code>: A rendered, immutable value.</li><li><code><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a></code>: A rendered stateful handle (e.g., a variable).</li></ul><p>Note that <code><ahref="TensorFlow-Tensor.html#v:expr">expr</a></code>, <code><ahref="TensorFlow-Tensor.html#v:value">value</a></code>, <code><ahref="TensorFlow-Tensor.html#v:render">render</a></code> and <code><ahref="TensorFlow-Tensor.html#v:renderValue">renderValue</a></code> can help convert between
the different types of <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code>.</p></div><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aname="v:Tensor"class="def">Tensor</a> :: <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v => v <ahref="TensorFlow-Output.html#t:Output">Output</a> -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</td><tdclass="doc empty"> </td></tr><tr><tdcolspan="2"><divclass="subs fields"><pclass="caption">Fields</p><dl><dtclass="src"><aname="v:tensorOutput"class="def">tensorOutput</a> :: v <ahref="TensorFlow-Output.html#t:Output">Output</a></dt><ddclass="doc empty"> </dd></dl><divclass="clear"></div></div></td></tr></table></div><divclass="subs instances"><pid="control.i:Tensor"class="caption collapser"onclick="toggleSection('i:Tensor')">Instances</p><divid="section.i:Tensor"class="show"><table><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-BuildOp.html#t:BuildInputs">BuildInputs</a> (<ahref="TensorFlow-Types.html#t:ListOf">ListOf</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v) as)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-BuildOp.html#t:BuildInputs">BuildInputs</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Types.html#t:TensorTypes">TensorTypes</a> as =><ahref="TensorFlow-BuildOp.html#t:PureResult">PureResult</a> (<ahref="TensorFlow-Tensor.html#t:TensorList">TensorList</a><ahref="TensorFlow-Build.html#t:Build">Build</a> as)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-BuildOp.html#t:PureResult">PureResult</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Build.html#t:Build">Build</a> a)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left">(<ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v, <ahref="TensorFlow-Types.html#t:TensorTypes">TensorTypes</a> as) =><ahref="TensorFlow-BuildOp.html#t:BuildResult">BuildResult</a> (<ahref="TensorFlow-Tensor.html#t:TensorList">TensorList</a> v as)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-BuildOp.html#t:BuildResult">BuildResult</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Nodes.html#t:Nodes">Nodes</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left">(<ahref="TensorFlow-Types.html#t:TensorType">TensorType</a> a, <ahref="TensorFlow-Types.html#t:TensorDataType">TensorDataType</a> s a, (~) * a a') =><ahref="TensorFlow-Nodes.html#t:Fetchable">Fetchable</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a) (s a')</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left">(<ahref="TensorFlow-Types.html#t:TensorType">TensorType</a> a, (~) * a a') =><ahref="TensorFlow-Nodes.html#t:Fetchable">Fetchable</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a) (<ahref="TensorFlow-Types.html#t:TensorData">TensorData</a> a')</span></td><tdclass="doc empty"> </td></tr></table></div></div></div><divclass="top"><pclass="src"><spanclass="keyword">newtype</span><aname="t:Value"class="def">Value</a> a</p><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aname="v:Value"class="def">Value</a></td><tdclass="doc empty"> </td></tr><tr><tdcolspan="2"><divclass="subs fields"><pclass="caption">Fields</p><dl><dtclass="src"
when running the graph.</p></div><divclass="subs constructors"><pclass="caption">Constructors</p><table><tr><tdclass="src"><aname="v:Feed"class="def">Feed</a><ahref="TensorFlow-Output.html#t:Output">Output</a><ahref="TensorFlow-Internal-FFI.html#t:TensorData">TensorData</a></td><tdclass="doc empty"> </td></tr></table></div></div><divclass="top"><pclass="src"><spanclass="keyword">class</span><ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v =><aname="t:Rendered"class="def">Rendered</a> v <spanclass="keyword">where</span></p><divclass="doc"><p>A class ensuring that a given tensor is rendered, i.e., has a fixed
name, device, etc.</p></div><divclass="subs methods"><pclass="caption">Methods</p><pclass="src"><aname="v:rendered"class="def">rendered</a> :: v a -> a</p></div><divclass="subs instances"><pid="control.i:Rendered"class="caption collapser"onclick="toggleSection('i:Rendered')">Instances</p><divid="section.i:Rendered"class="show"><table><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a></span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a></span></td><tdclass="doc empty"> </td></tr></table></div></div></div><divclass="top"><pclass="src"><aname="v:renderedOutput"class="def">renderedOutput</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Output.html#t:Output">Output</a></p></div><divclass="top"><pclass="src"><aname="v:tensorNodeName"class="def">tensorNodeName</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a></p></div><divclass="top"><pclass="src"><aname="v:feed"class="def">feed</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Types.html#t:TensorData">TensorData</a> a -><ahref="TensorFlow-Tensor.html#t:Feed">Feed</a></p><divclass="doc"><p>Create a <code><ahref="TensorFlow-Tensor.html#t:Feed">Feed</a></code> for feeding the given data into a <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> when running
rendered <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> may be different than feeding the original <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code>.</p></div></div><divclass="top"><pclass="src"><aname="v:tensorFromName"class="def">tensorFromName</a> :: <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v => Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</p><divclass="doc"><p>Create a <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> for a given name. This can be used to reference nodes
in a <code>GraphDef</code> that was loaded via <code><ahref="TensorFlow-Build.html#v:addGraphDef">addGraphDef</a></code>.
TODO(judahjacobson): add more safety checks here.</p></div></div><divclass="top"><pclass="src"><aname="v:tensorValueFromName"class="def">tensorValueFromName</a> :: Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a> a</p><divclass="doc"><p>Like <code><ahref="TensorFlow-Tensor.html#v:tensorFromName">tensorFromName</a></code>, but type-restricted to <code><ahref="TensorFlow-Tensor.html#t:Value">Value</a></code>.</p></div></div><divclass="top"><pclass="src"><aname="v:tensorRefFromName"class="def">tensorRefFromName</a> :: Text -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a> a</p><divclass="doc"><p>Like <code><ahref="TensorFlow-Tensor.html#v:tensorFromName">tensorFromName</a></code>, but type-restricted to <code><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a></code>.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">type</span><aname="t:TensorList"class="def">TensorList</a> v = <ahref="TensorFlow-Types.html#t:ListOf">ListOf</a> (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v)</p></div><divclass="top"><pclass="src"><aname="v:tensorListOutputs"class="def">tensorListOutputs</a> :: <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v =><ahref="TensorFlow-Tensor.html#t:TensorList">TensorList</a> v as -> [<ahref="TensorFlow-Output.html#t:Output">Output</a>]</p></div><divclass="top"><pclass="src"><aname="v:colocateWith"class="def">colocateWith</a> :: (<ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <ahref="TensorFlow-Tensor.html#t:Rendered">Rendered</a> v) =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v b -> m a -> m a</p><divclass="doc"><p>Places all nodes rendered in the given <code><ahref="TensorFlow-Build.html#t:Build">Build</a></code> action on the same
device as the given Tensor (see also <code><ahref="TensorFlow-Build.html#v:withDevice">withDevice</a></code>). Make sure that
the action has side effects of rendering the desired tensors. A pure
return would not have the desired effect.</p></div></div><divclass="top"><pclass="src"><aname="v:render"class="def">render</a> :: <ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Build.html#t:Build">Build</a> a -> m (<ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a> a)</p><divclass="doc"><p>Render a <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code>, fixing its name, scope, device and control inputs from
the <code><ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a></code> context. Also renders any dependencies of the <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> that
weren't already rendered.</p><p>This operation is idempotent; calling <code><ahref="TensorFlow-Tensor.html#v:render">render</a></code> on the same input in the same
context will produce the same result. However, rendering the same
<code>Tensor Build</code> in two different contexts may result in two different
<code>Tensor Value</code>s.</p></div></div><divclass="top"><pclass="src"><aname="v:expr"class="def">expr</a> :: <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v =><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Build.html#t:Build">Build</a> a</p></div><divclass="top"><pclass="src"><aname="v:addSummary"class="def">addSummary</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: (<ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a> v)</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">=><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v <ahref="../bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></td><tdclass="doc"><p>A <code><ahref="TensorFlow-Tensor.html#t:SummaryTensor">SummaryTensor</a></code></p></td></tr><tr><tdclass="src">-> m ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Records the given summary action in Build for retrieval with
Summary protocol buffer in string form. For safety, use the
pre-composed functions: Logging.scalarSummary and
Logging.histogramSummary.</p></div></div><divclass="top"><pclass="src"><aname="v:collectAllSummaries"class="def">collectAllSummaries</a> :: <ahref="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m => m [<ahref="TensorFlow-Tensor.html#t:SummaryTensor">SummaryTensor</a>]</p><divclass="doc"><p>Retrieves the summary ops collected thus far. Typically this only
happens once, but if <code><ahref="TensorFlow-Session.html#v:buildWithSummary">buildWithSummary</a></code> is used
repeatedly, the values accumulate.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">type</span><aname="t:SummaryTensor"class="def">SummaryTensor</a> = <ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a><ahref="../bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></p><divclass="doc"><p>Synonym for the tensors that return serialized Summary proto.</p></div></div><divclass="top"><pclass="src"><spanclass="keyword">class</span><ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> v =><aname="t:TensorKind"class="def">TensorKind</a> v <spanclass="keyword">where</span></p><divclass="doc"><p>An internal class for kinds of Tensors.</p></div><divclass="subs methods"><pclass="caption">Methods</p><pclass="src"><aname="v:toBuild"class="def">toBuild</a> :: v a -><ahref="TensorFlow-Build.html#t:Build">Build</a> a</p></div><divclass="subs instances"><pid="control.i:TensorKind"class="caption collapser"onclick="toggleSection('i:TensorKind')">Instances</p><divid="section.i:TensorKind"class="show"><table><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a><ahref="TensorFlow-Build.html#t:Build">Build</a></span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a><ahref="TensorFlow-Tensor.html#t:Ref">Ref</a></span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-Tensor.html#t:TensorKind">TensorKind</a><ahref="TensorFlow-Tensor.html#t:Value">Value</a></span></td><tdclass="doc empty"> </td></tr></table></div></div></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>