mirror of
https://github.com/tensorflow/haskell.git
synced 2024-11-23 11:29:43 +01:00
218 lines
No EOL
75 KiB
HTML
218 lines
No EOL
75 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- Copyright 2016 TensorFlow authors.</span><span>
|
|
</span><a name="line-2"></a><span class="hs-comment">--</span><span>
|
|
</span><a name="line-3"></a><span class="hs-comment">-- Licensed under the Apache License, Version 2.0 (the "License");</span><span>
|
|
</span><a name="line-4"></a><span class="hs-comment">-- you may not use this file except in compliance with the License.</span><span>
|
|
</span><a name="line-5"></a><span class="hs-comment">-- You may obtain a copy of the License at</span><span>
|
|
</span><a name="line-6"></a><span class="hs-comment">--</span><span>
|
|
</span><a name="line-7"></a><span class="hs-comment">-- http://www.apache.org/licenses/LICENSE-2.0</span><span>
|
|
</span><a name="line-8"></a><span class="hs-comment">--</span><span>
|
|
</span><a name="line-9"></a><span class="hs-comment">-- Unless required by applicable law or agreed to in writing, software</span><span>
|
|
</span><a name="line-10"></a><span class="hs-comment">-- distributed under the License is distributed on an "AS IS" BASIS,</span><span>
|
|
</span><a name="line-11"></a><span class="hs-comment">-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span><span>
|
|
</span><a name="line-12"></a><span class="hs-comment">-- See the License for the specific language governing permissions and</span><span>
|
|
</span><a name="line-13"></a><span class="hs-comment">-- limitations under the License.</span><span>
|
|
</span><a name="line-14"></a><span>
|
|
</span><a name="line-15"></a><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
|
|
</span><a name="line-16"></a><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
|
|
</span><a name="line-17"></a><span class="hs-pragma">{-# LANGUAGE Rank2Types #-}</span><span>
|
|
</span><a name="line-18"></a><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
|
|
</span><a name="line-19"></a><span class="hs-pragma">{-# LANGUAGE TupleSections #-}</span><span>
|
|
</span><a name="line-20"></a><span>
|
|
</span><a name="line-21"></a><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Session</span><span> </span><span class="hs-special">(</span><span>
|
|
</span><a name="line-22"></a><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-type">Session</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-23"></a><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-24"></a><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-25"></a><span> </span><a href="TensorFlow.Session.html#sessionConfig"><span class="hs-identifier hs-var">sessionConfig</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-26"></a><span> </span><a href="TensorFlow.Session.html#sessionTarget"><span class="hs-identifier hs-var">sessionTarget</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-27"></a><span> </span><a href="TensorFlow.Session.html#sessionTracer"><span class="hs-identifier hs-var">sessionTracer</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-28"></a><span> </span><a href="TensorFlow.Session.html#runSession"><span class="hs-identifier hs-var">runSession</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-29"></a><span> </span><a href="TensorFlow.Session.html#runSessionWithOptions"><span class="hs-identifier hs-var">runSessionWithOptions</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-30"></a><span> </span><a href="TensorFlow.Build.html#MonadBuild"><span class="hs-identifier hs-type">MonadBuild</span></a><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
|
|
</span><a name="line-31"></a><span> </span><a href="TensorFlow.Session.html#extend"><span class="hs-identifier hs-var">extend</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-32"></a><span> </span><a href="TensorFlow.Build.html#addGraphDef"><span class="hs-identifier hs-var">addGraphDef</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-33"></a><span> </span><a href="TensorFlow.Session.html#run"><span class="hs-identifier hs-var">run</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-34"></a><span> </span><a href="TensorFlow.Session.html#runWithFeeds"><span class="hs-identifier hs-var">runWithFeeds</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-35"></a><span> </span><a href="TensorFlow.Session.html#run_"><span class="hs-identifier hs-var">run_</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-36"></a><span> </span><a href="TensorFlow.Session.html#runWithFeeds_"><span class="hs-identifier hs-var">runWithFeeds_</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-37"></a><span> </span><a href="TensorFlow.Session.html#asyncProdNodes"><span class="hs-identifier hs-var">asyncProdNodes</span></a><span class="hs-special">,</span><span>
|
|
</span><a name="line-38"></a><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
|
|
</span><a name="line-39"></a><span>
|
|
</span><a name="line-40"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Monad</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">forever</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">unless</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">void</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-41"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Monad</span><span class="hs-operator">.</span><span class="hs-identifier">Catch</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadThrow</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadCatch</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadMask</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-42"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Monad</span><span class="hs-operator">.</span><span class="hs-identifier">IO</span><span class="hs-operator">.</span><span class="hs-identifier">Class</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">liftIO</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-43"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Monad</span><span class="hs-operator">.</span><span class="hs-identifier">Trans</span><span class="hs-operator">.</span><span class="hs-identifier">Class</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadTrans</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">lift</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-44"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control</span><span class="hs-operator">.</span><span class="hs-identifier">Monad</span><span class="hs-operator">.</span><span class="hs-identifier">Trans</span><span class="hs-operator">.</span><span class="hs-identifier">Reader</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">ReaderT</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">ask</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">asks</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-45"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">ByteString</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">ByteString</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-46"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Default</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Default</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">def</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-47"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-operator hs-var"><></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-48"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">ProtoLens</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">showMessage</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-49"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Set</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Set</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-50"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Text</span><span class="hs-operator">.</span><span class="hs-identifier">Encoding</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">encodeUtf8</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-51"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Lens</span><span class="hs-operator">.</span><span class="hs-identifier">Family2</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Lens'</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">^.</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">&</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-operator hs-var">.~</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-52"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Lens</span><span class="hs-operator">.</span><span class="hs-identifier">Family2</span><span class="hs-operator">.</span><span class="hs-identifier">Unchecked</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">lens</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-53"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Proto</span><span class="hs-operator">.</span><span class="hs-identifier">Tensorflow</span><span class="hs-operator">.</span><span class="hs-identifier">Core</span><span class="hs-operator">.</span><span class="hs-identifier">Framework</span><span class="hs-operator">.</span><span class="hs-identifier">Graph</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">GraphDef</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-var">node</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-54"></a><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Proto</span><span class="hs-operator">.</span><span class="hs-identifier">Tensorflow</span><span class="hs-operator">.</span><span class="hs-identifier">Core</span><span class="hs-operator">.</span><span class="hs-identifier">Protobuf</span><span class="hs-operator">.</span><span class="hs-identifier">Config</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">ConfigProto</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-55"></a><span class="hs-keyword">import</span><span> </span><a href="TensorFlow.Build.html"><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Build</span></a><span>
|
|
</span><a name="line-56"></a><span class="hs-keyword">import</span><span> </span><a href="TensorFlow.Nodes.html"><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Nodes</span></a><span>
|
|
</span><a name="line-57"></a><span class="hs-keyword">import</span><span> </span><a href="TensorFlow.Output.html"><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Output</span></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Output.html#NodeName"><span class="hs-identifier hs-type">NodeName</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Output.html#unNodeName"><span class="hs-identifier hs-var">unNodeName</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-58"></a><span class="hs-keyword">import</span><span> </span><a href="TensorFlow.Tensor.html"><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Tensor</span></a><span>
|
|
</span><a name="line-59"></a><span>
|
|
</span><a name="line-60"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">ByteString</span><span class="hs-operator">.</span><span class="hs-identifier">Builder</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Builder</span><span>
|
|
</span><a name="line-61"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Map</span><span class="hs-operator">.</span><span class="hs-identifier">Strict</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Map</span><span>
|
|
</span><a name="line-62"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Data</span><span class="hs-operator">.</span><span class="hs-identifier">Set</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">Set</span><span>
|
|
</span><a name="line-63"></a><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><a href="TensorFlow.Internal.FFI.html"><span class="hs-identifier">TensorFlow</span><span class="hs-operator">.</span><span class="hs-identifier">Internal</span><span class="hs-operator">.</span><span class="hs-identifier">FFI</span></a><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">FFI</span><span>
|
|
</span><a name="line-64"></a><span>
|
|
</span><a name="line-65"></a><span class="hs-comment">-- | An action for logging.</span><span>
|
|
</span><a name="line-66"></a><span class="hs-keyword">type</span><span> </span><a name="Tracer"><a href="TensorFlow.Session.html#Tracer"><span class="hs-identifier">Tracer</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-type">Builder</span><span class="hs-operator hs-type">.</span><span class="hs-identifier hs-type">Builder</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-67"></a><span>
|
|
</span><a name="line-68"></a><span class="hs-comment">-- Common state threaded through the session.</span><span>
|
|
</span><a name="line-69"></a><span class="hs-keyword">data</span><span> </span><a name="SessionState"><a href="TensorFlow.Session.html#SessionState"><span class="hs-identifier">SessionState</span></a></a><span>
|
|
</span><a name="line-70"></a><span> </span><span class="hs-glyph">=</span><span> </span><a name="SessionState"><a href="TensorFlow.Session.html#SessionState"><span class="hs-identifier">SessionState</span></a></a><span> </span><span class="hs-special">{</span><span>
|
|
</span><a name="line-71"></a><span> </span><a name="rawSession"><a href="TensorFlow.Session.html#rawSession"><span class="hs-identifier">rawSession</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="TensorFlow.Internal.Raw.html#Session"><span class="hs-identifier hs-type">FFI</span><span class="hs-operator hs-type">.</span><span class="hs-identifier hs-type">Session</span></a><span>
|
|
</span><a name="line-72"></a><span> </span><span class="hs-special">,</span><span> </span><a name="asyncCollector"><a href="TensorFlow.Session.html#asyncCollector"><span class="hs-identifier">asyncCollector</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-73"></a><span> </span><span class="hs-comment">-- ^ Starts the given action concurrently.</span><span>
|
|
</span><a name="line-74"></a><span> </span><span class="hs-special">,</span><span> </span><a name="tracer"><a href="TensorFlow.Session.html#tracer"><span class="hs-identifier">tracer</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="TensorFlow.Session.html#Tracer"><span class="hs-identifier hs-type">Tracer</span></a><span>
|
|
</span><a name="line-75"></a><span> </span><span class="hs-special">}</span><span>
|
|
</span><a name="line-76"></a><span>
|
|
</span><a name="line-77"></a><span class="hs-keyword">newtype</span><span> </span><a name="SessionT"><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier">SessionT</span></a></a><span> </span><a name="local-6989586621679122431"><a href="#local-6989586621679122431"><span class="hs-identifier">m</span></a></a><span> </span><a name="local-6989586621679122432"><a href="#local-6989586621679122432"><span class="hs-identifier">a</span></a></a><span>
|
|
</span><a name="line-78"></a><span> </span><span class="hs-glyph">=</span><span> </span><a name="Session"><a href="TensorFlow.Session.html#Session"><span class="hs-identifier">Session</span></a></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">ReaderT</span><span> </span><a href="TensorFlow.Session.html#SessionState"><span class="hs-identifier hs-type">SessionState</span></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Build.html#BuildT"><span class="hs-identifier hs-type">BuildT</span></a><span> </span><a href="#local-6989586621679122431"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679122432"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-79"></a><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">Functor</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Applicative</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">Monad</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadIO</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadThrow</span><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadCatch</span><span class="hs-special">,</span><span>
|
|
</span><a name="line-80"></a><span> </span><span class="hs-identifier hs-type">MonadMask</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-81"></a><span>
|
|
</span><a name="line-82"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">MonadTrans</span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><span class="hs-keyword">where</span><span>
|
|
</span><a name="line-83"></a><span> </span><a name="local-8214565720323798760"><span class="hs-identifier">lift</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">lift</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">lift</span><span>
|
|
</span><a name="line-84"></a><span>
|
|
</span><a name="line-85"></a><span class="hs-keyword">type</span><span> </span><a name="Session"><a href="TensorFlow.Session.html#Session"><span class="hs-identifier">Session</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><span class="hs-identifier hs-type">IO</span><span>
|
|
</span><a name="line-86"></a><span>
|
|
</span><a name="line-87"></a><span class="hs-comment">-- | Run 'Session' actions in a new TensorFlow session.</span><span>
|
|
</span><a name="line-88"></a><span class="hs-identifier">runSession</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadMask</span><span> </span><a href="#local-6989586621679122451"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122451"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122451"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122452"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122451"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122452"><span class="hs-identifier hs-type">a</span></a><span>
|
|
</span><a name="line-89"></a><a name="runSession"><a href="TensorFlow.Session.html#runSession"><span class="hs-identifier">runSession</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#runSessionWithOptions"><span class="hs-identifier hs-var">runSessionWithOptions</span></a><span> </span><span class="hs-identifier hs-var">def</span><span>
|
|
</span><a name="line-90"></a><span>
|
|
</span><a name="line-91"></a><span class="hs-comment">-- | Customization for session. Use the lenses to update:</span><span>
|
|
</span><a name="line-92"></a><span class="hs-comment">-- 'sessionTarget', 'sessionTracer', 'sessionConfig'.</span><span>
|
|
</span><a name="line-93"></a><span class="hs-keyword">data</span><span> </span><a name="Options"><a href="TensorFlow.Session.html#Options"><span class="hs-identifier">Options</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a name="Options"><a href="TensorFlow.Session.html#Options"><span class="hs-identifier">Options</span></a></a><span>
|
|
</span><a name="line-94"></a><span> </span><span class="hs-special">{</span><span> </span><a name="_sessionTarget"><a href="TensorFlow.Session.html#_sessionTarget"><span class="hs-identifier">_sessionTarget</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">ByteString</span><span>
|
|
</span><a name="line-95"></a><span> </span><span class="hs-special">,</span><span> </span><a name="_sessionConfig"><a href="TensorFlow.Session.html#_sessionConfig"><span class="hs-identifier">_sessionConfig</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">ConfigProto</span><span>
|
|
</span><a name="line-96"></a><span> </span><span class="hs-special">,</span><span> </span><a name="_sessionTracer"><a href="TensorFlow.Session.html#_sessionTracer"><span class="hs-identifier">_sessionTracer</span></a></a><span> </span><span class="hs-glyph">::</span><span> </span><a href="TensorFlow.Session.html#Tracer"><span class="hs-identifier hs-type">Tracer</span></a><span>
|
|
</span><a name="line-97"></a><span> </span><span class="hs-special">}</span><span>
|
|
</span><a name="line-98"></a><span>
|
|
</span><a name="line-99"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">Default</span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span> </span><span class="hs-keyword">where</span><span>
|
|
</span><a name="line-100"></a><span> </span><a name="local-8214565720323818603"><span class="hs-identifier">def</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-var">Options</span></a><span>
|
|
</span><a name="line-101"></a><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">_sessionTarget</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-string">""</span><span>
|
|
</span><a name="line-102"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">_sessionConfig</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">def</span><span>
|
|
</span><a name="line-103"></a><span> </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">_sessionTracer</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">const</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-104"></a><span> </span><span class="hs-special">}</span><span>
|
|
</span><a name="line-105"></a><span>
|
|
</span><a name="line-106"></a><span class="hs-comment">-- | Target can be: "local", ip:port, host:port.</span><span>
|
|
</span><a name="line-107"></a><span class="hs-comment">-- The set of supported factories depends on the linked in libraries.</span><span>
|
|
</span><a name="line-108"></a><span class="hs-identifier">sessionTarget</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Lens'</span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span> </span><span class="hs-identifier hs-type">ByteString</span><span>
|
|
</span><a name="line-109"></a><a name="sessionTarget"><a href="TensorFlow.Session.html#sessionTarget"><span class="hs-identifier">sessionTarget</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">lens</span><span> </span><span class="hs-identifier">_sessionTarget</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><a name="local-6989586621679122453"><a href="#local-6989586621679122453"><span class="hs-identifier">g</span></a></a><span> </span><a name="local-6989586621679122454"><a href="#local-6989586621679122454"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122453"><span class="hs-identifier hs-var">g</span></a><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">_sessionTarget</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679122454"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-110"></a><span>
|
|
</span><a name="line-111"></a><span class="hs-comment">-- | Uses the specified config for the created session.</span><span>
|
|
</span><a name="line-112"></a><span class="hs-identifier">sessionConfig</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Lens'</span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span> </span><span class="hs-identifier hs-type">ConfigProto</span><span>
|
|
</span><a name="line-113"></a><a name="sessionConfig"><a href="TensorFlow.Session.html#sessionConfig"><span class="hs-identifier">sessionConfig</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">lens</span><span> </span><span class="hs-identifier">_sessionConfig</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><a name="local-6989586621679122455"><a href="#local-6989586621679122455"><span class="hs-identifier">g</span></a></a><span> </span><a name="local-6989586621679122456"><a href="#local-6989586621679122456"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122455"><span class="hs-identifier hs-var">g</span></a><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">_sessionConfig</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679122456"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-114"></a><span>
|
|
</span><a name="line-115"></a><span class="hs-comment">-- | Uses the given logger to monitor session progress.</span><span>
|
|
</span><a name="line-116"></a><span class="hs-identifier">sessionTracer</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">Lens'</span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span> </span><a href="TensorFlow.Session.html#Tracer"><span class="hs-identifier hs-type">Tracer</span></a><span>
|
|
</span><a name="line-117"></a><a name="sessionTracer"><a href="TensorFlow.Session.html#sessionTracer"><span class="hs-identifier">sessionTracer</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">lens</span><span> </span><span class="hs-identifier">_sessionTracer</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><a name="local-6989586621679122457"><a href="#local-6989586621679122457"><span class="hs-identifier">g</span></a></a><span> </span><a name="local-6989586621679122458"><a href="#local-6989586621679122458"><span class="hs-identifier">x</span></a></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122457"><span class="hs-identifier hs-var">g</span></a><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">_sessionTracer</span><span> </span><span class="hs-glyph">=</span><span> </span><a href="#local-6989586621679122458"><span class="hs-identifier hs-var">x</span></a><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-118"></a><span>
|
|
</span><a name="line-119"></a><span class="hs-comment">-- | Run 'Session' actions in a new TensorFlow session created with</span><span>
|
|
</span><a name="line-120"></a><span class="hs-comment">-- the given option setter actions ('sessionTarget', 'sessionConfig').</span><span>
|
|
</span><a name="line-121"></a><span class="hs-identifier">runSessionWithOptions</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadMask</span><span> </span><a href="#local-6989586621679122449"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122449"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><a href="TensorFlow.Session.html#Options"><span class="hs-identifier hs-type">Options</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122449"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122450"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122449"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122450"><span class="hs-identifier hs-type">a</span></a><span>
|
|
</span><a name="line-122"></a><a name="runSessionWithOptions"><a href="TensorFlow.Session.html#runSessionWithOptions"><span class="hs-identifier">runSessionWithOptions</span></a></a><span> </span><a name="local-6989586621679122459"><a href="#local-6989586621679122459"><span class="hs-identifier">options</span></a></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><a name="local-6989586621679122460"><a href="#local-6989586621679122460"><span class="hs-identifier">m</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
|
|
</span><a name="line-123"></a><span> </span><a href="TensorFlow.Internal.FFI.html#withSession"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">withSession</span></a><span> </span><a href="#local-6989586621679122461"><span class="hs-identifier hs-var">applyOptions</span></a><span> </span><span class="hs-operator hs-var">$</span><span>
|
|
</span><a name="line-124"></a><span> </span><span class="hs-glyph">\</span><span class="hs-keyword">as</span><span> </span><a name="local-6989586621679122464"><a href="#local-6989586621679122464"><span class="hs-identifier">rs</span></a></a><span> </span><span class="hs-glyph">-></span><span>
|
|
</span><a name="line-125"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122465"><a href="#local-6989586621679122465"><span class="hs-identifier">initState</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#SessionState"><span class="hs-identifier hs-var">SessionState</span></a><span> </span><a href="#local-6989586621679122464"><span class="hs-identifier hs-var">rs</span></a><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-special">(</span><a href="#local-6989586621679122459"><span class="hs-identifier hs-var">options</span></a><span> </span><span class="hs-operator hs-var">^.</span><span> </span><a href="TensorFlow.Session.html#sessionTracer"><span class="hs-identifier hs-var">sessionTracer</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-126"></a><span> </span><span class="hs-keyword">in</span><span> </span><a href="TensorFlow.Build.html#evalBuildT"><span class="hs-identifier hs-var">evalBuildT</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier">runReaderT</span><span> </span><a href="#local-6989586621679122460"><span class="hs-identifier hs-var">m</span></a><span> </span><a href="#local-6989586621679122465"><span class="hs-identifier hs-var">initState</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-127"></a><span> </span><span class="hs-keyword">where</span><span> </span><a name="local-6989586621679122461"><a href="#local-6989586621679122461"><span class="hs-identifier">applyOptions</span></a></a><span> </span><a name="local-6989586621679122462"><a href="#local-6989586621679122462"><span class="hs-identifier">opt</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-128"></a><span> </span><a href="TensorFlow.Internal.FFI.html#setSessionTarget"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">setSessionTarget</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679122459"><span class="hs-identifier hs-var">options</span></a><span> </span><span class="hs-operator hs-var">^.</span><span> </span><a href="TensorFlow.Session.html#sessionTarget"><span class="hs-identifier hs-var">sessionTarget</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679122462"><span class="hs-identifier hs-var">opt</span></a><span>
|
|
</span><a name="line-129"></a><span> </span><a href="TensorFlow.Internal.FFI.html#setSessionConfig"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">setSessionConfig</span></a><span> </span><span class="hs-special">(</span><a href="#local-6989586621679122459"><span class="hs-identifier hs-var">options</span></a><span> </span><span class="hs-operator hs-var">^.</span><span> </span><a href="TensorFlow.Session.html#sessionConfig"><span class="hs-identifier hs-var">sessionConfig</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679122462"><span class="hs-identifier hs-var">opt</span></a><span>
|
|
</span><a name="line-130"></a><span>
|
|
</span><a name="line-131"></a><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier hs-type">Monad</span><span> </span><a href="#local-6989586621679122433"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">=></span><span> </span><a href="TensorFlow.Build.html#MonadBuild"><span class="hs-identifier hs-type">MonadBuild</span></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122433"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
|
|
</span><a name="line-132"></a><span> </span><a name="local-8214565720323889086"><a href="TensorFlow.Build.html#build"><span class="hs-identifier">build</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier hs-var">lift</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span>
|
|
</span><a name="line-133"></a><span>
|
|
</span><a name="line-134"></a><span class="hs-comment">-- | Add all pending rendered nodes to the TensorFlow graph and runs</span><span>
|
|
</span><a name="line-135"></a><span class="hs-comment">-- any pending initializers.</span><span>
|
|
</span><a name="line-136"></a><span class="hs-comment">--</span><span>
|
|
</span><a name="line-137"></a><span class="hs-comment">-- Note that run, runWithFeeds, etc. will all call this function implicitly.</span><span>
|
|
</span><a name="line-138"></a><span class="hs-identifier">extend</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122448"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">=></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122448"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-139"></a><a name="extend"><a href="TensorFlow.Session.html#extend"><span class="hs-identifier">extend</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-140"></a><span> </span><a name="local-6989586621679122466"><a href="#local-6989586621679122466"><span class="hs-identifier">session</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">asks</span><span> </span><span class="hs-identifier">rawSession</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-141"></a><span> </span><a name="local-6989586621679122467"><a href="#local-6989586621679122467"><span class="hs-identifier">trace</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">asks</span><span> </span><span class="hs-identifier">tracer</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-142"></a><span> </span><a name="local-6989586621679122468"><a href="#local-6989586621679122468"><span class="hs-identifier">nodesToExtend</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><a href="TensorFlow.Build.html#flushNodeBuffer"><span class="hs-identifier hs-var">flushNodeBuffer</span></a><span>
|
|
</span><a name="line-143"></a><span> </span><span class="hs-identifier hs-var">unless</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">null</span><span> </span><a href="#local-6989586621679122468"><span class="hs-identifier hs-var">nodesToExtend</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">liftIO</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-144"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122469"><a href="#local-6989586621679122469"><span class="hs-identifier">graphDef</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">def</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">GraphDef</span><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">&</span><span> </span><span class="hs-identifier hs-var">node</span><span> </span><span class="hs-operator hs-var">.~</span><span> </span><a href="#local-6989586621679122468"><span class="hs-identifier hs-var">nodesToExtend</span></a><span>
|
|
</span><a name="line-145"></a><span> </span><a href="#local-6989586621679122467"><span class="hs-identifier hs-var">trace</span></a><span> </span><span class="hs-special">(</span><span class="hs-string">"Session.extend "</span><span> </span><span class="hs-operator hs-var"><></span><span> </span><span class="hs-identifier hs-var">Builder</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">string8</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">showMessage</span><span> </span><a href="#local-6989586621679122469"><span class="hs-identifier hs-var">graphDef</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-146"></a><span> </span><a href="TensorFlow.Internal.FFI.html#extendGraph"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">extendGraph</span></a><span> </span><a href="#local-6989586621679122466"><span class="hs-identifier hs-var">session</span></a><span> </span><a href="#local-6989586621679122469"><span class="hs-identifier hs-var">graphDef</span></a><span>
|
|
</span><a name="line-147"></a><span> </span><span class="hs-comment">-- Now that all the nodes are created, run the initializers.</span><span>
|
|
</span><a name="line-148"></a><span> </span><a name="local-6989586621679122470"><a href="#local-6989586621679122470"><span class="hs-identifier">initializers</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><a href="TensorFlow.Build.html#flushInitializers"><span class="hs-identifier hs-var">flushInitializers</span></a><span>
|
|
</span><a name="line-149"></a><span> </span><span class="hs-identifier hs-var">unless</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">null</span><span> </span><a href="#local-6989586621679122470"><span class="hs-identifier hs-var">initializers</span></a><span class="hs-special">)</span><span> </span><span class="hs-operator hs-var">$</span><span>
|
|
</span><a name="line-150"></a><span> </span><span class="hs-identifier hs-var">void</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">liftIO</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Internal.FFI.html#run"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">run</span></a><span> </span><a href="#local-6989586621679122466"><span class="hs-identifier hs-var">session</span></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><a href="TensorFlow.Session.html#toNodeNames"><span class="hs-identifier hs-var">toNodeNames</span></a><span> </span><a href="#local-6989586621679122470"><span class="hs-identifier hs-var">initializers</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-151"></a><span>
|
|
</span><a name="line-152"></a><span class="hs-comment">-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span><span>
|
|
</span><a name="line-153"></a><span class="hs-comment">-- rendered, and fetch the corresponding values for 'a'.</span><span>
|
|
</span><a name="line-154"></a><span class="hs-identifier">run</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122445"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Nodes.html#Fetchable"><span class="hs-identifier hs-type">Fetchable</span></a><span> </span><a href="#local-6989586621679122446"><span class="hs-identifier hs-type">t</span></a><span> </span><a href="#local-6989586621679122447"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><a href="#local-6989586621679122446"><span class="hs-identifier hs-type">t</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122445"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122447"><span class="hs-identifier hs-type">a</span></a><span>
|
|
</span><a name="line-155"></a><a name="run"><a href="TensorFlow.Session.html#run"><span class="hs-identifier">run</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#runWithFeeds"><span class="hs-identifier hs-var">runWithFeeds</span></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
|
|
</span><a name="line-156"></a><span>
|
|
</span><a name="line-157"></a><span class="hs-comment">-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span><span>
|
|
</span><a name="line-158"></a><span class="hs-comment">-- rendered, feed the given input values, and fetch the corresponding result</span><span>
|
|
</span><a name="line-159"></a><span class="hs-comment">-- values for 'a'.</span><span>
|
|
</span><a name="line-160"></a><span class="hs-identifier">runWithFeeds</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122442"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Nodes.html#Fetchable"><span class="hs-identifier hs-type">Fetchable</span></a><span> </span><a href="#local-6989586621679122443"><span class="hs-identifier hs-type">t</span></a><span> </span><a href="#local-6989586621679122444"><span class="hs-identifier hs-type">a</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><span class="hs-special">[</span><a href="TensorFlow.Tensor.html#Feed"><span class="hs-identifier hs-type">Feed</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122443"><span class="hs-identifier hs-type">t</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122442"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122444"><span class="hs-identifier hs-type">a</span></a><span>
|
|
</span><a name="line-161"></a><a name="runWithFeeds"><a href="TensorFlow.Session.html#runWithFeeds"><span class="hs-identifier">runWithFeeds</span></a></a><span> </span><a name="local-6989586621679122471"><a href="#local-6989586621679122471"><span class="hs-identifier">feeds</span></a></a><span> </span><a name="local-6989586621679122472"><a href="#local-6989586621679122472"><span class="hs-identifier">t</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-162"></a><span> </span><a name="local-6989586621679122473"><a href="#local-6989586621679122473"><span class="hs-identifier">ns</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Nodes.html#getNodes"><span class="hs-identifier hs-var">getNodes</span></a><span> </span><a href="#local-6989586621679122472"><span class="hs-identifier hs-var">t</span></a><span>
|
|
</span><a name="line-163"></a><span> </span><span class="hs-comment">-- Note that this call to "fetch" shouldn't affect the following "extend"</span><span>
|
|
</span><a name="line-164"></a><span> </span><span class="hs-comment">-- call, since all nodes in t and its inputs/deps will be rendered by the</span><span>
|
|
</span><a name="line-165"></a><span> </span><span class="hs-comment">-- above call to getNodes.</span><span>
|
|
</span><a name="line-166"></a><span> </span><a name="local-6989586621679122474"><a href="#local-6989586621679122474"><span class="hs-identifier">fetch</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Nodes.html#getFetch"><span class="hs-identifier hs-var">getFetch</span></a><span> </span><a href="#local-6989586621679122472"><span class="hs-identifier hs-var">t</span></a><span>
|
|
</span><a name="line-167"></a><span> </span><a href="TensorFlow.Session.html#runFetchWithFeeds"><span class="hs-identifier hs-var">runFetchWithFeeds</span></a><span> </span><a href="#local-6989586621679122471"><span class="hs-identifier hs-var">feeds</span></a><span> </span><a href="#local-6989586621679122473"><span class="hs-identifier hs-var">ns</span></a><span> </span><a href="#local-6989586621679122474"><span class="hs-identifier hs-var">fetch</span></a><span>
|
|
</span><a name="line-168"></a><span>
|
|
</span><a name="line-169"></a><span class="hs-identifier">runFetchWithFeeds</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122440"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-glyph">=></span><span> </span><span class="hs-special">[</span><a href="TensorFlow.Tensor.html#Feed"><span class="hs-identifier hs-type">Feed</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-identifier hs-type">Set</span><span> </span><a href="TensorFlow.Output.html#NodeName"><span class="hs-identifier hs-type">NodeName</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Nodes.html#Fetch"><span class="hs-identifier hs-type">Fetch</span></a><span> </span><a href="#local-6989586621679122441"><span class="hs-identifier hs-type">a</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122440"><span class="hs-identifier hs-type">m</span></a><span> </span><a href="#local-6989586621679122441"><span class="hs-identifier hs-type">a</span></a><span>
|
|
</span><a name="line-170"></a><a name="runFetchWithFeeds"><a href="TensorFlow.Session.html#runFetchWithFeeds"><span class="hs-identifier">runFetchWithFeeds</span></a></a><span> </span><a name="local-6989586621679122475"><a href="#local-6989586621679122475"><span class="hs-identifier">feeds</span></a></a><span> </span><a name="local-6989586621679122476"><a href="#local-6989586621679122476"><span class="hs-identifier">target</span></a></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Nodes.html#Fetch"><span class="hs-identifier hs-var">Fetch</span></a><span> </span><a name="local-6989586621679122477"><a href="#local-6989586621679122477"><span class="hs-identifier">fetch</span></a></a><span> </span><a name="local-6989586621679122478"><a href="#local-6989586621679122478"><span class="hs-identifier">restore</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-171"></a><span> </span><a href="TensorFlow.Session.html#extend"><span class="hs-identifier hs-var">extend</span></a><span>
|
|
</span><a name="line-172"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122479"><a href="#local-6989586621679122479"><span class="hs-identifier">feeds'</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#fixFeeds"><span class="hs-identifier hs-var">fixFeeds</span></a><span> </span><a href="#local-6989586621679122475"><span class="hs-identifier hs-var">feeds</span></a><span>
|
|
</span><a name="line-173"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122480"><a href="#local-6989586621679122480"><span class="hs-identifier">fetchNames</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">encodeUtf8</span><span> </span><span class="hs-operator hs-var"><$></span><span> </span><span class="hs-identifier hs-var">Set</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">toList</span><span> </span><a href="#local-6989586621679122477"><span class="hs-identifier hs-var">fetch</span></a><span>
|
|
</span><a name="line-174"></a><span> </span><a name="local-6989586621679122481"><a href="#local-6989586621679122481"><span class="hs-identifier">targetNames</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#toNodeNames"><span class="hs-identifier hs-var">toNodeNames</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">Set</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">toList</span><span> </span><a href="#local-6989586621679122476"><span class="hs-identifier hs-var">target</span></a><span>
|
|
</span><a name="line-175"></a><span> </span><a name="local-6989586621679122482"><a href="#local-6989586621679122482"><span class="hs-identifier">session</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">asks</span><span> </span><span class="hs-identifier">rawSession</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-176"></a><span> </span><a name="local-6989586621679122483"><a href="#local-6989586621679122483"><span class="hs-identifier">runResult</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><span class="hs-identifier hs-var">liftIO</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Internal.FFI.html#run"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">run</span></a><span> </span><a href="#local-6989586621679122482"><span class="hs-identifier hs-var">session</span></a><span>
|
|
</span><a name="line-177"></a><span> </span><a href="#local-6989586621679122479"><span class="hs-identifier hs-var">feeds'</span></a><span>
|
|
</span><a name="line-178"></a><span> </span><a href="#local-6989586621679122480"><span class="hs-identifier hs-var">fetchNames</span></a><span>
|
|
</span><a name="line-179"></a><span> </span><a href="#local-6989586621679122481"><span class="hs-identifier hs-var">targetNames</span></a><span>
|
|
</span><a name="line-180"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122484"><a href="#local-6989586621679122484"><span class="hs-identifier">resultTensorsMap</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">Map</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">fromList</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">zip</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">Set</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">toList</span><span> </span><a href="#local-6989586621679122477"><span class="hs-identifier hs-var">fetch</span></a><span class="hs-special">)</span><span> </span><a href="#local-6989586621679122483"><span class="hs-identifier hs-var">runResult</span></a><span>
|
|
</span><a name="line-181"></a><span> </span><span class="hs-identifier hs-var">return</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="#local-6989586621679122478"><span class="hs-identifier hs-var">restore</span></a><span> </span><a href="#local-6989586621679122484"><span class="hs-identifier hs-var">resultTensorsMap</span></a><span>
|
|
</span><a name="line-182"></a><span>
|
|
</span><a name="line-183"></a><span class="hs-identifier">toNodeNames</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><a href="TensorFlow.Output.html#NodeName"><span class="hs-identifier hs-type">NodeName</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-identifier hs-type">ByteString</span><span class="hs-special">]</span><span>
|
|
</span><a name="line-184"></a><a name="toNodeNames"><a href="TensorFlow.Session.html#toNodeNames"><span class="hs-identifier">toNodeNames</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">encodeUtf8</span><span> </span><span class="hs-operator hs-var">.</span><span> </span><span class="hs-identifier">unNodeName</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-185"></a><span>
|
|
</span><a name="line-186"></a><span class="hs-comment">-- | Run a subgraph 't', rendering and extending any dependent nodes that aren't</span><span>
|
|
</span><a name="line-187"></a><span class="hs-comment">-- already rendered. This behaves like 'run' except that it doesn't do any</span><span>
|
|
</span><a name="line-188"></a><span class="hs-comment">-- fetches.</span><span>
|
|
</span><a name="line-189"></a><span class="hs-identifier">run_</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122438"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Nodes.html#Nodes"><span class="hs-identifier hs-type">Nodes</span></a><span> </span><a href="#local-6989586621679122439"><span class="hs-identifier hs-type">t</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><a href="#local-6989586621679122439"><span class="hs-identifier hs-type">t</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122438"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-190"></a><a name="run_"><a href="TensorFlow.Session.html#run_"><span class="hs-identifier">run_</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#runWithFeeds_"><span class="hs-identifier hs-var">runWithFeeds_</span></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
|
|
</span><a name="line-191"></a><span>
|
|
</span><a name="line-192"></a><span class="hs-comment">-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span><span>
|
|
</span><a name="line-193"></a><span class="hs-comment">-- rendered, feed the given input values, and fetch the corresponding result</span><span>
|
|
</span><a name="line-194"></a><span class="hs-comment">-- values for 'a'. This behaves like 'runWithFeeds' except that it doesn't do</span><span>
|
|
</span><a name="line-195"></a><span class="hs-comment">-- any fetches.</span><span>
|
|
</span><a name="line-196"></a><span class="hs-identifier">runWithFeeds_</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122436"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Nodes.html#Nodes"><span class="hs-identifier hs-type">Nodes</span></a><span> </span><a href="#local-6989586621679122437"><span class="hs-identifier hs-type">t</span></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">=></span><span> </span><span class="hs-special">[</span><a href="TensorFlow.Tensor.html#Feed"><span class="hs-identifier hs-type">Feed</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><a href="#local-6989586621679122437"><span class="hs-identifier hs-type">t</span></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122436"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-197"></a><a name="runWithFeeds_"><a href="TensorFlow.Session.html#runWithFeeds_"><span class="hs-identifier">runWithFeeds_</span></a></a><span> </span><a name="local-6989586621679122485"><a href="#local-6989586621679122485"><span class="hs-identifier">feeds</span></a></a><span> </span><a name="local-6989586621679122486"><a href="#local-6989586621679122486"><span class="hs-identifier">t</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-198"></a><span> </span><a name="local-6989586621679122487"><a href="#local-6989586621679122487"><span class="hs-identifier">ns</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Nodes.html#getNodes"><span class="hs-identifier hs-var">getNodes</span></a><span> </span><a href="#local-6989586621679122486"><span class="hs-identifier hs-var">t</span></a><span>
|
|
</span><a name="line-199"></a><span> </span><a href="TensorFlow.Session.html#runFetchWithFeeds"><span class="hs-identifier hs-var">runFetchWithFeeds</span></a><span> </span><a href="#local-6989586621679122485"><span class="hs-identifier hs-var">feeds</span></a><span> </span><a href="#local-6989586621679122487"><span class="hs-identifier hs-var">ns</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">pure</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-200"></a><span>
|
|
</span><a name="line-201"></a><span class="hs-identifier">fixFeeds</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><a href="TensorFlow.Tensor.html#Feed"><span class="hs-identifier hs-type">Feed</span></a><span class="hs-special">]</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="hs-identifier hs-type">ByteString</span><span class="hs-special">,</span><span> </span><a href="TensorFlow.Internal.FFI.html#TensorData"><span class="hs-identifier hs-type">FFI</span><span class="hs-operator hs-type">.</span><span class="hs-identifier hs-type">TensorData</span></a><span class="hs-special">)</span><span class="hs-special">]</span><span>
|
|
</span><a name="line-202"></a><a name="fixFeeds"><a href="TensorFlow.Session.html#fixFeeds"><span class="hs-identifier">fixFeeds</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">map</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><a href="TensorFlow.Tensor.html#Feed"><span class="hs-identifier hs-var">Feed</span></a><span> </span><a name="local-6989586621679122488"><a href="#local-6989586621679122488"><span class="hs-identifier">o</span></a></a><span> </span><a name="local-6989586621679122489"><a href="#local-6989586621679122489"><span class="hs-identifier">d</span></a></a><span class="hs-special">)</span><span> </span><span class="hs-glyph">-></span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">encodeUtf8</span><span> </span><span class="hs-operator hs-var">$</span><span> </span><a href="TensorFlow.Build.html#encodeOutput"><span class="hs-identifier hs-var">encodeOutput</span></a><span> </span><a href="#local-6989586621679122488"><span class="hs-identifier hs-var">o</span></a><span class="hs-special">,</span><span> </span><a href="#local-6989586621679122489"><span class="hs-identifier hs-var">d</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-203"></a><span>
|
|
</span><a name="line-204"></a><span class="hs-comment">-- | Starts a concurrent thread which evaluates the given Nodes</span><span>
|
|
</span><a name="line-205"></a><span class="hs-comment">-- forever until runSession exits or an exception occurs. Graph</span><span>
|
|
</span><a name="line-206"></a><span class="hs-comment">-- extension happens synchronously, but the resultant run proceeds as</span><span>
|
|
</span><a name="line-207"></a><span class="hs-comment">-- a separate thread.</span><span>
|
|
</span><a name="line-208"></a><span class="hs-identifier">asyncProdNodes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-type">MonadIO</span><span> </span><a href="#local-6989586621679122434"><span class="hs-identifier hs-type">m</span></a><span class="hs-special">,</span><span> </span><a href="TensorFlow.Nodes.html#Nodes"><span class="hs-identifier hs-type">Nodes</span></a><span> </span><a href="#local-6989586621679122435"><span class="hs-identifier hs-type">t</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-209"></a><span> </span><span class="hs-glyph">=></span><span> </span><a href="#local-6989586621679122435"><span class="hs-identifier hs-type">t</span></a><span> </span><span class="hs-comment">-- ^ Node to evaluate concurrently.</span><span>
|
|
</span><a name="line-210"></a><span> </span><span class="hs-glyph">-></span><span> </span><a href="TensorFlow.Session.html#SessionT"><span class="hs-identifier hs-type">SessionT</span></a><span> </span><a href="#local-6989586621679122434"><span class="hs-identifier hs-type">m</span></a><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-211"></a><a name="asyncProdNodes"><a href="TensorFlow.Session.html#asyncProdNodes"><span class="hs-identifier">asyncProdNodes</span></a></a><span> </span><a name="local-6989586621679122490"><a href="#local-6989586621679122490"><span class="hs-identifier">nodes</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
|
|
</span><a name="line-212"></a><span> </span><a name="local-6989586621679122491"><a href="#local-6989586621679122491"><span class="hs-identifier">target</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Build.html#build"><span class="hs-identifier hs-var">build</span></a><span> </span><span class="hs-special">(</span><a href="TensorFlow.Nodes.html#getNodes"><span class="hs-identifier hs-var">getNodes</span></a><span> </span><a href="#local-6989586621679122490"><span class="hs-identifier hs-var">nodes</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-213"></a><span> </span><a href="TensorFlow.Session.html#extend"><span class="hs-identifier hs-var">extend</span></a><span>
|
|
</span><a name="line-214"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122492"><a href="#local-6989586621679122492"><span class="hs-identifier">targetNames</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="TensorFlow.Session.html#toNodeNames"><span class="hs-identifier hs-var">toNodeNames</span></a><span> </span><span class="hs-operator hs-var">$</span><span> </span><span class="hs-identifier hs-var">Set</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">toList</span><span> </span><a href="#local-6989586621679122491"><span class="hs-identifier hs-var">target</span></a><span>
|
|
</span><a name="line-215"></a><span> </span><a name="local-6989586621679122493"><a href="#local-6989586621679122493"><span class="hs-identifier">state</span></a></a><span> </span><span class="hs-glyph"><-</span><span> </span><a href="TensorFlow.Session.html#Session"><span class="hs-identifier hs-var">Session</span></a><span> </span><span class="hs-identifier hs-var">ask</span><span>
|
|
</span><a name="line-216"></a><span> </span><span class="hs-keyword">let</span><span> </span><a name="local-6989586621679122494"><a href="#local-6989586621679122494"><span class="hs-identifier">loop</span></a></a><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier hs-var">forever</span><span> </span><span class="hs-special">(</span><span class="hs-identifier hs-var">void</span><span> </span><span class="hs-special">(</span><a href="TensorFlow.Internal.FFI.html#run"><span class="hs-identifier hs-var">FFI</span><span class="hs-operator hs-var">.</span><span class="hs-identifier hs-var">run</span></a><span> </span><span class="hs-special">(</span><span class="hs-identifier">rawSession</span><span> </span><a href="#local-6989586621679122493"><span class="hs-identifier hs-var">state</span></a><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><a href="#local-6989586621679122492"><span class="hs-identifier hs-var">targetNames</span></a><span class="hs-special">)</span><span class="hs-special">)</span><span>
|
|
</span><a name="line-217"></a><span> </span><span class="hs-identifier hs-var">liftIO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">asyncCollector</span><span> </span><a href="#local-6989586621679122493"><span class="hs-identifier hs-var">state</span></a><span> </span><a href="#local-6989586621679122494"><span class="hs-identifier hs-var">loop</span></a><span class="hs-special">)</span><span>
|
|
</span><a name="line-218"></a></pre></body></html> |