<!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.Build</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-Build.html");};
the <code><ahref="TensorFlow-Build.html#t:Build">Build</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; <code>render >=> render === render</code>. However,
rendering a (previously un-rendered) <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> in two different contexts
may result in two different <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code>s.</p></div></div><divclass="top"><pclass="src"><aname="v:renderNodeName"class="def">renderNodeName</a> :: <ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -><ahref="TensorFlow-Build.html#t:Build">Build</a><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a></p><divclass="doc"><p>Render a <code><ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> and get its node's name.</p></div></div><divclass="top"><pclass="src"><aname="v:renderedNodeDefs"class="def">renderedNodeDefs</a> :: Lens' <ahref="TensorFlow-Build.html#t:GraphState">GraphState</a> (<ahref="../containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a><ahref="../tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html#t:NodeDef">NodeDef</a>)</p></div><divclass="top"><pclass="src"><spanclass="keyword">data</span><aname="t:BuildT"class="def">BuildT</a> m a</p><divclass="doc"><p>An action for building nodes in a TensorFlow graph.
Used to manage build state internally as part of the <code>Session</code> monad.</p></div><divclass="subs instances"><pid="control.i:BuildT"class="caption collapser"onclick="toggleSection('i:BuildT')">Instances</p><divid="section.i:BuildT"class="show"><table><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../transformers-0.4.2.0/Control-Monad-Trans-Class.html#t:MonadTrans">MonadTrans</a><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a></span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => MonadState <ahref="TensorFlow-Build.html#t:GraphState">GraphState</a> (<ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> (<ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> m =><ahref="../base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> (<ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="../base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> (<ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="../transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m =><ahref="../transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> (<ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m)</span></td><tdclass="doc empty"> </td></tr><tr><tdclass="src clearfix"><spanclass="inst-left"><ahref="TensorFlow-BuildOp.html#t:OpResult">OpResult</a> a =><ahref="TensorFlow-BuildOp.html#t:BuildOp">BuildOp</a> (<ahref="TensorFlow-Build.html#t:Build">Build</a> a)</span></td><tdclass="doc empty"> </td></tr></table></div></div></div><divclass="top"><pclass="src"><spanclass="keyword">type</span><aname="t:Build"class="def">Build</a> = <ahref="TensorFlow-Build.html#t:BuildT">BuildT</a><ahref="../base-4.8.2.0/Data-Functor-Identity.html#t:Identity">Identity</a></p><divclass="doc"><p>An action for building nodes in a TensorFlow graph.</p></div></div><divclass="top"><pclass="src"><aname="v:addInitializer"class="def">addInitializer</a> :: <ahref="TensorFlow-Build.html#t:ControlNode">ControlNode</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> ()</p><divclass="doc"><p>Registers the given node to be executed before the next
<code><ahref="TensorFlow-Session.html#v:run">run</a></code>.</p></div></div><divclass="top"><pclass="src"><aname="v:hoistBuildT"class="def">hoistBuildT</a> :: (<spanclass="keyword">forall</span> a. m a -> n a) -><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m b -><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> n b</p><divclass="doc"><p>This is Control.Monad.Morph.hoist sans the dependency.</p></div></div><divclass="top"><pclass="src"><aname="v:evalBuildT"class="def">evalBuildT</a> :: <ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m a -> m a</p></div><divclass="top"><pclass="src"><aname="v:runBuildT"class="def">runBuildT</a> :: <ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m a -> m (a, <ahref="TensorFlow-Build.html#t:GraphState">GraphState</a>)</p></div><divclass="top"><pclass="src"><aname="v:asGraphDef"class="def">asGraphDef</a> :: <ahref="TensorFlow-Build.html#t:Build">Build</a> a -><ahref="../tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Graph.html#t:GraphDef">GraphDef</a></p><divclass="doc"><p>Produce a GraphDef proto representation of the nodes that are rendered in
the given <code><ahref="TensorFlow-Build.html#t:Build">Build</a></code> action.</p></div></div><divclass="top"><pclass="src"><aname="v:addGraphDef"class="def">addGraphDef</a> :: <ahref="../tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Graph.html#t:GraphDef">GraphDef</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> ()</p></div><divclass="top"><pclass="src"><aname="v:flushInitializers"class="def">flushInitializers</a> :: <ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m [<ahref="TensorFlow-Output.html#t:NodeName">NodeName</a>]</p><divclass="doc"><p>Get all the initializers that have accumulated so far, and clear
that buffer.</p></div></div><divclass="top"><pclass="src"><aname="v:flushNodeBuffer"class="def">flushNodeBuffer</a> :: <ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m [<ahref="../tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html#t:NodeDef">NodeDef</a>]</p><divclass="doc"><p>Get all the NodeDefs that have accumulated so far, and clear that buffer.</p></div></div><h1id="g:4">Creating and looking up Ops</h1><divclass="top"><pclass="src"><aname="v:getOrAddOp"class="def">getOrAddOp</a> :: <ahref="TensorFlow-Output.html#t:Op">Op</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a></p><divclass="doc"><p>Render the given op if it hasn't been rendered already, and return its
name.</p></div></div><divclass="top"><pclass="src"><aname="v:addNewOp"class="def">addNewOp</a> :: <ahref="TensorFlow-Output.html#t:OpDef">OpDef</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a><ahref="../tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html#t:NodeDef">NodeDef</a></p><divclass="doc"><p>Add a new node for a given <code><ahref="TensorFlow-Output.html#t:OpDef">OpDef</a></code>. This is used for making "stateful" ops
which are not safe to dedup (e.g, "variable" and "assign").</p></div></div><divclass="top"><pclass="src"><aname="v:renderOutput"class="def">renderOutput</a> :: <ahref="TensorFlow-Output.html#t:Output">Output</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> Text</p><divclass="doc"><p>Render an <code><ahref="TensorFlow-Output.html#t:Output">Output</a></code> and return a string representation for the TensorFlow
foreign APIs.</p></div></div><h1id="g:5">Modifying all nodes in a Build action</h1><divclass="top"><pclass="src"><aname="v:colocateWith"class="def">colocateWith</a> :: <spanclass="keyword">forall</span> a v b. <ahref="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v b -><ahref="TensorFlow-Build.html#t:Build">Build</a> a -><ahref="TensorFlow-Build.html#t:Build">Build</a> 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
return would not have the desired effect.</p></div></div><divclass="top"><pclass="src"><aname="v:withStateLens"class="def">withStateLens</a> :: MonadState s m => Lens' s a -> (a -> a) -> m b -> m b</p><divclass="doc"><p>Modify some part of the state, run an action, and restore the state
after that action is done.</p></div></div><divclass="top"><pclass="src"><aname="v:withDevice"class="def">withDevice</a> :: <ahref="../base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a><ahref="TensorFlow-Output.html#t:Device">Device</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> a -><ahref="TensorFlow-Build.html#t:Build">Build</a> a</p><divclass="doc"><p>Set a device for all nodes rendered in the given <code><ahref="TensorFlow-Build.html#t:Build">Build</a></code> action
(unless further overridden by another use of withDevice).</p></div></div><divclass="top"><pclass="src"><aname="v:withNameScope"class="def">withNameScope</a> :: Text -><ahref="TensorFlow-Build.html#t:Build">Build</a> a -><ahref="TensorFlow-Build.html#t:Build">Build</a> a</p><divclass="doc"><p>Prepend a scope to all nodes rendered in the given <code><ahref="TensorFlow-Build.html#t:Build">Build</a></code> action.</p></div></div><divclass="top"><pclass="src"><aname="v:withNodeDependencies"class="def">withNodeDependencies</a> :: <ahref="../containers-0.5.6.2/Data-Set.html#t:Set">Set</a><ahref="TensorFlow-Output.html#t:NodeName">NodeName</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> a -><ahref="TensorFlow-Build.html#t:Build">Build</a> a</p><divclass="doc"><p>Add control inputs to all nodes rendered in the given <code><ahref="TensorFlow-Build.html#t:Build">Build</a></code> action.</p></div></div><h1id="g:6">Internal Summary related bits.</h1><divclass="top"><pclass="src"><aname="v:addSummary"class="def">addSummary</a> :: <ahref="TensorFlow-Build.html#t:SummaryTensor">SummaryTensor</a> -><ahref="TensorFlow-Build.html#t:Build">Build</a> ()</p><divclass="doc"><p>Records the given summary action in Build for retrieval with
Logging.histogramSummary.</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"><aname="v:collectAllSummaries"class="def">collectAllSummaries</a> :: <ahref="../base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m =><ahref="TensorFlow-Build.html#t:BuildT">BuildT</a> m [<ahref="TensorFlow-Build.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></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>