1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-23 03:19:44 +01:00
* Trivial script for regenerating haddocks: exclude .haddock files.

* Haddock regen
This commit is contained in:
Greg Steuck 2016-10-25 12:43:06 -07:00 committed by GitHub
parent db69e1d311
commit ea8b62e47b
277 changed files with 52638 additions and 1 deletions

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - /)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - /</p><table><tr><td class="src">/=</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Types.html#t:-47--61-">TensorFlow.Types</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - \)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - \</p><table><tr><td class="src">\\</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Types.html#t:-92--92-">TensorFlow.Types</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - H)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - H</p><table><tr><td class="src">halfVal</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Tensor.html#v:halfVal">Proto.Tensorflow.Core.Framework.Tensor</a></td></tr><tr><td class="src">hashCode</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-ResourceHandle.html#v:hashCode">Proto.Tensorflow.Core.Framework.ResourceHandle</a></td></tr><tr><td class="src">hasMinimum</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-OpDef.html#v:hasMinimum">Proto.Tensorflow.Core.Framework.OpDef</a></td></tr><tr><td class="src">histogramSummary</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:histogramSummary">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">hoistBuildT</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:hoistBuildT">TensorFlow.Build</a></td></tr><tr><td class="src">hSVToRGB</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:hSVToRGB">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - K)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - K</p><table><tr><td class="src">key</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Protobuf-Config.html#v:key">Proto.Tensorflow.Core.Protobuf.Config</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html#v:key">Proto.Tensorflow.Core.Framework.NodeDef</a></td></tr><tr><td class="alt">3 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-AttrValue.html#v:key">Proto.Tensorflow.Core.Framework.AttrValue</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - Q)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - Q</p><table><tr><td class="src">quantizeAndDequantize</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:quantizeAndDequantize">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">Queue2</td><td class="module"><a href="./tensorflow-queue-0.1.0.0/TensorFlow-Queue.html#t:Queue2">TensorFlow.Queue</a></td></tr><tr><td class="src">queueClose</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:queueClose">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">queueSize</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:queueSize">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - U)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - U</p><table><tr><td class="src">unControlNode</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html#v:unControlNode">TensorFlow.Output</a>, <a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:unControlNode">TensorFlow.Build</a></td></tr><tr><td class="src">uniformCandidateSampler</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:uniformCandidateSampler">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">Unique</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#t:Unique">TensorFlow.Build</a></td></tr><tr><td class="src">unique</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:unique">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">uniqueWithCounts</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:uniqueWithCounts">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">unknownRank</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-TensorShape.html#v:unknownRank">Proto.Tensorflow.Core.Framework.TensorShape</a></td></tr><tr><td class="src">unNodeName</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html#v:unNodeName">TensorFlow.Output</a></td></tr><tr><td class="src">unOpType</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html#v:unOpType">TensorFlow.Output</a></td></tr><tr><td class="src">unOutputIx</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html#v:unOutputIx">TensorFlow.Output</a></td></tr><tr><td class="src">unpack</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:unpack">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">Unrendered</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html#v:Unrendered">TensorFlow.Output</a></td></tr><tr><td class="src">unScalar</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Nodes.html#v:unScalar">TensorFlow.Nodes</a></td></tr><tr><td class="src">unsortedSegmentSum</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:unsortedSegmentSum">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">unTensorData</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Types.html#v:unTensorData">TensorFlow.Types</a></td></tr><tr><td class="src">usePerSessionThreads</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Protobuf-Config.html#v:usePerSessionThreads">Proto.Tensorflow.Core.Protobuf.Config</a></td></tr><tr><td class="src">useProtoAsVoidPtrLen</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Internal-FFI.html#v:useProtoAsVoidPtrLen">TensorFlow.Internal.FFI</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - V)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - V</p><table><tr><td class="src">Value</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Tensor.html#t:Value">TensorFlow.Tensor</a></td></tr><tr><td class="src">value</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Tensor.html#v:value">TensorFlow.Tensor</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Protobuf-Config.html#v:value">Proto.Tensorflow.Core.Protobuf.Config</a></td></tr><tr><td class="alt">3 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html#v:value">Proto.Tensorflow.Core.Framework.NodeDef</a></td></tr><tr><td class="alt">4 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-AttrValue.html#v:value">Proto.Tensorflow.Core.Framework.AttrValue</a></td></tr><tr><td class="src">ValueKind</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Tensor.html#v:ValueKind">TensorFlow.Tensor</a></td></tr><tr><td class="src">variable</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:variable">TensorFlow.GenOps.Core</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:variable">TensorFlow.Ops</a></td></tr><tr><td class="src">vector</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:vector">TensorFlow.Ops</a></td></tr><tr><td class="src">version</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Graph.html#v:version">Proto.Tensorflow.Core.Framework.Graph</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-OpDef.html#v:version">Proto.Tensorflow.Core.Framework.OpDef</a></td></tr><tr><td class="src">versionNumber</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Tensor.html#v:versionNumber">Proto.Tensorflow.Core.Framework.Tensor</a></td></tr><tr><td class="src">versions</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Graph.html#v:versions">Proto.Tensorflow.Core.Framework.Graph</a></td></tr><tr><td class="src">visibleDeviceList</td><td class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Protobuf-Config.html#v:visibleDeviceList">Proto.Tensorflow.Core.Protobuf.Config</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - W)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - W</p><table><tr><td class="src">where'</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:where-39-">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">wholeFileReader</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:wholeFileReader">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">withControlDependencies</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-ControlFlow.html#v:withControlDependencies">TensorFlow.ControlFlow</a></td></tr><tr><td class="src">withDevice</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:withDevice">TensorFlow.Build</a></td></tr><tr><td class="src">withNameScope</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:withNameScope">TensorFlow.Build</a></td></tr><tr><td class="src">withNodeDependencies</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:withNodeDependencies">TensorFlow.Build</a></td></tr><tr><td class="src">withSession</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Internal-FFI.html#v:withSession">TensorFlow.Internal.FFI</a></td></tr><tr><td class="src">withStateLens</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html#v:withStateLens">TensorFlow.Build</a></td></tr><tr><td class="src">wtsCkpt</td><td class="module"><a href="./tensorflow-mnist-0.1.0.0/TensorFlow-Examples-MNIST-TrainedGraph.html#v:wtsCkpt">TensorFlow.Examples.MNIST.TrainedGraph</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index - Z)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - Z</p><table><tr><td class="src">zeroInitializedVariable</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:zeroInitializedVariable">TensorFlow.Ops</a></td></tr><tr><td class="src">zeros</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:zeros">TensorFlow.Ops</a></td></tr><tr><td class="src">zerosLike</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:zerosLike">TensorFlow.GenOps.Core</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:zerosLike">TensorFlow.Ops</a></td></tr><tr><td class="src">zeta</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:zeta">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title> (Index)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty">&nbsp;</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-K.html">K</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-47.html">/</a></li><li><a href="doc-index-92.html">\</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

30
docs/haddock/frames.html Normal file
View file

@ -0,0 +1,30 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="haddock-util.js" type="text/javascript"></script>
<script type="text/javascript"><!--
/*
The synopsis frame needs to be updated using javascript, so we hide
it by default and only show it if javascript is enabled.
TODO: provide some means to disable it.
*/
function load() {
var d = document.getElementById("inner-fs");
d.rows = "50%,50%";
postReframe();
}
--></script>
</head>
<frameset id="outer-fs" cols="25%,75%" onload="load()">
<frameset id="inner-fs" rows="100%,0%">
<frame src="index-frames.html" name="modules" />
<frame src="" name="synopsis" />
</frameset>
<frame src="index.html" name="main" />
</frameset>
</html>

View file

@ -0,0 +1,344 @@
// Haddock JavaScript utilities
var rspace = /\s\s+/g,
rtrim = /^\s+|\s+$/g;
function spaced(s) { return (" " + s + " ").replace(rspace, " "); }
function trim(s) { return s.replace(rtrim, ""); }
function hasClass(elem, value) {
var className = spaced(elem.className || "");
return className.indexOf( " " + value + " " ) >= 0;
}
function addClass(elem, value) {
var className = spaced(elem.className || "");
if ( className.indexOf( " " + value + " " ) < 0 ) {
elem.className = trim(className + " " + value);
}
}
function removeClass(elem, value) {
var className = spaced(elem.className || "");
className = className.replace(" " + value + " ", " ");
elem.className = trim(className);
}
function toggleClass(elem, valueOn, valueOff, bool) {
if (bool == null) { bool = ! hasClass(elem, valueOn); }
if (bool) {
removeClass(elem, valueOff);
addClass(elem, valueOn);
}
else {
removeClass(elem, valueOn);
addClass(elem, valueOff);
}
return bool;
}
function makeClassToggle(valueOn, valueOff)
{
return function(elem, bool) {
return toggleClass(elem, valueOn, valueOff, bool);
}
}
toggleShow = makeClassToggle("show", "hide");
toggleCollapser = makeClassToggle("collapser", "expander");
function toggleSection(id)
{
var b = toggleShow(document.getElementById("section." + id));
toggleCollapser(document.getElementById("control." + id), b);
rememberCollapsed(id, b);
return b;
}
var collapsed = {};
function rememberCollapsed(id, b)
{
if(b)
delete collapsed[id]
else
collapsed[id] = null;
var sections = [];
for(var i in collapsed)
{
if(collapsed.hasOwnProperty(i))
sections.push(i);
}
// cookie specific to this page; don't use setCookie which sets path=/
document.cookie = "collapsed=" + escape(sections.join('+'));
}
function restoreCollapsed()
{
var cookie = getCookie("collapsed");
if(!cookie)
return;
var ids = cookie.split('+');
for(var i in ids)
{
if(document.getElementById("section." + ids[i]))
toggleSection(ids[i]);
}
}
function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + ";path=/;";
}
function clearCookie(name) {
document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) {
return unescape(c.substring(nameEQ.length,c.length));
}
}
return null;
}
var max_results = 75; // 50 is not enough to search for map in the base libraries
var shown_range = null;
var last_search = null;
function quick_search()
{
perform_search(false);
}
function full_search()
{
perform_search(true);
}
function perform_search(full)
{
var text = document.getElementById("searchbox").value.toLowerCase();
if (text == last_search && !full) return;
last_search = text;
var table = document.getElementById("indexlist");
var status = document.getElementById("searchmsg");
var children = table.firstChild.childNodes;
// first figure out the first node with the prefix
var first = bisect(-1);
var last = (first == -1 ? -1 : bisect(1));
if (first == -1)
{
table.className = "";
status.innerHTML = "No results found, displaying all";
}
else if (first == 0 && last == children.length - 1)
{
table.className = "";
status.innerHTML = "";
}
else if (last - first >= max_results && !full)
{
table.className = "";
status.innerHTML = "More than " + max_results + ", press Search to display";
}
else
{
// decide what you need to clear/show
if (shown_range)
setclass(shown_range[0], shown_range[1], "indexrow");
setclass(first, last, "indexshow");
shown_range = [first, last];
table.className = "indexsearch";
status.innerHTML = "";
}
function setclass(first, last, status)
{
for (var i = first; i <= last; i++)
{
children[i].className = status;
}
}
// do a binary search, treating 0 as ...
// return either -1 (no 0's found) or location of most far match
function bisect(dir)
{
var first = 0, finish = children.length - 1;
var mid, success = false;
while (finish - first > 3)
{
mid = Math.floor((finish + first) / 2);
var i = checkitem(mid);
if (i == 0) i = dir;
if (i == -1)
finish = mid;
else
first = mid;
}
var a = (dir == 1 ? first : finish);
var b = (dir == 1 ? finish : first);
for (var i = b; i != a - dir; i -= dir)
{
if (checkitem(i) == 0) return i;
}
return -1;
}
// from an index, decide what the result is
// 0 = match, -1 is lower, 1 is higher
function checkitem(i)
{
var s = getitem(i).toLowerCase().substr(0, text.length);
if (s == text) return 0;
else return (s > text ? -1 : 1);
}
// from an index, get its string
// this abstracts over alternates
function getitem(i)
{
for ( ; i >= 0; i--)
{
var s = children[i].firstChild.firstChild.data;
if (s.indexOf(' ') == -1)
return s;
}
return ""; // should never be reached
}
}
function setSynopsis(filename) {
if (parent.window.synopsis) {
if (parent.window.synopsis.location.replace) {
// In Firefox this avoids adding the change to the history.
parent.window.synopsis.location.replace(filename);
} else {
parent.window.synopsis.location = filename;
}
}
}
function addMenuItem(html) {
var menu = document.getElementById("page-menu");
if (menu) {
var btn = menu.firstChild.cloneNode(false);
btn.innerHTML = html;
menu.appendChild(btn);
}
}
function adjustForFrames() {
var bodyCls;
if (parent.location.href == window.location.href) {
// not in frames, so add Frames button
addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>");
bodyCls = "no-frame";
}
else {
bodyCls = "in-frame";
}
addClass(document.body, bodyCls);
}
function reframe() {
setCookie("haddock-reframe", document.URL);
window.location = "frames.html";
}
function postReframe() {
var s = getCookie("haddock-reframe");
if (s) {
parent.window.main.location = s;
clearCookie("haddock-reframe");
}
}
function styles() {
var i, a, es = document.getElementsByTagName("link"), rs = [];
for (i = 0; a = es[i]; i++) {
if(a.rel.indexOf("style") != -1 && a.title) {
rs.push(a);
}
}
return rs;
}
function addStyleMenu() {
var as = styles();
var i, a, btns = "";
for(i=0; a = as[i]; i++) {
btns += "<li><a href='#' onclick=\"setActiveStyleSheet('"
+ a.title + "'); return false;\">"
+ a.title + "</a></li>"
}
if (as.length > 1) {
var h = "<div id='style-menu-holder'>"
+ "<a href='#' onclick='styleMenu(); return false;'>Style &#9662;</a>"
+ "<ul id='style-menu' class='hide'>" + btns + "</ul>"
+ "</div>";
addMenuItem(h);
}
}
function setActiveStyleSheet(title) {
var as = styles();
var i, a, found;
for(i=0; a = as[i]; i++) {
a.disabled = true;
// need to do this always, some browsers are edge triggered
if(a.title == title) {
found = a;
}
}
if (found) {
found.disabled = false;
setCookie("haddock-style", title);
}
else {
as[0].disabled = false;
clearCookie("haddock-style");
}
styleMenu(false);
}
function resetStyle() {
var s = getCookie("haddock-style");
if (s) setActiveStyleSheet(s);
}
function styleMenu(show) {
var m = document.getElementById('style-menu');
if (m) toggleShow(m, show);
}
function pageLoad() {
addStyleMenu();
adjustForFrames();
resetStyle();
restoreCollapsed();
}

BIN
docs/haddock/hslogo-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-list"><p class="caption">Modules</p><ul><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-AttrValue.html" target="main">Proto.Tensorflow.Core.Framework.AttrValue</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Graph.html" target="main">Proto.Tensorflow.Core.Framework.Graph</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-NodeDef.html" target="main">Proto.Tensorflow.Core.Framework.NodeDef</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-OpDef.html" target="main">Proto.Tensorflow.Core.Framework.OpDef</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-ResourceHandle.html" target="main">Proto.Tensorflow.Core.Framework.ResourceHandle</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Tensor.html" target="main">Proto.Tensorflow.Core.Framework.Tensor</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-TensorShape.html" target="main">Proto.Tensorflow.Core.Framework.TensorShape</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Framework-Types.html" target="main">Proto.Tensorflow.Core.Framework.Types</a></li><li class="module"><a href="./tensorflow-proto-0.1.0.0/Proto-Tensorflow-Core-Protobuf-Config.html" target="main">Proto.Tensorflow.Core.Protobuf.Config</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Build.html" target="main">TensorFlow.Build</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-BuildOp.html" target="main">TensorFlow.BuildOp</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-ControlFlow.html" target="main">TensorFlow.ControlFlow</a></li><li class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-EmbeddingOps.html" target="main">TensorFlow.EmbeddingOps</a></li><li class="module"><a href="./tensorflow-mnist-input-data-0.1.0.0/TensorFlow-Examples-MNIST-InputData.html" target="main">TensorFlow.Examples.MNIST.InputData</a></li><li class="module"><a href="./tensorflow-mnist-0.1.0.0/TensorFlow-Examples-MNIST-Parse.html" target="main">TensorFlow.Examples.MNIST.Parse</a></li><li class="module"><a href="./tensorflow-mnist-0.1.0.0/TensorFlow-Examples-MNIST-TrainedGraph.html" target="main">TensorFlow.Examples.MNIST.TrainedGraph</a></li><li class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html" target="main">TensorFlow.GenOps.Core</a></li><li class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Gradient.html" target="main">TensorFlow.Gradient</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Internal-FFI.html" target="main">TensorFlow.Internal.FFI</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Internal-VarInt.html" target="main">TensorFlow.Internal.VarInt</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Nodes.html" target="main">TensorFlow.Nodes</a></li><li class="module"><a href="./tensorflow-opgen-0.1.0.0/TensorFlow-OpGen.html" target="main">TensorFlow.OpGen</a></li><li class="module"><a href="./tensorflow-opgen-0.1.0.0/TensorFlow-OpGen-AttrVal.html" target="main">TensorFlow.OpGen.AttrVal</a></li><li class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html" target="main">TensorFlow.Ops</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Output.html" target="main">TensorFlow.Output</a></li><li class="module"><a href="./tensorflow-queue-0.1.0.0/TensorFlow-Queue.html" target="main">TensorFlow.Queue</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Session.html" target="main">TensorFlow.Session</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Tensor.html" target="main">TensorFlow.Tensor</a></li><li class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Types.html" target="main">TensorFlow.Types</a></li></ul></div></body></html>

4
docs/haddock/index.html Normal file

File diff suppressed because one or more lines are too long

BIN
docs/haddock/minus.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 B

600
docs/haddock/ocean.css Normal file
View file

@ -0,0 +1,600 @@
/* @group Fundamentals */
* { margin: 0; padding: 0 }
/* Is this portable? */
html {
background-color: white;
width: 100%;
height: 100%;
}
body {
background: white;
color: black;
text-align: left;
min-height: 100%;
position: relative;
}
p {
margin: 0.8em 0;
}
ul, ol {
margin: 0.8em 0 0.8em 2em;
}
dl {
margin: 0.8em 0;
}
dt {
font-weight: bold;
}
dd {
margin-left: 2em;
}
a { text-decoration: none; }
a[href]:link { color: rgb(196,69,29); }
a[href]:visited { color: rgb(171,105,84); }
a[href]:hover { text-decoration:underline; }
/* @end */
/* @group Fonts & Sizes */
/* Basic technique & IE workarounds from YUI 3
For reasons, see:
http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css
*/
body {
font:13px/1.4 sans-serif;
*font-size:small; /* for IE */
*font:x-small; /* for IE in quirks mode */
}
h1 { font-size: 146.5%; /* 19pt */ }
h2 { font-size: 131%; /* 17pt */ }
h3 { font-size: 116%; /* 15pt */ }
h4 { font-size: 100%; /* 13pt */ }
h5 { font-size: 100%; /* 13pt */ }
select, input, button, textarea {
font:99% sans-serif;
}
table {
font-size:inherit;
font:100%;
}
pre, code, kbd, samp, tt, .src {
font-family:monospace;
*font-size:108%;
line-height: 124%;
}
.links, .link {
font-size: 85%; /* 11pt */
}
#module-header .caption {
font-size: 182%; /* 24pt */
}
.info {
font-size: 85%; /* 11pt */
}
#table-of-contents, #synopsis {
/* font-size: 85%; /* 11pt */
}
/* @end */
/* @group Common */
.caption, h1, h2, h3, h4, h5, h6 {
font-weight: bold;
color: rgb(78,98,114);
margin: 0.8em 0 0.4em;
}
* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
margin-top: 2em;
}
h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
margin-top: inherit;
}
ul.links {
list-style: none;
text-align: left;
float: right;
display: inline-table;
margin: 0 0 0 1em;
}
ul.links li {
display: inline;
border-left: 1px solid #d5d5d5;
white-space: nowrap;
padding: 0;
}
ul.links li a {
padding: 0.2em 0.5em;
}
.hide { display: none; }
.show { display: inherit; }
.clear { clear: both; }
.collapser {
background-image: url(minus.gif);
background-repeat: no-repeat;
}
.expander {
background-image: url(plus.gif);
background-repeat: no-repeat;
}
p.caption.collapser,
p.caption.expander {
background-position: 0 0.4em;
}
.collapser, .expander {
padding-left: 14px;
margin-left: -14px;
cursor: pointer;
}
pre {
padding: 0.25em;
margin: 0.8em 0;
background: rgb(229,237,244);
overflow: auto;
border-bottom: 0.25em solid white;
/* white border adds some space below the box to compensate
for visual extra space that paragraphs have between baseline
and the bounding box */
}
.src {
background: #f0f0f0;
padding: 0.2em 0.5em;
}
.keyword { font-weight: normal; }
.def { font-weight: bold; }
/* @end */
/* @group Page Structure */
#content {
margin: 0 auto;
padding: 0 2em 6em;
}
#package-header {
background: rgb(41,56,69);
border-top: 5px solid rgb(78,98,114);
color: #ddd;
padding: 0.2em;
position: relative;
text-align: left;
}
#package-header .caption {
background: url(hslogo-16.png) no-repeat 0em;
color: white;
margin: 0 2em;
font-weight: normal;
font-style: normal;
padding-left: 2em;
}
#package-header a:link, #package-header a:visited { color: white; }
#package-header a:hover { background: rgb(78,98,114); }
#module-header .caption {
color: rgb(78,98,114);
font-weight: bold;
border-bottom: 1px solid #ddd;
}
table.info {
float: right;
padding: 0.5em 1em;
border: 1px solid #ddd;
color: rgb(78,98,114);
background-color: #fff;
max-width: 40%;
border-spacing: 0;
position: relative;
top: -0.5em;
margin: 0 0 0 2em;
}
.info th {
padding: 0 1em 0 0;
}
div#style-menu-holder {
position: relative;
z-index: 2;
display: inline;
}
#style-menu {
position: absolute;
z-index: 1;
overflow: visible;
background: #374c5e;
margin: 0;
text-align: center;
right: 0;
padding: 0;
top: 1.25em;
}
#style-menu li {
display: list-item;
border-style: none;
margin: 0;
padding: 0;
color: #000;
list-style-type: none;
}
#style-menu li + li {
border-top: 1px solid #919191;
}
#style-menu a {
width: 6em;
padding: 3px;
display: block;
}
#footer {
background: #ddd;
border-top: 1px solid #aaa;
padding: 0.5em 0;
color: #666;
text-align: center;
position: absolute;
bottom: 0;
width: 100%;
height: 3em;
}
/* @end */
/* @group Front Matter */
#table-of-contents {
float: right;
clear: right;
background: #faf9dc;
border: 1px solid #d8d7ad;
padding: 0.5em 1em;
max-width: 20em;
margin: 0.5em 0 1em 1em;
}
#table-of-contents .caption {
text-align: center;
margin: 0;
}
#table-of-contents ul {
list-style: none;
margin: 0;
}
#table-of-contents ul ul {
margin-left: 2em;
}
#description .caption {
display: none;
}
#synopsis {
display: none;
}
.no-frame #synopsis {
display: block;
position: fixed;
right: 0;
height: 80%;
top: 10%;
padding: 0;
max-width: 75%;
}
#synopsis .caption {
float: left;
width: 29px;
color: rgba(255,255,255,0);
height: 110px;
margin: 0;
font-size: 1px;
padding: 0;
}
#synopsis p.caption.collapser {
background: url(synopsis.png) no-repeat -64px -8px;
}
#synopsis p.caption.expander {
background: url(synopsis.png) no-repeat 0px -8px;
}
#synopsis ul {
height: 100%;
overflow: auto;
padding: 0.5em;
margin: 0;
}
#synopsis ul ul {
overflow: hidden;
}
#synopsis ul,
#synopsis ul li.src {
background-color: #faf9dc;
white-space: nowrap;
list-style: none;
margin-left: 0;
}
/* @end */
/* @group Main Content */
#interface div.top { margin: 2em 0; }
#interface h1 + div.top,
#interface h2 + div.top,
#interface h3 + div.top,
#interface h4 + div.top,
#interface h5 + div.top {
margin-top: 1em;
}
#interface p.src .link {
float: right;
color: #919191;
border-left: 1px solid #919191;
background: #f0f0f0;
padding: 0 0.5em 0.2em;
margin: 0 -0.5em 0 0.5em;
}
#interface td.src .link {
float: right;
color: #919191;
border-left: 1px solid #919191;
background: #f0f0f0;
padding: 0 0.5em 0.2em;
margin: 0 -0.5em 0 0.5em;
}
#interface span.fixity {
color: #919191;
border-left: 1px solid #919191;
padding: 0.2em 0.5em 0.2em 0.5em;
margin: 0 -1em 0 1em;
}
#interface span.rightedge {
border-left: 1px solid #919191;
padding: 0.2em 0 0.2em 0;
margin: 0 0 0 1em;
}
#interface table { border-spacing: 2px; }
#interface td {
vertical-align: top;
padding-left: 0.5em;
}
#interface td.src {
white-space: nowrap;
}
#interface td.doc p {
margin: 0;
}
#interface td.doc p + p {
margin-top: 0.8em;
}
.clearfix:after {
clear: both;
content: " ";
display: block;
height: 0;
visibility: hidden;
}
.subs dl {
margin: 0;
}
.subs dt {
float: left;
clear: left;
display: block;
margin: 1px 0;
}
.subs dd {
float: right;
width: 90%;
display: block;
padding-left: 0.5em;
margin-bottom: 0.5em;
}
.subs dd.empty {
display: none;
}
.subs dd p {
margin: 0;
}
/* Render short-style data instances */
.inst ul {
height: 100%;
padding: 0.5em;
margin: 0;
}
.inst, .inst li {
list-style: none;
margin-left: 1em;
}
/* Workaround for bug in Firefox (issue #384) */
.inst-left {
float: left;
}
.top p.src {
border-top: 1px solid #ccc;
}
.subs, .doc {
/* use this selector for one level of indent */
padding-left: 2em;
}
.warning {
color: red;
}
.arguments {
margin-top: -0.4em;
}
.arguments .caption {
display: none;
}
.fields { padding-left: 1em; }
.fields .caption { display: none; }
.fields p { margin: 0 0; }
/* this seems bulky to me
.methods, .constructors {
background: #f8f8f8;
border: 1px solid #eee;
}
*/
/* @end */
/* @group Auxillary Pages */
.extension-list {
list-style-type: none;
margin-left: 0;
}
#mini {
margin: 0 auto;
padding: 0 1em 1em;
}
#mini > * {
font-size: 93%; /* 12pt */
}
#mini #module-list .caption,
#mini #module-header .caption {
font-size: 125%; /* 15pt */
}
#mini #interface h1,
#mini #interface h2,
#mini #interface h3,
#mini #interface h4 {
font-size: 109%; /* 13pt */
margin: 1em 0 0;
}
#mini #interface .top,
#mini #interface .src {
margin: 0;
}
#mini #module-list ul {
list-style: none;
margin: 0;
}
#alphabet ul {
list-style: none;
padding: 0;
margin: 0.5em 0 0;
text-align: center;
}
#alphabet li {
display: inline;
margin: 0 0.25em;
}
#alphabet a {
font-weight: bold;
}
#index .caption,
#module-list .caption { font-size: 131%; /* 17pt */ }
#index table {
margin-left: 2em;
}
#index .src {
font-weight: bold;
}
#index .alt {
font-size: 77%; /* 10pt */
font-style: italic;
padding-left: 2em;
}
#index td + td {
padding-left: 1em;
}
#module-list ul {
list-style: none;
margin: 0 0 0 2em;
}
#module-list li {
clear: right;
}
#module-list span.collapser,
#module-list span.expander {
background-position: 0 0.3em;
}
#module-list .package {
float: right;
}
/* @end */

BIN
docs/haddock/plus.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

BIN
docs/haddock/synopsis.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,9 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.ControlFlow</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_TensorFlow-ControlFlow.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/TensorFlow-ControlFlow.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-0.1.0.0: TensorFlow bindings.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">TensorFlow.ControlFlow</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Dependencies</a></li><li><a href="#g:2">Operations</a></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:withControlDependencies">withControlDependencies</a> :: <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t =&gt; t -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> a -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> a</li><li class="src short"><a href="#v:group">group</a> :: <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t =&gt; t -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:identity">identity</a> :: <a href="TensorFlow-Types.html#t:TensorType">TensorType</a> a =&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</li><li class="src short"><a href="#v:noOp">noOp</a> :: <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:named">named</a> :: <a href="TensorFlow-Types.html#t:TensorType">TensorType</a> a =&gt; <a href="../text-1.2.2.1/Data-Text.html#t:Text">Text</a> -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a</li></ul></div><div id="interface"><h1 id="g:1">Dependencies</h1><div class="top"><p class="src"><a name="v:withControlDependencies" class="def">withControlDependencies</a> :: <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t =&gt; t -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> a -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> a <a href="src/TensorFlow-ControlFlow.html#withControlDependencies" class="link">Source</a></p><div class="doc"><p>Modify a <code><a href="TensorFlow-Build.html#t:Build">Build</a></code> action, such that all new ops rendered in it will depend
on the nodes in the first argument.</p></div></div><div class="top"><p class="src"><a name="v:group" class="def">group</a> :: <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t =&gt; t -&gt; <a href="TensorFlow-Build.html#t:Build">Build</a> <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a> <a href="src/TensorFlow-ControlFlow.html#group" class="link">Source</a></p><div class="doc"><p>Create an op that groups multiple operations.</p><p>When this op finishes, all ops in the input <code>n</code> have finished. This op has
no output.</p></div></div><h1 id="g:2">Operations</h1><div class="top"><p class="src"><a name="v:identity" class="def">identity</a> :: <a href="TensorFlow-Types.html#t:TensorType">TensorType</a> a =&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a <a href="src/TensorFlow-ControlFlow.html#identity" class="link">Source</a></p><div class="doc"><p>Returns a <code><a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> with the same shape and contents as the input.</p></div></div><div class="top"><p class="src"><a name="v:noOp" class="def">noOp</a> :: <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a> <a href="src/TensorFlow-ControlFlow.html#noOp" class="link">Source</a></p><div class="doc"><p>Does nothing. Only useful as a placeholder for control edges.</p></div></div><div class="top"><p class="src"><a name="v:named" class="def">named</a> :: <a href="TensorFlow-Types.html#t:TensorType">TensorType</a> a =&gt; <a href="../text-1.2.2.1/Data-Text.html#t:Text">Text</a> -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -&gt; <a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a <a href="src/TensorFlow-ControlFlow.html#named" class="link">Source</a></p><div class="doc"><p>Returns a <code><a href="TensorFlow-Tensor.html#t:Tensor">Tensor</a></code> with a given name and the same shape and contents as
the input.</p><p>TODO(judahjacobson): This breaks when used with uninitialize <code>Tensor Ref</code>s,
since <code>RefIdentity</code> doesn't have SetAllowsUninitializedInput(). Look into
whether we can change that op.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Internal.VarInt</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_TensorFlow-Internal-VarInt.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/TensorFlow-Internal-VarInt.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-0.1.0.0: TensorFlow bindings.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">TensorFlow.Internal.VarInt</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Originally taken from internal proto-lens code.</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:getVarInt">getVarInt</a> :: <a href="../attoparsec-0.13.0.2/Data-Attoparsec-ByteString.html#t:Parser">Parser</a> <a href="../base-4.8.2.0/Data-Word.html#t:Word64">Word64</a></li><li class="src short"><a href="#v:putVarInt">putVarInt</a> :: <a href="../base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -&gt; <a href="../bytestring-0.10.6.0/Data-ByteString-Builder.html#t:Builder">Builder</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:getVarInt" class="def">getVarInt</a> :: <a href="../attoparsec-0.13.0.2/Data-Attoparsec-ByteString.html#t:Parser">Parser</a> <a href="../base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> <a href="src/TensorFlow-Internal-VarInt.html#getVarInt" class="link">Source</a></p><div class="doc"><p>Decode an unsigned varint.</p></div></div><div class="top"><p class="src"><a name="v:putVarInt" class="def">putVarInt</a> :: <a href="../base-4.8.2.0/Data-Word.html#t:Word64">Word64</a> -&gt; <a href="../bytestring-0.10.6.0/Data-ByteString-Builder.html#t:Builder">Builder</a> <a href="src/TensorFlow-Internal-VarInt.html#putVarInt" class="link">Source</a></p><div class="doc"><p>Encode a Word64.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,30 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="haddock-util.js" type="text/javascript"></script>
<script type="text/javascript"><!--
/*
The synopsis frame needs to be updated using javascript, so we hide
it by default and only show it if javascript is enabled.
TODO: provide some means to disable it.
*/
function load() {
var d = document.getElementById("inner-fs");
d.rows = "50%,50%";
postReframe();
}
--></script>
</head>
<frameset id="outer-fs" cols="25%,75%" onload="load()">
<frameset id="inner-fs" rows="100%,0%">
<frame src="index-frames.html" name="modules" />
<frame src="" name="synopsis" />
</frameset>
<frame src="index.html" name="main" />
</frameset>
</html>

View file

@ -0,0 +1,344 @@
// Haddock JavaScript utilities
var rspace = /\s\s+/g,
rtrim = /^\s+|\s+$/g;
function spaced(s) { return (" " + s + " ").replace(rspace, " "); }
function trim(s) { return s.replace(rtrim, ""); }
function hasClass(elem, value) {
var className = spaced(elem.className || "");
return className.indexOf( " " + value + " " ) >= 0;
}
function addClass(elem, value) {
var className = spaced(elem.className || "");
if ( className.indexOf( " " + value + " " ) < 0 ) {
elem.className = trim(className + " " + value);
}
}
function removeClass(elem, value) {
var className = spaced(elem.className || "");
className = className.replace(" " + value + " ", " ");
elem.className = trim(className);
}
function toggleClass(elem, valueOn, valueOff, bool) {
if (bool == null) { bool = ! hasClass(elem, valueOn); }
if (bool) {
removeClass(elem, valueOff);
addClass(elem, valueOn);
}
else {
removeClass(elem, valueOn);
addClass(elem, valueOff);
}
return bool;
}
function makeClassToggle(valueOn, valueOff)
{
return function(elem, bool) {
return toggleClass(elem, valueOn, valueOff, bool);
}
}
toggleShow = makeClassToggle("show", "hide");
toggleCollapser = makeClassToggle("collapser", "expander");
function toggleSection(id)
{
var b = toggleShow(document.getElementById("section." + id));
toggleCollapser(document.getElementById("control." + id), b);
rememberCollapsed(id, b);
return b;
}
var collapsed = {};
function rememberCollapsed(id, b)
{
if(b)
delete collapsed[id]
else
collapsed[id] = null;
var sections = [];
for(var i in collapsed)
{
if(collapsed.hasOwnProperty(i))
sections.push(i);
}
// cookie specific to this page; don't use setCookie which sets path=/
document.cookie = "collapsed=" + escape(sections.join('+'));
}
function restoreCollapsed()
{
var cookie = getCookie("collapsed");
if(!cookie)
return;
var ids = cookie.split('+');
for(var i in ids)
{
if(document.getElementById("section." + ids[i]))
toggleSection(ids[i]);
}
}
function setCookie(name, value) {
document.cookie = name + "=" + escape(value) + ";path=/;";
}
function clearCookie(name) {
document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) {
return unescape(c.substring(nameEQ.length,c.length));
}
}
return null;
}
var max_results = 75; // 50 is not enough to search for map in the base libraries
var shown_range = null;
var last_search = null;
function quick_search()
{
perform_search(false);
}
function full_search()
{
perform_search(true);
}
function perform_search(full)
{
var text = document.getElementById("searchbox").value.toLowerCase();
if (text == last_search && !full) return;
last_search = text;
var table = document.getElementById("indexlist");
var status = document.getElementById("searchmsg");
var children = table.firstChild.childNodes;
// first figure out the first node with the prefix
var first = bisect(-1);
var last = (first == -1 ? -1 : bisect(1));
if (first == -1)
{
table.className = "";
status.innerHTML = "No results found, displaying all";
}
else if (first == 0 && last == children.length - 1)
{
table.className = "";
status.innerHTML = "";
}
else if (last - first >= max_results && !full)
{
table.className = "";
status.innerHTML = "More than " + max_results + ", press Search to display";
}
else
{
// decide what you need to clear/show
if (shown_range)
setclass(shown_range[0], shown_range[1], "indexrow");
setclass(first, last, "indexshow");
shown_range = [first, last];
table.className = "indexsearch";
status.innerHTML = "";
}
function setclass(first, last, status)
{
for (var i = first; i <= last; i++)
{
children[i].className = status;
}
}
// do a binary search, treating 0 as ...
// return either -1 (no 0's found) or location of most far match
function bisect(dir)
{
var first = 0, finish = children.length - 1;
var mid, success = false;
while (finish - first > 3)
{
mid = Math.floor((finish + first) / 2);
var i = checkitem(mid);
if (i == 0) i = dir;
if (i == -1)
finish = mid;
else
first = mid;
}
var a = (dir == 1 ? first : finish);
var b = (dir == 1 ? finish : first);
for (var i = b; i != a - dir; i -= dir)
{
if (checkitem(i) == 0) return i;
}
return -1;
}
// from an index, decide what the result is
// 0 = match, -1 is lower, 1 is higher
function checkitem(i)
{
var s = getitem(i).toLowerCase().substr(0, text.length);
if (s == text) return 0;
else return (s > text ? -1 : 1);
}
// from an index, get its string
// this abstracts over alternates
function getitem(i)
{
for ( ; i >= 0; i--)
{
var s = children[i].firstChild.firstChild.data;
if (s.indexOf(' ') == -1)
return s;
}
return ""; // should never be reached
}
}
function setSynopsis(filename) {
if (parent.window.synopsis) {
if (parent.window.synopsis.location.replace) {
// In Firefox this avoids adding the change to the history.
parent.window.synopsis.location.replace(filename);
} else {
parent.window.synopsis.location = filename;
}
}
}
function addMenuItem(html) {
var menu = document.getElementById("page-menu");
if (menu) {
var btn = menu.firstChild.cloneNode(false);
btn.innerHTML = html;
menu.appendChild(btn);
}
}
function adjustForFrames() {
var bodyCls;
if (parent.location.href == window.location.href) {
// not in frames, so add Frames button
addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>");
bodyCls = "no-frame";
}
else {
bodyCls = "in-frame";
}
addClass(document.body, bodyCls);
}
function reframe() {
setCookie("haddock-reframe", document.URL);
window.location = "frames.html";
}
function postReframe() {
var s = getCookie("haddock-reframe");
if (s) {
parent.window.main.location = s;
clearCookie("haddock-reframe");
}
}
function styles() {
var i, a, es = document.getElementsByTagName("link"), rs = [];
for (i = 0; a = es[i]; i++) {
if(a.rel.indexOf("style") != -1 && a.title) {
rs.push(a);
}
}
return rs;
}
function addStyleMenu() {
var as = styles();
var i, a, btns = "";
for(i=0; a = as[i]; i++) {
btns += "<li><a href='#' onclick=\"setActiveStyleSheet('"
+ a.title + "'); return false;\">"
+ a.title + "</a></li>"
}
if (as.length > 1) {
var h = "<div id='style-menu-holder'>"
+ "<a href='#' onclick='styleMenu(); return false;'>Style &#9662;</a>"
+ "<ul id='style-menu' class='hide'>" + btns + "</ul>"
+ "</div>";
addMenuItem(h);
}
}
function setActiveStyleSheet(title) {
var as = styles();
var i, a, found;
for(i=0; a = as[i]; i++) {
a.disabled = true;
// need to do this always, some browsers are edge triggered
if(a.title == title) {
found = a;
}
}
if (found) {
found.disabled = false;
setCookie("haddock-style", title);
}
else {
as[0].disabled = false;
clearCookie("haddock-style");
}
styleMenu(false);
}
function resetStyle() {
var s = getCookie("haddock-style");
if (s) setActiveStyleSheet(s);
}
function styleMenu(show) {
var m = document.getElementById('style-menu');
if (m) toggleShow(m, show);
}
function pageLoad() {
addStyleMenu();
adjustForFrames();
resetStyle();
restoreCollapsed();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-0.1.0.0: TensorFlow bindings.</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-list"><p class="caption">Modules</p><ul><li class="module"><a href="TensorFlow-Build.html" target="main">TensorFlow.Build</a></li><li class="module"><a href="TensorFlow-BuildOp.html" target="main">TensorFlow.BuildOp</a></li><li class="module"><a href="TensorFlow-ControlFlow.html" target="main">TensorFlow.ControlFlow</a></li><li class="module"><a href="TensorFlow-Internal-FFI.html" target="main">TensorFlow.Internal.FFI</a></li><li class="module"><a href="TensorFlow-Internal-VarInt.html" target="main">TensorFlow.Internal.VarInt</a></li><li class="module"><a href="TensorFlow-Nodes.html" target="main">TensorFlow.Nodes</a></li><li class="module"><a href="TensorFlow-Output.html" target="main">TensorFlow.Output</a></li><li class="module"><a href="TensorFlow-Session.html" target="main">TensorFlow.Session</a></li><li class="module"><a href="TensorFlow-Tensor.html" target="main">TensorFlow.Tensor</a></li><li class="module"><a href="TensorFlow-Types.html" target="main">TensorFlow.Types</a></li></ul></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-0.1.0.0: TensorFlow bindings.</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-0.1.0.0: TensorFlow bindings.</p></div><div id="content"><div id="description"><h1>tensorflow-0.1.0.0: TensorFlow bindings.</h1><div class="doc"><p>Please see README.md</p></div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span id="control.n.1" class="module collapser" onclick="toggleSection('n.1')">TensorFlow</span><ul id="section.n.1" class="show"><li><span class="module"><a href="TensorFlow-Build.html">TensorFlow.Build</a></span></li><li><span class="module"><a href="TensorFlow-BuildOp.html">TensorFlow.BuildOp</a></span></li><li><span class="module"><a href="TensorFlow-ControlFlow.html">TensorFlow.ControlFlow</a></span></li><li><span id="control.n.1.4" class="module collapser" onclick="toggleSection('n.1.4')">Internal</span><ul id="section.n.1.4" class="show"><li><span class="module"><a href="TensorFlow-Internal-FFI.html">TensorFlow.Internal.FFI</a></span></li><li><span class="module"><a href="TensorFlow-Internal-VarInt.html">TensorFlow.Internal.VarInt</a></span> Encoders and decoders for varint types.</li></ul></li><li><span class="module"><a href="TensorFlow-Nodes.html">TensorFlow.Nodes</a></span></li><li><span class="module"><a href="TensorFlow-Output.html">TensorFlow.Output</a></span></li><li><span class="module"><a href="TensorFlow-Session.html">TensorFlow.Session</a></span></li><li><span class="module"><a href="TensorFlow-Tensor.html">TensorFlow.Tensor</a></span></li><li><span class="module"><a href="TensorFlow-Types.html">TensorFlow.Types</a></span></li></ul></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Build</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Build</p></div><div id="interface"><h1>Graph node types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Build.html#t:ControlNode" target="main">ControlNode</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Build.html#t:Unique" target="main">Unique</a></p></div><h1>Ops</h1><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:explicitName" target="main">explicitName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:implicitName" target="main">implicitName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opDef" target="main">opDef</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opDefWithName" target="main">opDefWithName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opName" target="main">opName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opType" target="main">opType</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opAttr" target="main">opAttr</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opInputs" target="main">opInputs</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:opControlInputs" target="main">opControlInputs</a></p></div><h1>The Build monad</h1><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Build.html#t:GraphState" target="main">GraphState</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:render" target="main">render</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:renderNodeName" target="main">renderNodeName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:renderedNodeDefs" target="main">renderedNodeDefs</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Build.html#t:BuildT" target="main">BuildT</a> m a</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Build.html#t:Build" target="main">Build</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:addInitializer" target="main">addInitializer</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:hoistBuildT" target="main">hoistBuildT</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:evalBuildT" target="main">evalBuildT</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:runBuildT" target="main">runBuildT</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:asGraphDef" target="main">asGraphDef</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:addGraphDef" target="main">addGraphDef</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:flushInitializers" target="main">flushInitializers</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:flushNodeBuffer" target="main">flushNodeBuffer</a></p></div><h1>Creating and looking up Ops</h1><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:getOrAddOp" target="main">getOrAddOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:addNewOp" target="main">addNewOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:renderOutput" target="main">renderOutput</a></p></div><h1>Modifying all nodes in a Build action</h1><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:colocateWith" target="main">colocateWith</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:withStateLens" target="main">withStateLens</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:withDevice" target="main">withDevice</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:withNameScope" target="main">withNameScope</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:withNodeDependencies" target="main">withNodeDependencies</a></p></div><h1>Internal Summary related bits.</h1><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:addSummary" target="main">addSummary</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Build.html#t:SummaryTensor" target="main">SummaryTensor</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:collectAllSummaries" target="main">collectAllSummaries</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.BuildOp</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.BuildOp</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-BuildOp.html#t:OpResult" target="main">OpResult</a> a</p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-BuildOp.html#t:BuildOp" target="main">BuildOp</a> f</p></div><div class="top"><p class="src"><a href="TensorFlow-BuildOp.html#v:buildOp" target="main">buildOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-BuildOp.html#v:buildListOp" target="main">buildListOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-BuildOp.html#v:eqLengthGuard" target="main">eqLengthGuard</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.ControlFlow</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.ControlFlow</p></div><div id="interface"><h1>Dependencies</h1><div class="top"><p class="src"><a href="TensorFlow-ControlFlow.html#v:withControlDependencies" target="main">withControlDependencies</a></p></div><div class="top"><p class="src"><a href="TensorFlow-ControlFlow.html#v:group" target="main">group</a></p></div><h1>Operations</h1><div class="top"><p class="src"><a href="TensorFlow-ControlFlow.html#v:identity" target="main">identity</a></p></div><div class="top"><p class="src"><a href="TensorFlow-ControlFlow.html#v:noOp" target="main">noOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-ControlFlow.html#v:named" target="main">named</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Internal.FFI</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Internal.FFI</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Internal-FFI.html#t:TensorFlowException" target="main">TensorFlowException</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Internal-FFI.html#t:Session" target="main">Session</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:withSession" target="main">withSession</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:extendGraph" target="main">extendGraph</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:run" target="main">run</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Internal-FFI.html#t:TensorData" target="main">TensorData</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:setSessionConfig" target="main">setSessionConfig</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:setSessionTarget" target="main">setSessionTarget</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:getAllOpList" target="main">getAllOpList</a></p></div><h1>Internal helper.</h1><div class="top"><p class="src"><a href="TensorFlow-Internal-FFI.html#v:useProtoAsVoidPtrLen" target="main">useProtoAsVoidPtrLen</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Internal.VarInt</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Internal.VarInt</p></div><div id="interface"><div class="top"><p class="src"><a href="TensorFlow-Internal-VarInt.html#v:getVarInt" target="main">getVarInt</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Internal-VarInt.html#v:putVarInt" target="main">putVarInt</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Nodes</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Nodes</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Nodes.html#t:Nodes" target="main">Nodes</a> t</p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Nodes.html#t:Fetchable" target="main">Fetchable</a> t a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Nodes.html#t:Fetch" target="main">Fetch</a> a</p></div><div class="top"><p class="src"><a href="TensorFlow-Nodes.html#v:nodesUnion" target="main">nodesUnion</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Nodes.html#v:fetchTensorList" target="main">fetchTensorList</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Nodes.html#v:fetchTensorVector" target="main">fetchTensorVector</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Nodes.html#t:Scalar" target="main">Scalar</a> a</p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Output</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Output</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:ControlNode" target="main">ControlNode</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:Device" target="main">Device</a></p></div><h1>Ops</h1><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:NodeName" target="main">NodeName</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:Op" target="main">Op</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opUnrendered" target="main">opUnrendered</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:OpDef" target="main">OpDef</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opName" target="main">opName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opType" target="main">opType</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opAttr" target="main">opAttr</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opInputs" target="main">opInputs</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:opControlInputs" target="main">opControlInputs</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:OpType" target="main">OpType</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:OutputIx" target="main">OutputIx</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:Output" target="main">Output</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:output" target="main">output</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:outputIndex" target="main">outputIndex</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Output.html#v:outputOp" target="main">outputOp</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:PendingNodeName" target="main">PendingNodeName</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Session</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Session</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Session.html#t:Session" target="main">Session</a> a</p></div><h1>Opaque value created via <code><a href="TensorFlow-Session.html#v:sessionConfig">sessionConfig</a></code> and <code><a href="TensorFlow-Session.html#v:sessionTarget">sessionTarget</a></code>.</h1><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Session.html#t:SessionOption" target="main">SessionOption</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:sessionConfig" target="main">sessionConfig</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:sessionTarget" target="main">sessionTarget</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:runSession" target="main">runSession</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:runSessionWithOptions" target="main">runSessionWithOptions</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:build" target="main">build</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:buildAnd" target="main">buildAnd</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:buildWithSummary" target="main">buildWithSummary</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:extend" target="main">extend</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:addGraphDef" target="main">addGraphDef</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:run" target="main">run</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:runWithFeeds" target="main">runWithFeeds</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:run_" target="main">run_</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:runWithFeeds_" target="main">runWithFeeds_</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Session.html#v:asyncProdNodes" target="main">asyncProdNodes</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Tensor</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Tensor</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Tensor.html#t:Tensor" target="main">Tensor</a> v a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Tensor.html#t:Value" target="main">Value</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Tensor.html#t:Ref" target="main">Ref</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Tensor.html#t:TensorKind" target="main">TensorKind</a> v</p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorKind" target="main">tensorKind</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorOutput" target="main">tensorOutput</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorAttr" target="main">tensorAttr</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:value" target="main">value</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Tensor.html#t:Feed" target="main">Feed</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:feed" target="main">feed</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorFromName" target="main">tensorFromName</a></p></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>TensorFlow.Types</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body id="mini"><div id="module-header"><p class="caption">TensorFlow.Types</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Types.html#t:TensorType" target="main">TensorType</a> a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:TensorData" target="main">TensorData</a> a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:Shape" target="main">Shape</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Types.html#v:protoShape" target="main">protoShape</a></p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Types.html#t:Attribute" target="main">Attribute</a> a</p></div><h1>Type constraints</h1><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Types.html#t:OneOf" target="main">OneOf</a> ts a</p></div><div class="top"><p class="src"><span class="keyword">type family</span> a <a href="#t:-47--61-">/=</a> b :: <a href="../base-4.8.2.0/GHC-Exts.html#t:Constraint">Constraint</a></p></div><h2>Implementation of constraints</h2><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:TypeError" target="main">TypeError</a> a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:ExcludedCase" target="main">ExcludedCase</a></p></div><div class="top"><p class="src"><span class="keyword">type family</span> <a href="#t:TensorTypes">TensorTypes</a> ts :: <a href="../base-4.8.2.0/GHC-Exts.html#t:Constraint">Constraint</a></p></div><div class="top"><p class="src"><span class="keyword">type family</span> <a href="#t:NoneOf">NoneOf</a> ts a :: <a href="../base-4.8.2.0/GHC-Exts.html#t:Constraint">Constraint</a></p></div><div class="top"><p class="src"><span class="keyword">type family</span> as <a href="#t:-92--92-">\\</a> bs</p></div><div class="top"><p class="src"><span class="keyword">type family</span> <a href="#t:Delete">Delete</a> a as</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Types.html#t:AllTensorTypes" target="main">AllTensorTypes</a></p></div></div></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 B

View file

@ -0,0 +1,600 @@
/* @group Fundamentals */
* { margin: 0; padding: 0 }
/* Is this portable? */
html {
background-color: white;
width: 100%;
height: 100%;
}
body {
background: white;
color: black;
text-align: left;
min-height: 100%;
position: relative;
}
p {
margin: 0.8em 0;
}
ul, ol {
margin: 0.8em 0 0.8em 2em;
}
dl {
margin: 0.8em 0;
}
dt {
font-weight: bold;
}
dd {
margin-left: 2em;
}
a { text-decoration: none; }
a[href]:link { color: rgb(196,69,29); }
a[href]:visited { color: rgb(171,105,84); }
a[href]:hover { text-decoration:underline; }
/* @end */
/* @group Fonts & Sizes */
/* Basic technique & IE workarounds from YUI 3
For reasons, see:
http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css
*/
body {
font:13px/1.4 sans-serif;
*font-size:small; /* for IE */
*font:x-small; /* for IE in quirks mode */
}
h1 { font-size: 146.5%; /* 19pt */ }
h2 { font-size: 131%; /* 17pt */ }
h3 { font-size: 116%; /* 15pt */ }
h4 { font-size: 100%; /* 13pt */ }
h5 { font-size: 100%; /* 13pt */ }
select, input, button, textarea {
font:99% sans-serif;
}
table {
font-size:inherit;
font:100%;
}
pre, code, kbd, samp, tt, .src {
font-family:monospace;
*font-size:108%;
line-height: 124%;
}
.links, .link {
font-size: 85%; /* 11pt */
}
#module-header .caption {
font-size: 182%; /* 24pt */
}
.info {
font-size: 85%; /* 11pt */
}
#table-of-contents, #synopsis {
/* font-size: 85%; /* 11pt */
}
/* @end */
/* @group Common */
.caption, h1, h2, h3, h4, h5, h6 {
font-weight: bold;
color: rgb(78,98,114);
margin: 0.8em 0 0.4em;
}
* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
margin-top: 2em;
}
h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
margin-top: inherit;
}
ul.links {
list-style: none;
text-align: left;
float: right;
display: inline-table;
margin: 0 0 0 1em;
}
ul.links li {
display: inline;
border-left: 1px solid #d5d5d5;
white-space: nowrap;
padding: 0;
}
ul.links li a {
padding: 0.2em 0.5em;
}
.hide { display: none; }
.show { display: inherit; }
.clear { clear: both; }
.collapser {
background-image: url(minus.gif);
background-repeat: no-repeat;
}
.expander {
background-image: url(plus.gif);
background-repeat: no-repeat;
}
p.caption.collapser,
p.caption.expander {
background-position: 0 0.4em;
}
.collapser, .expander {
padding-left: 14px;
margin-left: -14px;
cursor: pointer;
}
pre {
padding: 0.25em;
margin: 0.8em 0;
background: rgb(229,237,244);
overflow: auto;
border-bottom: 0.25em solid white;
/* white border adds some space below the box to compensate
for visual extra space that paragraphs have between baseline
and the bounding box */
}
.src {
background: #f0f0f0;
padding: 0.2em 0.5em;
}
.keyword { font-weight: normal; }
.def { font-weight: bold; }
/* @end */
/* @group Page Structure */
#content {
margin: 0 auto;
padding: 0 2em 6em;
}
#package-header {
background: rgb(41,56,69);
border-top: 5px solid rgb(78,98,114);
color: #ddd;
padding: 0.2em;
position: relative;
text-align: left;
}
#package-header .caption {
background: url(hslogo-16.png) no-repeat 0em;
color: white;
margin: 0 2em;
font-weight: normal;
font-style: normal;
padding-left: 2em;
}
#package-header a:link, #package-header a:visited { color: white; }
#package-header a:hover { background: rgb(78,98,114); }
#module-header .caption {
color: rgb(78,98,114);
font-weight: bold;
border-bottom: 1px solid #ddd;
}
table.info {
float: right;
padding: 0.5em 1em;
border: 1px solid #ddd;
color: rgb(78,98,114);
background-color: #fff;
max-width: 40%;
border-spacing: 0;
position: relative;
top: -0.5em;
margin: 0 0 0 2em;
}
.info th {
padding: 0 1em 0 0;
}
div#style-menu-holder {
position: relative;
z-index: 2;
display: inline;
}
#style-menu {
position: absolute;
z-index: 1;
overflow: visible;
background: #374c5e;
margin: 0;
text-align: center;
right: 0;
padding: 0;
top: 1.25em;
}
#style-menu li {
display: list-item;
border-style: none;
margin: 0;
padding: 0;
color: #000;
list-style-type: none;
}
#style-menu li + li {
border-top: 1px solid #919191;
}
#style-menu a {
width: 6em;
padding: 3px;
display: block;
}
#footer {
background: #ddd;
border-top: 1px solid #aaa;
padding: 0.5em 0;
color: #666;
text-align: center;
position: absolute;
bottom: 0;
width: 100%;
height: 3em;
}
/* @end */
/* @group Front Matter */
#table-of-contents {
float: right;
clear: right;
background: #faf9dc;
border: 1px solid #d8d7ad;
padding: 0.5em 1em;
max-width: 20em;
margin: 0.5em 0 1em 1em;
}
#table-of-contents .caption {
text-align: center;
margin: 0;
}
#table-of-contents ul {
list-style: none;
margin: 0;
}
#table-of-contents ul ul {
margin-left: 2em;
}
#description .caption {
display: none;
}
#synopsis {
display: none;
}
.no-frame #synopsis {
display: block;
position: fixed;
right: 0;
height: 80%;
top: 10%;
padding: 0;
max-width: 75%;
}
#synopsis .caption {
float: left;
width: 29px;
color: rgba(255,255,255,0);
height: 110px;
margin: 0;
font-size: 1px;
padding: 0;
}
#synopsis p.caption.collapser {
background: url(synopsis.png) no-repeat -64px -8px;
}
#synopsis p.caption.expander {
background: url(synopsis.png) no-repeat 0px -8px;
}
#synopsis ul {
height: 100%;
overflow: auto;
padding: 0.5em;
margin: 0;
}
#synopsis ul ul {
overflow: hidden;
}
#synopsis ul,
#synopsis ul li.src {
background-color: #faf9dc;
white-space: nowrap;
list-style: none;
margin-left: 0;
}
/* @end */
/* @group Main Content */
#interface div.top { margin: 2em 0; }
#interface h1 + div.top,
#interface h2 + div.top,
#interface h3 + div.top,
#interface h4 + div.top,
#interface h5 + div.top {
margin-top: 1em;
}
#interface p.src .link {
float: right;
color: #919191;
border-left: 1px solid #919191;
background: #f0f0f0;
padding: 0 0.5em 0.2em;
margin: 0 -0.5em 0 0.5em;
}
#interface td.src .link {
float: right;
color: #919191;
border-left: 1px solid #919191;
background: #f0f0f0;
padding: 0 0.5em 0.2em;
margin: 0 -0.5em 0 0.5em;
}
#interface span.fixity {
color: #919191;
border-left: 1px solid #919191;
padding: 0.2em 0.5em 0.2em 0.5em;
margin: 0 -1em 0 1em;
}
#interface span.rightedge {
border-left: 1px solid #919191;
padding: 0.2em 0 0.2em 0;
margin: 0 0 0 1em;
}
#interface table { border-spacing: 2px; }
#interface td {
vertical-align: top;
padding-left: 0.5em;
}
#interface td.src {
white-space: nowrap;
}
#interface td.doc p {
margin: 0;
}
#interface td.doc p + p {
margin-top: 0.8em;
}
.clearfix:after {
clear: both;
content: " ";
display: block;
height: 0;
visibility: hidden;
}
.subs dl {
margin: 0;
}
.subs dt {
float: left;
clear: left;
display: block;
margin: 1px 0;
}
.subs dd {
float: right;
width: 90%;
display: block;
padding-left: 0.5em;
margin-bottom: 0.5em;
}
.subs dd.empty {
display: none;
}
.subs dd p {
margin: 0;
}
/* Render short-style data instances */
.inst ul {
height: 100%;
padding: 0.5em;
margin: 0;
}
.inst, .inst li {
list-style: none;
margin-left: 1em;
}
/* Workaround for bug in Firefox (issue #384) */
.inst-left {
float: left;
}
.top p.src {
border-top: 1px solid #ccc;
}
.subs, .doc {
/* use this selector for one level of indent */
padding-left: 2em;
}
.warning {
color: red;
}
.arguments {
margin-top: -0.4em;
}
.arguments .caption {
display: none;
}
.fields { padding-left: 1em; }
.fields .caption { display: none; }
.fields p { margin: 0 0; }
/* this seems bulky to me
.methods, .constructors {
background: #f8f8f8;
border: 1px solid #eee;
}
*/
/* @end */
/* @group Auxillary Pages */
.extension-list {
list-style-type: none;
margin-left: 0;
}
#mini {
margin: 0 auto;
padding: 0 1em 1em;
}
#mini > * {
font-size: 93%; /* 12pt */
}
#mini #module-list .caption,
#mini #module-header .caption {
font-size: 125%; /* 15pt */
}
#mini #interface h1,
#mini #interface h2,
#mini #interface h3,
#mini #interface h4 {
font-size: 109%; /* 13pt */
margin: 1em 0 0;
}
#mini #interface .top,
#mini #interface .src {
margin: 0;
}
#mini #module-list ul {
list-style: none;
margin: 0;
}
#alphabet ul {
list-style: none;
padding: 0;
margin: 0.5em 0 0;
text-align: center;
}
#alphabet li {
display: inline;
margin: 0 0.25em;
}
#alphabet a {
font-weight: bold;
}
#index .caption,
#module-list .caption { font-size: 131%; /* 17pt */ }
#index table {
margin-left: 2em;
}
#index .src {
font-weight: bold;
}
#index .alt {
font-size: 77%; /* 10pt */
font-style: italic;
padding-left: 2em;
}
#index td + td {
padding-left: 1em;
}
#module-list ul {
list-style: none;
margin: 0 0 0 2em;
}
#module-list li {
clear: right;
}
#module-list span.collapser,
#module-list span.expander {
background-position: 0 0.3em;
}
#module-list .package {
float: right;
}
/* @end */

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 B

View file

@ -0,0 +1,387 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Build.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE LambdaCase #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-19"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Build</span>
<a name="line-20"></a> <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Graph node types</span>
<a name="line-21"></a> <span class='hs-conid'>ControlNode</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-22"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Unique</span>
<a name="line-23"></a> <span class='hs-comment'>-- * Ops</span>
<a name="line-24"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>explicitName</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>implicitName</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opDef</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opDefWithName</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opName</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opType</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opAttr</span>
<a name="line-31"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opInputs</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opControlInputs</span>
<a name="line-33"></a> <span class='hs-comment'>-- * The Build monad</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>GraphState</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>render</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>renderNodeName</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>renderedNodeDefs</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>BuildT</span>
<a name="line-39"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Build</span>
<a name="line-40"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>addInitializer</span>
<a name="line-41"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>hoistBuildT</span>
<a name="line-42"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>evalBuildT</span>
<a name="line-43"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>runBuildT</span>
<a name="line-44"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>asGraphDef</span>
<a name="line-45"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>addGraphDef</span>
<a name="line-46"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>flushInitializers</span>
<a name="line-47"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>flushNodeBuffer</span>
<a name="line-48"></a> <span class='hs-comment'>-- * Creating and looking up Ops</span>
<a name="line-49"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>getOrAddOp</span>
<a name="line-50"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>addNewOp</span>
<a name="line-51"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>renderOutput</span>
<a name="line-52"></a> <span class='hs-comment'>-- * Modifying all nodes in a Build action</span>
<a name="line-53"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>colocateWith</span>
<a name="line-54"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withStateLens</span>
<a name="line-55"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withDevice</span>
<a name="line-56"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withNameScope</span>
<a name="line-57"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withNodeDependencies</span>
<a name="line-58"></a> <span class='hs-comment'>-- * Internal Summary related bits.</span>
<a name="line-59"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>addSummary</span>
<a name="line-60"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>SummaryTensor</span>
<a name="line-61"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>collectAllSummaries</span>
<a name="line-62"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-63"></a>
<a name="line-64"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-conid'>Class</span> <span class='hs-layout'>(</span><span class='hs-conid'>MonadIO</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-65"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Trans</span><span class='hs-varop'>.</span><span class='hs-conid'>Class</span> <span class='hs-layout'>(</span><span class='hs-conid'>MonadTrans</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-66"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Trans</span><span class='hs-varop'>.</span><span class='hs-conid'>State</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span><span class='hs-layout'>(</span><span class='hs-conid'>StateT</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>mapStateT</span><span class='hs-layout'>,</span> <span class='hs-varid'>evalStateT</span><span class='hs-layout'>)</span>
<a name="line-67"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-layout'>(</span><span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
<a name="line-68"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Default</span> <span class='hs-layout'>(</span><span class='hs-varid'>def</span><span class='hs-layout'>)</span>
<a name="line-69"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Functor</span><span class='hs-varop'>.</span><span class='hs-conid'>Identity</span> <span class='hs-layout'>(</span><span class='hs-conid'>Identity</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-70"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Map</span>
<a name="line-71"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-72"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Set</span>
<a name="line-73"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span><span class='hs-layout'>)</span>
<a name="line-74"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span> <span class='hs-layout'>(</span><span class='hs-conid'>IsString</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-75"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-layout'>(</span><span class='hs-conid'>Text</span><span class='hs-layout'>)</span>
<a name="line-76"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Text</span>
<a name="line-77"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-conid'>Lens'</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.~</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-78"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span><span class='hs-varop'>.</span><span class='hs-conid'>State</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-layout'>(</span><span class='hs-conid'>MonadState</span><span class='hs-layout'>,</span> <span class='hs-varid'>use</span><span class='hs-layout'>,</span> <span class='hs-varid'>uses</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.=</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;=</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>%=</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-79"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span><span class='hs-varop'>.</span><span class='hs-conid'>Unchecked</span> <span class='hs-layout'>(</span><span class='hs-varid'>lens</span><span class='hs-layout'>)</span>
<a name="line-80"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Graph</span>
<a name="line-81"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>GraphDef</span>
<a name="line-82"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>node</span>
<a name="line-83"></a> <span class='hs-layout'>)</span>
<a name="line-84"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>NodeDef</span>
<a name="line-85"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>NodeDef</span>
<a name="line-86"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>attr</span>
<a name="line-87"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>input</span>
<a name="line-88"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>device</span>
<a name="line-89"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>name</span>
<a name="line-90"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>op</span>
<a name="line-91"></a> <span class='hs-layout'>)</span>
<a name="line-92"></a>
<a name="line-93"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Orphans</span> <span class='hs-conid'>()</span>
<a name="line-94"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span>
<a name="line-95"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-96"></a>
<a name="line-97"></a><a name="Unique"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Unique</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Unique</span> <span class='hs-conid'>Int</span>
<a name="line-98"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Enum</span><span class='hs-layout'>)</span>
<a name="line-99"></a>
<a name="line-100"></a><span class='hs-comment'>--------------</span>
<a name="line-101"></a>
<a name="line-102"></a><a name="implicitName"></a><span class='hs-definition'>implicitName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>PendingNodeName</span>
<a name="line-103"></a><span class='hs-definition'>implicitName</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ImplicitName</span>
<a name="line-104"></a>
<a name="line-105"></a><a name="explicitName"></a><span class='hs-definition'>explicitName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>PendingNodeName</span>
<a name="line-106"></a><span class='hs-definition'>explicitName</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ExplicitName</span>
<a name="line-107"></a>
<a name="line-108"></a><a name="Scope"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Scope</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Scope</span> <span class='hs-layout'>{</span><span class='hs-varid'>unScope</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span><span class='hs-layout'>}</span>
<a name="line-109"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>IsString</span><span class='hs-layout'>)</span>
<a name="line-110"></a>
<a name="line-111"></a><a name="instance%20Show%20Scope"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Show</span> <span class='hs-conid'>Scope</span> <span class='hs-keyword'>where</span>
<a name="line-112"></a> <span class='hs-varid'>show</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>show</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unScope</span>
<a name="line-113"></a>
<a name="line-114"></a><a name="opDef"></a><span class='hs-definition'>opDef</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpType</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span>
<a name="line-115"></a><span class='hs-definition'>opDef</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>opDefWithName</span> <span class='hs-conid'>ImplicitName</span>
<a name="line-116"></a>
<a name="line-117"></a><a name="opDefWithName"></a><span class='hs-definition'>opDefWithName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>PendingNodeName</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpType</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span>
<a name="line-118"></a><span class='hs-definition'>opDefWithName</span> <span class='hs-varid'>n</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>OpDef</span>
<a name="line-119"></a> <span class='hs-layout'>{</span> <span class='hs-sel'>_opName</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>n</span>
<a name="line-120"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opType</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>t</span>
<a name="line-121"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opAttrs</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span>
<a name="line-122"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>[]</span>
<a name="line-123"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opControlInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>[]</span>
<a name="line-124"></a> <span class='hs-layout'>}</span>
<a name="line-125"></a>
<a name="line-126"></a><a name="SummaryTensor"></a><span class='hs-comment'>-- | Synonym for the tensors that return serialized Summary proto.</span>
<a name="line-127"></a><a name="SummaryTensor"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>SummaryTensor</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Tensor</span> <span class='hs-conid'>Value</span> <span class='hs-conid'>ByteString</span>
<a name="line-128"></a>
<a name="line-129"></a><a name="GraphState"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>GraphState</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>GraphState</span>
<a name="line-130"></a> <span class='hs-layout'>{</span> <span class='hs-sel'>_renderedNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span> <span class='hs-conid'>PendingNode</span> <span class='hs-conid'>NodeDef</span><span class='hs-layout'>)</span>
<a name="line-131"></a> <span class='hs-comment'>-- ^ Nodes which have been rendered. Keeps track of the unique ID we</span>
<a name="line-132"></a> <span class='hs-comment'>-- assign each implicitly-named node. Also prevents us from adding the</span>
<a name="line-133"></a> <span class='hs-comment'>-- same node (implicit or explicit) more than once to the nodeBuffer.</span>
<a name="line-134"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_renderedNodeDefs</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span> <span class='hs-conid'>NodeName</span> <span class='hs-conid'>NodeDef</span><span class='hs-layout'>)</span>
<a name="line-135"></a> <span class='hs-comment'>-- ^ The NodeDefs of nodes which have been rendered. Used by the</span>
<a name="line-136"></a> <span class='hs-comment'>-- Gradient module to inspect the node graph.</span>
<a name="line-137"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_nodeBuffer</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeDef</span><span class='hs-keyglyph'>]</span>
<a name="line-138"></a> <span class='hs-comment'>-- ^ A list of nodes that should be passed to TensorFlow during</span>
<a name="line-139"></a> <span class='hs-comment'>-- the next call to Session.extend (TF_ExtendGraph).</span>
<a name="line-140"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_nextUnique</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-conid'>Unique</span>
<a name="line-141"></a> <span class='hs-comment'>-- ^ Unique ID for the next node</span>
<a name="line-142"></a> <span class='hs-comment'>-- TODO(judahjacobson): watch for clashes between auto and user names.</span>
<a name="line-143"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_defaultDevice</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>Maybe</span> <span class='hs-conid'>Device</span><span class='hs-layout'>)</span>
<a name="line-144"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_currentScope</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Scope</span><span class='hs-keyglyph'>]</span>
<a name="line-145"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_defaultControlInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>Set</span> <span class='hs-conid'>NodeName</span><span class='hs-layout'>)</span>
<a name="line-146"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_initializationNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span>
<a name="line-147"></a> <span class='hs-comment'>-- ^ The nodes to run next time a TF.run is issued, typically</span>
<a name="line-148"></a> <span class='hs-comment'>-- variable initializers.</span>
<a name="line-149"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_summaries</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>SummaryTensor</span><span class='hs-keyglyph'>]</span>
<a name="line-150"></a> <span class='hs-comment'>-- ^ The tensors for summary</span>
<a name="line-151"></a> <span class='hs-layout'>}</span>
<a name="line-152"></a>
<a name="line-153"></a><a name="PendingNode"></a><span class='hs-comment'>-- | A node definition without its final name. Used as a key in the</span>
<a name="line-154"></a><a name="PendingNode"></a><span class='hs-comment'>-- "renderedNodes" map.</span>
<a name="line-155"></a><a name="PendingNode"></a><span class='hs-comment'>-- The NodeDef contained inside has an empty "name" field.</span>
<a name="line-156"></a><a name="PendingNode"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>PendingNode</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>PendingNode</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Scope</span><span class='hs-keyglyph'>]</span> <span class='hs-varop'>!</span><span class='hs-conid'>PendingNodeName</span> <span class='hs-varop'>!</span><span class='hs-conid'>NodeDef</span>
<a name="line-157"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>)</span>
<a name="line-158"></a>
<a name="line-159"></a><a name="pendingNodeDef"></a><span class='hs-comment'>-- Returns an _incomplete_ NodeDef. The name is fixed by addNewOpFromPending.</span>
<a name="line-160"></a><span class='hs-definition'>pendingNodeDef</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>PendingNode</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>NodeDef</span>
<a name="line-161"></a><span class='hs-definition'>pendingNodeDef</span> <span class='hs-layout'>(</span><span class='hs-conid'>PendingNode</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>n</span>
<a name="line-162"></a>
<a name="line-163"></a><a name="initGraphState"></a><span class='hs-definition'>initGraphState</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>GraphState</span>
<a name="line-164"></a><span class='hs-definition'>initGraphState</span> <span class='hs-keyglyph'>=</span>
<a name="line-165"></a> <span class='hs-conid'>GraphState</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span> <span class='hs-conid'>[]</span> <span class='hs-layout'>(</span><span class='hs-conid'>Unique</span> <span class='hs-num'>0</span><span class='hs-layout'>)</span> <span class='hs-conid'>Nothing</span> <span class='hs-conid'>[]</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span> <span class='hs-conid'>[]</span> <span class='hs-conid'>[]</span>
<a name="line-166"></a>
<a name="line-167"></a><a name="renderedNodes"></a><span class='hs-definition'>renderedNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span> <span class='hs-conid'>PendingNode</span> <span class='hs-conid'>NodeDef</span><span class='hs-layout'>)</span>
<a name="line-168"></a><span class='hs-definition'>renderedNodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_renderedNodes</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_renderedNodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-169"></a>
<a name="line-170"></a><a name="renderedNodeDefs"></a><span class='hs-definition'>renderedNodeDefs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span> <span class='hs-conid'>NodeName</span> <span class='hs-conid'>NodeDef</span><span class='hs-layout'>)</span>
<a name="line-171"></a><span class='hs-definition'>renderedNodeDefs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_renderedNodeDefs</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_renderedNodeDefs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-172"></a>
<a name="line-173"></a><a name="nodeBuffer"></a><span class='hs-definition'>nodeBuffer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeDef</span><span class='hs-keyglyph'>]</span>
<a name="line-174"></a><span class='hs-definition'>nodeBuffer</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_nodeBuffer</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_nodeBuffer</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-175"></a>
<a name="line-176"></a><a name="nextUnique"></a><span class='hs-definition'>nextUnique</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-conid'>Unique</span>
<a name="line-177"></a><span class='hs-definition'>nextUnique</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_nextUnique</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_nextUnique</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-178"></a>
<a name="line-179"></a><a name="defaultDevice"></a><span class='hs-definition'>defaultDevice</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-layout'>(</span><span class='hs-conid'>Maybe</span> <span class='hs-conid'>Device</span><span class='hs-layout'>)</span>
<a name="line-180"></a><span class='hs-definition'>defaultDevice</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_defaultDevice</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_defaultDevice</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-181"></a>
<a name="line-182"></a><a name="currentScope"></a><span class='hs-definition'>currentScope</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Scope</span><span class='hs-keyglyph'>]</span>
<a name="line-183"></a><span class='hs-definition'>currentScope</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_currentScope</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_currentScope</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-184"></a>
<a name="line-185"></a><a name="defaultControlInputs"></a><span class='hs-definition'>defaultControlInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span> <span class='hs-conid'>NodeName</span><span class='hs-layout'>)</span>
<a name="line-186"></a><span class='hs-definition'>defaultControlInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_defaultControlInputs</span>
<a name="line-187"></a> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_defaultControlInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-188"></a>
<a name="line-189"></a><a name="initializationNodes"></a><span class='hs-definition'>initializationNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span>
<a name="line-190"></a><span class='hs-definition'>initializationNodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_initializationNodes</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_initializationNodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-191"></a>
<a name="line-192"></a><a name="summaries"></a><span class='hs-definition'>summaries</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>GraphState</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>SummaryTensor</span><span class='hs-keyglyph'>]</span>
<a name="line-193"></a><span class='hs-definition'>summaries</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_summaries</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>g</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>g</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_summaries</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span> <span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-194"></a>
<a name="line-195"></a><a name="BuildT"></a><span class='hs-comment'>-- | An action for building nodes in a TensorFlow graph.</span>
<a name="line-196"></a><a name="BuildT"></a><span class='hs-comment'>-- Used to manage build state internally as part of the @Session@ monad.</span>
<a name="line-197"></a><a name="BuildT"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>BuildT</span> <span class='hs-layout'>(</span><span class='hs-conid'>StateT</span> <span class='hs-conid'>GraphState</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-198"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Functor</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span><span class='hs-layout'>,</span> <span class='hs-conid'>Monad</span><span class='hs-layout'>,</span> <span class='hs-conid'>MonadIO</span><span class='hs-layout'>,</span> <span class='hs-conid'>MonadTrans</span><span class='hs-layout'>,</span>
<a name="line-199"></a> <span class='hs-conid'>MonadState</span> <span class='hs-conid'>GraphState</span><span class='hs-layout'>)</span>
<a name="line-200"></a>
<a name="line-201"></a><a name="Build"></a><span class='hs-comment'>-- | An action for building nodes in a TensorFlow graph.</span>
<a name="line-202"></a><a name="Build"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>Build</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>BuildT</span> <span class='hs-conid'>Identity</span>
<a name="line-203"></a>
<a name="line-204"></a><a name="hoistBuildT"></a><span class='hs-comment'>-- | This is Control.Monad.Morph.hoist sans the dependency.</span>
<a name="line-205"></a><span class='hs-definition'>hoistBuildT</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varop'>.</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>n</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>n</span> <span class='hs-varid'>b</span>
<a name="line-206"></a><span class='hs-definition'>hoistBuildT</span> <span class='hs-varid'>f</span> <span class='hs-layout'>(</span><span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>BuildT</span> <span class='hs-varop'>$</span> <span class='hs-varid'>mapStateT</span> <span class='hs-varid'>f</span> <span class='hs-varid'>m</span>
<a name="line-207"></a>
<a name="line-208"></a><a name="runBuildT"></a><span class='hs-definition'>runBuildT</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>GraphState</span><span class='hs-layout'>)</span>
<a name="line-209"></a><span class='hs-definition'>runBuildT</span> <span class='hs-layout'>(</span><span class='hs-conid'>BuildT</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runStateT</span> <span class='hs-varid'>f</span> <span class='hs-varid'>initGraphState</span>
<a name="line-210"></a>
<a name="line-211"></a><a name="evalBuildT"></a><span class='hs-definition'>evalBuildT</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span>
<a name="line-212"></a><span class='hs-definition'>evalBuildT</span> <span class='hs-layout'>(</span><span class='hs-conid'>BuildT</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>evalStateT</span> <span class='hs-varid'>f</span> <span class='hs-varid'>initGraphState</span>
<a name="line-213"></a>
<a name="line-214"></a><a name="flushNodeBuffer"></a><span class='hs-comment'>-- | Get all the NodeDefs that have accumulated so far, and clear that buffer.</span>
<a name="line-215"></a><span class='hs-definition'>flushNodeBuffer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeDef</span><span class='hs-keyglyph'>]</span>
<a name="line-216"></a><span class='hs-definition'>flushNodeBuffer</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-217"></a> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>nodeBuffer</span>
<a name="line-218"></a> <span class='hs-varid'>nodeBuffer</span> <span class='hs-varop'>.=</span> <span class='hs-conid'>[]</span>
<a name="line-219"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>ns</span>
<a name="line-220"></a>
<a name="line-221"></a><a name="flushInitializers"></a><span class='hs-comment'>-- | Get all the initializers that have accumulated so far, and clear</span>
<a name="line-222"></a><span class='hs-comment'>-- that buffer.</span>
<a name="line-223"></a><span class='hs-definition'>flushInitializers</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span>
<a name="line-224"></a><span class='hs-definition'>flushInitializers</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-225"></a> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>initializationNodes</span>
<a name="line-226"></a> <span class='hs-varid'>initializationNodes</span> <span class='hs-varop'>.=</span> <span class='hs-conid'>[]</span>
<a name="line-227"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>ns</span>
<a name="line-228"></a>
<a name="line-229"></a><a name="addInitializer"></a><span class='hs-comment'>-- | Registers the given node to be executed before the next</span>
<a name="line-230"></a><span class='hs-comment'>-- 'TensorFlow.Session.run'.</span>
<a name="line-231"></a><span class='hs-definition'>addInitializer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ControlNode</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>()</span>
<a name="line-232"></a><span class='hs-definition'>addInitializer</span> <span class='hs-layout'>(</span><span class='hs-conid'>ControlNode</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-233"></a> <span class='hs-varid'>i</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-varid'>o</span>
<a name="line-234"></a> <span class='hs-varid'>initializationNodes</span> <span class='hs-varop'>%=</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-conop'>:</span><span class='hs-layout'>)</span>
<a name="line-235"></a>
<a name="line-236"></a><a name="asGraphDef"></a><span class='hs-comment'>-- | Produce a GraphDef proto representation of the nodes that are rendered in</span>
<a name="line-237"></a><span class='hs-comment'>-- the given 'Build' action.</span>
<a name="line-238"></a><span class='hs-definition'>asGraphDef</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>GraphDef</span>
<a name="line-239"></a><span class='hs-definition'>asGraphDef</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>node</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>gs</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>nodeBuffer</span>
<a name="line-240"></a> <span class='hs-keyword'>where</span>
<a name="line-241"></a> <span class='hs-varid'>gs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>snd</span> <span class='hs-varop'>$</span> <span class='hs-varid'>runIdentity</span> <span class='hs-varop'>$</span> <span class='hs-varid'>runBuildT</span> <span class='hs-varid'>b</span>
<a name="line-242"></a>
<a name="line-243"></a><a name="addGraphDef"></a><span class='hs-comment'>-- TODO: check against existing nodes for conflicts?</span>
<a name="line-244"></a><span class='hs-definition'>addGraphDef</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>GraphDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>()</span>
<a name="line-245"></a><span class='hs-definition'>addGraphDef</span> <span class='hs-varid'>g</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>nodeBuffer</span> <span class='hs-varop'>&lt;&gt;=</span> <span class='hs-varid'>g</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>node</span>
<a name="line-246"></a>
<a name="line-247"></a><a name="getOrAddOp"></a><span class='hs-comment'>-- | Render the given op if it hasn't been rendered already, and return its</span>
<a name="line-248"></a><span class='hs-comment'>-- name.</span>
<a name="line-249"></a><span class='hs-definition'>getOrAddOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Op</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeName</span>
<a name="line-250"></a><span class='hs-definition'>getOrAddOp</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>NodeName</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span> <span class='hs-varid'>name</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>resolveOp</span> <span class='hs-varid'>o</span>
<a name="line-251"></a>
<a name="line-252"></a><a name="resolveOp"></a><span class='hs-definition'>resolveOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Op</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeDef</span>
<a name="line-253"></a><span class='hs-definition'>resolveOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Rendered</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-varid'>n</span>
<a name="line-254"></a><span class='hs-definition'>resolveOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Unrendered</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-255"></a> <span class='hs-varid'>pending</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getPendingNode</span> <span class='hs-varid'>o</span>
<a name="line-256"></a> <span class='hs-varid'>uses</span> <span class='hs-varid'>renderedNodes</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>lookup</span> <span class='hs-varid'>pending</span><span class='hs-layout'>)</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>case</span>
<a name="line-257"></a> <span class='hs-conid'>Just</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>return</span> <span class='hs-varid'>n</span>
<a name="line-258"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>addNewOpFromPending</span> <span class='hs-varid'>pending</span>
<a name="line-259"></a>
<a name="line-260"></a><a name="addNewOp"></a><span class='hs-comment'>-- | Add a new node for a given 'OpDef'. This is used for making "stateful" ops</span>
<a name="line-261"></a><span class='hs-comment'>-- which are not safe to dedup (e.g, "variable" and "assign").</span>
<a name="line-262"></a><span class='hs-definition'>addNewOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeDef</span>
<a name="line-263"></a><span class='hs-definition'>addNewOp</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getPendingNode</span> <span class='hs-varid'>o</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>addNewOpFromPending</span>
<a name="line-264"></a>
<a name="line-265"></a><a name="addNewOpFromPending"></a><span class='hs-definition'>addNewOpFromPending</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>PendingNode</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeDef</span>
<a name="line-266"></a><span class='hs-definition'>addNewOpFromPending</span> <span class='hs-varid'>pending</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-267"></a> <span class='hs-varid'>nodeName</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>renderPendingNode</span> <span class='hs-varid'>pending</span>
<a name="line-268"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nodeDef</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pendingNodeDef</span> <span class='hs-varid'>pending</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>name</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>unNodeName</span> <span class='hs-varid'>nodeName</span>
<a name="line-269"></a> <span class='hs-varid'>nodeBuffer</span> <span class='hs-varop'>%=</span> <span class='hs-layout'>(</span><span class='hs-varid'>nodeDef</span> <span class='hs-conop'>:</span><span class='hs-layout'>)</span>
<a name="line-270"></a> <span class='hs-varid'>renderedNodes</span> <span class='hs-varop'>%=</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>insert</span> <span class='hs-varid'>pending</span> <span class='hs-varid'>nodeDef</span>
<a name="line-271"></a> <span class='hs-varid'>renderedNodeDefs</span> <span class='hs-varop'>%=</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>insert</span> <span class='hs-varid'>nodeName</span> <span class='hs-varid'>nodeDef</span>
<a name="line-272"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>nodeDef</span>
<a name="line-273"></a>
<a name="line-274"></a><a name="getPendingNode"></a><span class='hs-comment'>-- | Get the pending node corresponding to an OpDef, which may or may not have</span>
<a name="line-275"></a><span class='hs-comment'>-- been rendered before. Implicitly renders all of this node's inputs.</span>
<a name="line-276"></a><span class='hs-definition'>getPendingNode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>PendingNode</span>
<a name="line-277"></a><span class='hs-definition'>getPendingNode</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-278"></a> <span class='hs-comment'>-- An empty string in the proto field means that no specific</span>
<a name="line-279"></a> <span class='hs-comment'>-- device is specified.</span>
<a name="line-280"></a> <span class='hs-varid'>dev</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>maybe</span> <span class='hs-str'>""</span> <span class='hs-varid'>deviceName</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>use</span> <span class='hs-varid'>defaultDevice</span>
<a name="line-281"></a> <span class='hs-varid'>inputs</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>mapM</span> <span class='hs-varid'>getInput</span> <span class='hs-layout'>(</span><span class='hs-varid'>o</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>opInputs</span><span class='hs-layout'>)</span>
<a name="line-282"></a> <span class='hs-varid'>scope</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>currentScope</span>
<a name="line-283"></a> <span class='hs-varid'>controls</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>defaultControlInputs</span>
<a name="line-284"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>controlInputs</span>
<a name="line-285"></a> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-varid'>getDep</span> <span class='hs-layout'>(</span><span class='hs-varid'>o</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>opControlInputs</span> <span class='hs-varop'>++</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varid'>controls</span><span class='hs-layout'>)</span>
<a name="line-286"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>PendingNode</span> <span class='hs-varid'>scope</span> <span class='hs-layout'>(</span><span class='hs-varid'>o</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>opName</span><span class='hs-layout'>)</span>
<a name="line-287"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>op</span> <span class='hs-varop'>.~</span> <span class='hs-layout'>(</span><span class='hs-varid'>unOpType</span> <span class='hs-layout'>(</span><span class='hs-varid'>o</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>opType</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span><span class='hs-layout'>)</span>
<a name="line-288"></a> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>attr</span> <span class='hs-varop'>.~</span> <span class='hs-sel'>_opAttrs</span> <span class='hs-varid'>o</span>
<a name="line-289"></a> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>input</span> <span class='hs-varop'>.~</span> <span class='hs-layout'>(</span><span class='hs-varid'>inputs</span> <span class='hs-varop'>++</span> <span class='hs-varid'>controlInputs</span><span class='hs-layout'>)</span>
<a name="line-290"></a> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>device</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>dev</span>
<a name="line-291"></a> <span class='hs-keyword'>where</span>
<a name="line-292"></a> <span class='hs-varid'>getInput</span> <span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-layout'>(</span><span class='hs-conid'>OutputIx</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-varid'>subOp</span><span class='hs-layout'>)</span>
<a name="line-293"></a> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span> <span class='hs-str'>":"</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unNodeName</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-varid'>subOp</span>
<a name="line-294"></a> <span class='hs-varid'>getDep</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-str'>"^"</span> <span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unNodeName</span>
<a name="line-295"></a>
<a name="line-296"></a><a name="renderPendingNode"></a><span class='hs-comment'>-- | Pick a name for a pending node. If it has an explicit name, just use that;</span>
<a name="line-297"></a><span class='hs-comment'>-- if the name is implicit, assign a new unique name based on the op type.</span>
<a name="line-298"></a><span class='hs-definition'>renderPendingNode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>PendingNode</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeName</span>
<a name="line-299"></a><span class='hs-definition'>renderPendingNode</span> <span class='hs-layout'>(</span><span class='hs-conid'>PendingNode</span> <span class='hs-varid'>scope</span> <span class='hs-varid'>pendingName</span> <span class='hs-varid'>nodeDef</span><span class='hs-layout'>)</span>
<a name="line-300"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>NodeName</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varid'>scopePrefix</span> <span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getName</span>
<a name="line-301"></a> <span class='hs-keyword'>where</span>
<a name="line-302"></a> <span class='hs-varid'>scopePrefix</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>concat</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span> <span class='hs-str'>"/"</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unScope</span><span class='hs-layout'>)</span> <span class='hs-varid'>scope</span>
<a name="line-303"></a> <span class='hs-varid'>getName</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>pendingName</span> <span class='hs-keyword'>of</span>
<a name="line-304"></a> <span class='hs-conid'>ExplicitName</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>return</span> <span class='hs-varid'>n</span>
<a name="line-305"></a> <span class='hs-conid'>ImplicitName</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-306"></a> <span class='hs-varid'>u</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>Unique</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>nextUnique</span>
<a name="line-307"></a> <span class='hs-varid'>nextUnique</span> <span class='hs-varop'>.=</span> <span class='hs-varid'>succ</span> <span class='hs-varid'>u</span>
<a name="line-308"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>nodeDef</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>op</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-str'>"_"</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span> <span class='hs-layout'>(</span><span class='hs-varid'>show</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-309"></a>
<a name="line-310"></a>
<a name="line-311"></a><a name="renderOutput"></a><span class='hs-comment'>-- | Render an 'Output' and return a string representation for the TensorFlow</span>
<a name="line-312"></a><span class='hs-comment'>-- foreign APIs.</span>
<a name="line-313"></a><span class='hs-definition'>renderOutput</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Output</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>Text</span>
<a name="line-314"></a><span class='hs-definition'>renderOutput</span> <span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-layout'>(</span><span class='hs-conid'>OutputIx</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-315"></a> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-varid'>o</span>
<a name="line-316"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>unNodeName</span> <span class='hs-varid'>n</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span> <span class='hs-layout'>(</span><span class='hs-str'>":"</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span>
<a name="line-317"></a>
<a name="line-318"></a><a name="withStateLens"></a><span class='hs-comment'>-- | Modify some part of the state, run an action, and restore the state</span>
<a name="line-319"></a><span class='hs-comment'>-- after that action is done.</span>
<a name="line-320"></a><span class='hs-definition'>withStateLens</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MonadState</span> <span class='hs-varid'>s</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Lens'</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-321"></a><span class='hs-definition'>withStateLens</span> <span class='hs-varid'>accessor</span> <span class='hs-varid'>f</span> <span class='hs-varid'>act</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-322"></a> <span class='hs-varid'>old</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>use</span> <span class='hs-varid'>accessor</span>
<a name="line-323"></a> <span class='hs-varid'>accessor</span> <span class='hs-varop'>%=</span> <span class='hs-varid'>f</span>
<a name="line-324"></a> <span class='hs-varid'>result</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>act</span>
<a name="line-325"></a> <span class='hs-varid'>accessor</span> <span class='hs-varop'>.=</span> <span class='hs-varid'>old</span>
<a name="line-326"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>result</span>
<a name="line-327"></a>
<a name="line-328"></a><a name="withDevice"></a><span class='hs-comment'>-- | Set a device for all nodes rendered in the given 'Build' action</span>
<a name="line-329"></a><span class='hs-comment'>-- (unless further overridden by another use of withDevice).</span>
<a name="line-330"></a><span class='hs-definition'>withDevice</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Maybe</span> <span class='hs-conid'>Device</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-331"></a><span class='hs-definition'>withDevice</span> <span class='hs-varid'>d</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withStateLens</span> <span class='hs-varid'>defaultDevice</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varid'>d</span><span class='hs-layout'>)</span>
<a name="line-332"></a>
<a name="line-333"></a><a name="colocateWith"></a><span class='hs-comment'>-- | Places all nodes rendered in the given 'Build' action on the same</span>
<a name="line-334"></a><span class='hs-comment'>-- device as the given Tensor (see also 'withDevice'). Make sure that</span>
<a name="line-335"></a><span class='hs-comment'>-- the action has side effects of rendering the desired tensors. A pure</span>
<a name="line-336"></a><span class='hs-comment'>-- return would not have the desired effect.</span>
<a name="line-337"></a><span class='hs-definition'>colocateWith</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varid'>v</span> <span class='hs-varid'>b</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-338"></a><span class='hs-definition'>colocateWith</span> <span class='hs-varid'>t</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-339"></a> <span class='hs-varid'>d</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Device</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span> <span class='hs-varid'>device</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>resolveOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-varop'>.</span> <span class='hs-varid'>outputOp</span><span class='hs-layout'>)</span>
<a name="line-340"></a> <span class='hs-varid'>withDevice</span> <span class='hs-layout'>(</span><span class='hs-conid'>Just</span> <span class='hs-varid'>d</span><span class='hs-layout'>)</span> <span class='hs-varid'>x</span>
<a name="line-341"></a>
<a name="line-342"></a><a name="withNameScope"></a><span class='hs-comment'>-- | Prepend a scope to all nodes rendered in the given 'Build' action.</span>
<a name="line-343"></a><span class='hs-definition'>withNameScope</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-344"></a><span class='hs-definition'>withNameScope</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withStateLens</span> <span class='hs-varid'>currentScope</span> <span class='hs-layout'>(</span><span class='hs-conid'>Scope</span> <span class='hs-varid'>s</span> <span class='hs-conop'>:</span><span class='hs-layout'>)</span>
<a name="line-345"></a>
<a name="line-346"></a><a name="withNodeDependencies"></a><span class='hs-comment'>-- | Add control inputs to all nodes rendered in the given 'Build' action.</span>
<a name="line-347"></a><span class='hs-definition'>withNodeDependencies</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Set</span> <span class='hs-conid'>NodeName</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-348"></a><span class='hs-definition'>withNodeDependencies</span> <span class='hs-varid'>nodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withStateLens</span> <span class='hs-varid'>defaultControlInputs</span> <span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span> <span class='hs-varid'>nodes</span><span class='hs-layout'>)</span>
<a name="line-349"></a>
<a name="line-350"></a><a name="render"></a><span class='hs-comment'>-- | Render a 'Tensor', fixing its name, scope, device and control inputs from</span>
<a name="line-351"></a><span class='hs-comment'>-- the 'Build' context. Also renders any dependencies of the 'Tensor' that</span>
<a name="line-352"></a><span class='hs-comment'>-- weren't already rendered.</span>
<a name="line-353"></a><span class='hs-comment'>--</span>
<a name="line-354"></a><span class='hs-comment'>-- This operation is idempotent; @render &gt;=&gt; render === render@. However,</span>
<a name="line-355"></a><span class='hs-comment'>-- rendering a (previously un-rendered) 'Tensor' in two different contexts</span>
<a name="line-356"></a><span class='hs-comment'>-- may result in two different 'Tensor's.</span>
<a name="line-357"></a><span class='hs-definition'>render</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-358"></a><span class='hs-definition'>render</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-varop'>$</span> <span class='hs-varid'>outputOp</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fmap</span> <span class='hs-conid'>Rendered</span> <span class='hs-varop'>.</span> <span class='hs-varid'>resolveOp</span>
<a name="line-359"></a>
<a name="line-360"></a><a name="renderNodeName"></a><span class='hs-comment'>-- | Render a 'Tensor' and get its node's name.</span>
<a name="line-361"></a><span class='hs-definition'>renderNodeName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>NodeName</span>
<a name="line-362"></a><span class='hs-definition'>renderNodeName</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-varop'>.</span> <span class='hs-varid'>outputOp</span><span class='hs-layout'>)</span>
<a name="line-363"></a>
<a name="line-364"></a><a name="addSummary"></a><span class='hs-comment'>-- | Records the given summary action in Build for retrieval with</span>
<a name="line-365"></a><span class='hs-comment'>-- 'collectAllSummaries'. The summary op is required to produce a</span>
<a name="line-366"></a><span class='hs-comment'>-- Summary protocol buffer in string form. For safety, use the</span>
<a name="line-367"></a><span class='hs-comment'>-- pre-composed functions: Logging.scalarSummary and</span>
<a name="line-368"></a><span class='hs-comment'>-- Logging.histogramSummary.</span>
<a name="line-369"></a><span class='hs-definition'>addSummary</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SummaryTensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>()</span>
<a name="line-370"></a><span class='hs-definition'>addSummary</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>summaries</span> <span class='hs-varop'>%=</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-conop'>:</span><span class='hs-layout'>)</span>
<a name="line-371"></a>
<a name="line-372"></a><a name="collectAllSummaries"></a><span class='hs-comment'>-- | Retrieves the summary ops collected thus far. Typically this only</span>
<a name="line-373"></a><span class='hs-comment'>-- happens once, but if 'TensorFlow.Session.buildWithSummary' is used</span>
<a name="line-374"></a><span class='hs-comment'>-- repeatedly, the values accumulate.</span>
<a name="line-375"></a><span class='hs-definition'>collectAllSummaries</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildT</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>SummaryTensor</span><span class='hs-keyglyph'>]</span>
<a name="line-376"></a><span class='hs-definition'>collectAllSummaries</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>use</span> <span class='hs-varid'>summaries</span>
</pre></body>
</html>

View file

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/BuildOp.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE TupleSections #-}</span>
<a name="line-17"></a>
<a name="line-18"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>BuildOp</span>
<a name="line-19"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>OpResult</span>
<a name="line-20"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>BuildOp</span>
<a name="line-21"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>buildOp</span>
<a name="line-22"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>buildListOp</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>eqLengthGuard</span>
<a name="line-24"></a> <span class='hs-layout'>)</span>
<a name="line-25"></a> <span class='hs-keyword'>where</span>
<a name="line-26"></a>
<a name="line-27"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span> <span class='hs-layout'>(</span><span class='hs-varid'>replicateM</span><span class='hs-layout'>)</span>
<a name="line-28"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Reader</span> <span class='hs-layout'>(</span><span class='hs-conid'>ReaderT</span><span class='hs-layout'>,</span> <span class='hs-varid'>runReaderT</span><span class='hs-layout'>,</span> <span class='hs-varid'>ask</span><span class='hs-layout'>)</span>
<a name="line-29"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>State</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-layout'>(</span><span class='hs-conid'>State</span><span class='hs-layout'>,</span> <span class='hs-varid'>runState</span><span class='hs-layout'>,</span> <span class='hs-varid'>get</span><span class='hs-layout'>,</span> <span class='hs-varid'>put</span><span class='hs-layout'>)</span>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Int</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int64</span><span class='hs-layout'>)</span>
<a name="line-31"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;~</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-32"></a>
<a name="line-33"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Build</span>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-36"></a>
<a name="line-37"></a><a name="ResultState"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>ResultState</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ResultState</span> <span class='hs-varop'>!</span><span class='hs-conid'>OutputIx</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>deriving</span> <span class='hs-conid'>Show</span>
<a name="line-38"></a>
<a name="line-39"></a><a name="Result"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>Result</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ReaderT</span> <span class='hs-conid'>Op</span> <span class='hs-layout'>(</span><span class='hs-conid'>State</span> <span class='hs-conid'>ResultState</span><span class='hs-layout'>)</span>
<a name="line-40"></a>
<a name="line-41"></a><a name="OpResult"></a><span class='hs-comment'>-- | Class of types that can be used as op outputs.</span>
<a name="line-42"></a><a name="OpResult"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>where</span>
<a name="line-43"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Result</span> <span class='hs-varid'>a</span>
<a name="line-44"></a>
<a name="line-45"></a><a name="instance%20OpResult%20(a1,%20a2)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-46"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>(,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-47"></a>
<a name="line-48"></a><a name="instance%20OpResult%20(a1,%20a2,%20a3)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a3</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-varid'>a3</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-49"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>(,,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-50"></a>
<a name="line-51"></a><a name="instance%20OpResult%20(a1,%20a2,%20a3,%20a4)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a3</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a4</span><span class='hs-layout'>)</span>
<a name="line-52"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-varid'>a3</span><span class='hs-layout'>,</span> <span class='hs-varid'>a4</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-53"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>(,,,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-54"></a>
<a name="line-55"></a><a name="instance%20OpResult%20(a1,%20a2,%20a3,%20a4,%20a5)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a3</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a4</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a5</span><span class='hs-layout'>)</span>
<a name="line-56"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-varid'>a3</span><span class='hs-layout'>,</span> <span class='hs-varid'>a4</span><span class='hs-layout'>,</span> <span class='hs-varid'>a5</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-57"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>(,,,,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-58"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-59"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-60"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-61"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-62"></a>
<a name="line-63"></a><a name="instance%20OpResult%20(a1,%20a2,%20a3,%20a4,%20a5,%20a6)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a1</span>
<a name="line-64"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a2</span>
<a name="line-65"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a3</span>
<a name="line-66"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a4</span>
<a name="line-67"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a5</span>
<a name="line-68"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a6</span>
<a name="line-69"></a> <span class='hs-layout'>)</span>
<a name="line-70"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-varid'>a3</span><span class='hs-layout'>,</span> <span class='hs-varid'>a4</span><span class='hs-layout'>,</span> <span class='hs-varid'>a5</span><span class='hs-layout'>,</span> <span class='hs-varid'>a6</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-71"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>(,,,,,)</span>
<a name="line-72"></a> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-73"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-74"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-75"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-76"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-77"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>toResult</span>
<a name="line-78"></a>
<a name="line-79"></a><a name="tensorResult"></a><span class='hs-definition'>tensorResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorKind</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Result</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-80"></a><span class='hs-definition'>tensorResult</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-81"></a> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>ask</span>
<a name="line-82"></a> <span class='hs-conid'>ResultState</span> <span class='hs-varid'>i</span> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>get</span>
<a name="line-83"></a> <span class='hs-varid'>put</span> <span class='hs-varop'>$!</span> <span class='hs-conid'>ResultState</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-varop'>+</span><span class='hs-num'>1</span><span class='hs-layout'>)</span> <span class='hs-varid'>ns</span>
<a name="line-84"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$!</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varop'>$</span> <span class='hs-varid'>output</span> <span class='hs-varid'>i</span> <span class='hs-varid'>o</span>
<a name="line-85"></a>
<a name="line-86"></a><a name="instance%20OpResult%20(Tensor%20Value%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-conid'>Value</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-87"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorResult</span> <span class='hs-conid'>ValueKind</span>
<a name="line-88"></a>
<a name="line-89"></a><a name="instance%20OpResult%20(Tensor%20Ref%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-conid'>Ref</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-90"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorResult</span> <span class='hs-conid'>RefKind</span>
<a name="line-91"></a>
<a name="line-92"></a><a name="instance%20OpResult%20ControlNode"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-conid'>ControlNode</span> <span class='hs-keyword'>where</span>
<a name="line-93"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ControlNode</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>ask</span>
<a name="line-94"></a>
<a name="line-95"></a><a name="instance%20OpResult%20%5ba%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpResult</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-96"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-97"></a> <span class='hs-conid'>ResultState</span> <span class='hs-varid'>i</span> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>get</span>
<a name="line-98"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>ns</span> <span class='hs-keyword'>of</span>
<a name="line-99"></a> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>error</span> <span class='hs-varop'>$</span> <span class='hs-str'>"Ran out of counts in toResult. "</span> <span class='hs-varop'>++</span>
<a name="line-100"></a> <span class='hs-str'>"Likely misuse of buildListOp."</span>
<a name="line-101"></a> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-conop'>:</span> <span class='hs-varid'>rest</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-102"></a> <span class='hs-varid'>put</span> <span class='hs-varop'>$!</span> <span class='hs-conid'>ResultState</span> <span class='hs-varid'>i</span> <span class='hs-varid'>rest</span>
<a name="line-103"></a> <span class='hs-varid'>replicateM</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-varid'>toResult</span>
<a name="line-104"></a>
<a name="line-105"></a><a name="runResult"></a><span class='hs-definition'>runResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Op</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>a</span>
<a name="line-106"></a><span class='hs-definition'>runResult</span> <span class='hs-varid'>ns</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span>
<a name="line-107"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>runState</span> <span class='hs-layout'>(</span><span class='hs-varid'>runReaderT</span> <span class='hs-varid'>toResult</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>ResultState</span> <span class='hs-num'>0</span> <span class='hs-varid'>ns</span><span class='hs-layout'>)</span> <span class='hs-keyword'>of</span>
<a name="line-108"></a> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-conid'>ResultState</span> <span class='hs-keyword'>_</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>x</span>
<a name="line-109"></a> <span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-varid'>ns'</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>error</span> <span class='hs-varop'>$</span> <span class='hs-str'>"Ununsed length in runResult attributes: "</span> <span class='hs-varop'>++</span>
<a name="line-110"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>ns</span><span class='hs-layout'>,</span> <span class='hs-varid'>ns'</span><span class='hs-layout'>)</span>
<a name="line-111"></a>
<a name="line-112"></a><a name="pureResult"></a><span class='hs-comment'>-- | Make a new "pure" op, which may be deduped with identical ops within</span>
<a name="line-113"></a><span class='hs-comment'>-- the same scope.</span>
<a name="line-114"></a><span class='hs-definition'>pureResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>a</span>
<a name="line-115"></a><span class='hs-definition'>pureResult</span> <span class='hs-varid'>ns</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runResult</span> <span class='hs-varid'>ns</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Unrendered</span> <span class='hs-varop'>$</span> <span class='hs-varid'>addReversedInputs</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span>
<a name="line-116"></a>
<a name="line-117"></a><a name="buildResult"></a><span class='hs-comment'>-- | Make a new "stateful" op, which will not be deduped with otherwise</span>
<a name="line-118"></a><span class='hs-comment'>-- identical ops.</span>
<a name="line-119"></a><span class='hs-definition'>buildResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-120"></a><span class='hs-definition'>buildResult</span> <span class='hs-varid'>ns</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span>
<a name="line-121"></a> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runResult</span> <span class='hs-varid'>ns</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Rendered</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>addNewOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>addReversedInputs</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span>
<a name="line-122"></a>
<a name="line-123"></a><a name="addReversedInputs"></a><span class='hs-definition'>addReversedInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span>
<a name="line-124"></a><span class='hs-definition'>addReversedInputs</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>o</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>opInputs</span> <span class='hs-varop'>&lt;&gt;~</span> <span class='hs-varid'>reverse</span> <span class='hs-varid'>ts</span>
<a name="line-125"></a>
<a name="line-126"></a><a name="OpDef"></a><span class='hs-comment'>-- | Class of types that can be used as op functions.</span>
<a name="line-127"></a><a name="OpDef"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>BuildOp</span> <span class='hs-varid'>f</span> <span class='hs-keyword'>where</span>
<a name="line-128"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Sizes of list results (having number_attr)</span>
<a name="line-129"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span>
<a name="line-130"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Accumulator for inputs to the op.</span>
<a name="line-131"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span>
<a name="line-132"></a>
<a name="line-133"></a><a name="buildOp"></a><span class='hs-comment'>-- | Starts an operation that returns a structured set of tensors</span>
<a name="line-134"></a><span class='hs-comment'>-- (singletons or tuples).</span>
<a name="line-135"></a><span class='hs-definition'>buildOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BuildOp</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span>
<a name="line-136"></a><span class='hs-definition'>buildOp</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildOp'</span> <span class='hs-conid'>[]</span> <span class='hs-varid'>o</span> <span class='hs-conid'>[]</span>
<a name="line-137"></a>
<a name="line-138"></a><a name="buildListOp"></a><span class='hs-comment'>-- | Starts an operation that returns a list of tensors.</span>
<a name="line-139"></a><span class='hs-definition'>buildListOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BuildOp</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span>
<a name="line-140"></a> <span class='hs-comment'>-- ^ Cardinality of the corresponding list of tensors output.</span>
<a name="line-141"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span>
<a name="line-142"></a><span class='hs-definition'>buildListOp</span> <span class='hs-varid'>counts</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildOp'</span> <span class='hs-varid'>counts</span> <span class='hs-varid'>o</span> <span class='hs-conid'>[]</span>
<a name="line-143"></a>
<a name="line-144"></a><a name="instance%20BuildOp%20ControlNode"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-conid'>ControlNode</span> <span class='hs-keyword'>where</span>
<a name="line-145"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ControlNode</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Unrendered</span> <span class='hs-varop'>$</span> <span class='hs-varid'>addReversedInputs</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span>
<a name="line-146"></a>
<a name="line-147"></a><a name="instance%20BuildOp%20(Tensor%20Value%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-conid'>Value</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-148"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-149"></a>
<a name="line-150"></a><a name="instance%20BuildOp%20(Tensor%20Ref%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-conid'>Ref</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-151"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-152"></a>
<a name="line-153"></a><a name="instance%20BuildOp%20%5bTensor%20Value%20a%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Tensor</span> <span class='hs-conid'>Value</span> <span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-154"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-155"></a>
<a name="line-156"></a><a name="instance%20BuildOp%20(t1,%20t2)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-157"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-158"></a>
<a name="line-159"></a><a name="instance%20BuildOp%20(t1,%20t2,%20t3)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t3</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-160"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-161"></a>
<a name="line-162"></a><a name="instance%20BuildOp%20(t1,%20t2,%20t3,%20t4)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t3</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t4</span><span class='hs-layout'>)</span>
<a name="line-163"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>,</span> <span class='hs-varid'>t4</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-164"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-165"></a>
<a name="line-166"></a><a name="instance%20BuildOp%20(t1,%20t2,%20t3,%20t4,%20t5)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>OpResult</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t3</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t4</span><span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t5</span><span class='hs-layout'>)</span>
<a name="line-167"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>,</span> <span class='hs-varid'>t4</span><span class='hs-layout'>,</span> <span class='hs-varid'>t5</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-168"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-169"></a>
<a name="line-170"></a><a name="instance%20BuildOp%20(t1,%20t2,%20t3,%20t4,%20t5,%20t6)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t1</span>
<a name="line-171"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span>
<a name="line-172"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t3</span>
<a name="line-173"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t4</span>
<a name="line-174"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t5</span>
<a name="line-175"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t6</span>
<a name="line-176"></a> <span class='hs-layout'>)</span>
<a name="line-177"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>,</span> <span class='hs-varid'>t4</span><span class='hs-layout'>,</span> <span class='hs-varid'>t5</span><span class='hs-layout'>,</span> <span class='hs-varid'>t6</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-178"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-179"></a>
<a name="line-180"></a><a name="instance%20BuildOp%20(Build%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Build</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-181"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildResult</span>
<a name="line-182"></a>
<a name="line-183"></a><a name="instance%20BuildOp%20(Tensor%20v%20a%20-%3e%20f)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-184"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-varid'>rf</span> <span class='hs-varid'>o</span> <span class='hs-varid'>ts</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildOp'</span> <span class='hs-varid'>rf</span> <span class='hs-varid'>o</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-conop'>:</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span>
<a name="line-185"></a>
<a name="line-186"></a><a name="instance%20BuildOp%20(%5bTensor%20v%20a%5d%20-%3e%20f)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>[</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-187"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-varid'>rf</span> <span class='hs-varid'>o</span> <span class='hs-varid'>accum</span> <span class='hs-varid'>ts</span>
<a name="line-188"></a> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildOp'</span> <span class='hs-varid'>rf</span> <span class='hs-varid'>o</span> <span class='hs-layout'>(</span><span class='hs-varid'>reverse</span> <span class='hs-layout'>(</span><span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span> <span class='hs-varid'>tensorOutput</span><span class='hs-layout'>)</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span> <span class='hs-varop'>++</span> <span class='hs-varid'>accum</span><span class='hs-layout'>)</span>
<a name="line-189"></a>
<a name="line-190"></a><a name="eqLengthGuard"></a><span class='hs-comment'>-- | Returns true if all the integers in each tuple are identical.</span>
<a name="line-191"></a><span class='hs-comment'>-- Throws an error with a descriptive message if not.</span>
<a name="line-192"></a><span class='hs-definition'>eqLengthGuard</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-conid'>String</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-conid'>String</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Bool</span>
<a name="line-193"></a><span class='hs-definition'>eqLengthGuard</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>all</span> <span class='hs-varid'>eachOk</span>
<a name="line-194"></a> <span class='hs-keyword'>where</span>
<a name="line-195"></a> <span class='hs-varid'>eachOk</span> <span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>True</span>
<a name="line-196"></a> <span class='hs-comment'>-- The next line has (== 1) . length . nub in disguise</span>
<a name="line-197"></a> <span class='hs-varid'>eachOk</span> <span class='hs-layout'>(</span><span class='hs-varid'>numberAttrName</span><span class='hs-layout'>,</span> <span class='hs-varid'>pairs</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span> <span class='hs-conop'>:</span> <span class='hs-varid'>zs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>all</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>z</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>snd</span> <span class='hs-varid'>z</span> <span class='hs-varop'>==</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span> <span class='hs-varid'>zs</span> <span class='hs-varop'>||</span>
<a name="line-198"></a> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"number_attr "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>numberAttrName</span> <span class='hs-varop'>++</span>
<a name="line-199"></a> <span class='hs-str'>" contains tensors with different length "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>pairs</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/ControlFlow.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE GADTs #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE RankNTypes #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
<a name="line-19"></a>
<a name="line-20"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>ControlFlow</span>
<a name="line-21"></a> <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Dependencies</span>
<a name="line-22"></a> <span class='hs-varid'>withControlDependencies</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>group</span>
<a name="line-24"></a> <span class='hs-comment'>-- * Operations</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>identity</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>noOp</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>named</span>
<a name="line-28"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-29"></a>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Set</span>
<a name="line-31"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-layout'>(</span><span class='hs-conid'>Text</span><span class='hs-layout'>)</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.~</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-33"></a>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>BuildOp</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Build</span>
<a name="line-36"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Nodes</span>
<a name="line-37"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span>
<a name="line-38"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-39"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-40"></a>
<a name="line-41"></a><a name="withControlDependencies"></a><span class='hs-comment'>-- | Modify a 'Build' action, such that all new ops rendered in it will depend</span>
<a name="line-42"></a><span class='hs-comment'>-- on the nodes in the first argument.</span>
<a name="line-43"></a><span class='hs-definition'>withControlDependencies</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span>
<a name="line-44"></a><span class='hs-definition'>withControlDependencies</span> <span class='hs-varid'>deps</span> <span class='hs-varid'>act</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-45"></a> <span class='hs-varid'>nodes</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>deps</span>
<a name="line-46"></a> <span class='hs-varid'>withNodeDependencies</span> <span class='hs-varid'>nodes</span> <span class='hs-varid'>act</span>
<a name="line-47"></a>
<a name="line-48"></a><span class='hs-comment'>-- TODO(judahjacobson): Reimplement withDependencies.</span>
<a name="line-49"></a>
<a name="line-50"></a><a name="group"></a><span class='hs-comment'>-- | Create an op that groups multiple operations.</span>
<a name="line-51"></a><span class='hs-comment'>--</span>
<a name="line-52"></a><span class='hs-comment'>-- When this op finishes, all ops in the input @n@ have finished. This op has</span>
<a name="line-53"></a><span class='hs-comment'>-- no output.</span>
<a name="line-54"></a><span class='hs-definition'>group</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-conid'>ControlNode</span>
<a name="line-55"></a><span class='hs-definition'>group</span> <span class='hs-varid'>deps</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-56"></a> <span class='hs-varid'>nodes</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>deps</span>
<a name="line-57"></a> <span class='hs-comment'>-- TODO: slicker way</span>
<a name="line-58"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>buildOp</span> <span class='hs-varop'>$</span> <span class='hs-varid'>opDef</span> <span class='hs-str'>"NoOp"</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>opControlInputs</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>nodes</span>
<a name="line-59"></a>
<a name="line-60"></a>
<a name="line-61"></a><a name="identity"></a><span class='hs-comment'>-- | Returns a 'Tensor' with the same shape and contents as the input.</span>
<a name="line-62"></a><span class='hs-definition'>identity</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span>
<a name="line-63"></a><span class='hs-definition'>identity</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>namedIdentity</span> <span class='hs-varid'>implicitName</span>
<a name="line-64"></a>
<a name="line-65"></a><a name="named"></a><span class='hs-comment'>-- | Returns a 'Tensor' with a given name and the same shape and contents as</span>
<a name="line-66"></a><span class='hs-comment'>-- the input.</span>
<a name="line-67"></a><span class='hs-comment'>--</span>
<a name="line-68"></a><span class='hs-comment'>-- TODO(judahjacobson): This breaks when used with uninitialize @Tensor Ref@s,</span>
<a name="line-69"></a><span class='hs-comment'>-- since @RefIdentity@ doesn't have SetAllowsUninitializedInput(). Look into</span>
<a name="line-70"></a><span class='hs-comment'>-- whether we can change that op.</span>
<a name="line-71"></a><span class='hs-definition'>named</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span>
<a name="line-72"></a><span class='hs-definition'>named</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>namedIdentity</span> <span class='hs-varop'>.</span> <span class='hs-varid'>explicitName</span>
<a name="line-73"></a>
<a name="line-74"></a><a name="namedIdentity"></a><span class='hs-comment'>-- | An internal version of "identity" that allows setting the name</span>
<a name="line-75"></a><span class='hs-comment'>-- of the output Tensor.</span>
<a name="line-76"></a><span class='hs-definition'>namedIdentity</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varid'>v</span> <span class='hs-varop'>.</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span>
<a name="line-77"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>PendingNodeName</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span>
<a name="line-78"></a><span class='hs-definition'>namedIdentity</span> <span class='hs-varid'>n</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>t</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>tensorKind</span> <span class='hs-keyword'>of</span>
<a name="line-79"></a> <span class='hs-conid'>ValueKind</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>buildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>opDefWithName</span> <span class='hs-varid'>n</span> <span class='hs-str'>"Identity"</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>setTypeAttr</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span>
<a name="line-80"></a> <span class='hs-conid'>RefKind</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>buildOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>opDefWithName</span> <span class='hs-varid'>n</span> <span class='hs-str'>"RefIdentity"</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>setTypeAttr</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span>
<a name="line-81"></a> <span class='hs-keyword'>where</span>
<a name="line-82"></a> <span class='hs-varid'>setTypeAttr</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>opAttr</span> <span class='hs-str'>"T"</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>tensorType</span> <span class='hs-layout'>(</span><span class='hs-varid'>undefined</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-83"></a>
<a name="line-84"></a>
<a name="line-85"></a><a name="noOp"></a><span class='hs-comment'>-- | Does nothing. Only useful as a placeholder for control edges.</span>
<a name="line-86"></a><span class='hs-definition'>noOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ControlNode</span>
<a name="line-87"></a><span class='hs-definition'>noOp</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildOp</span> <span class='hs-varop'>$</span> <span class='hs-varid'>opDef</span> <span class='hs-str'>"NoOp"</span>
</pre></body>
</html>

View file

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Internal/FFI.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE DeriveDataTypeable #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-17"></a>
<a name="line-18"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span>
<a name="line-19"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>TensorFlowException</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-20"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span>
<a name="line-21"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withSession</span>
<a name="line-22"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>extendGraph</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>run</span>
<a name="line-24"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorData</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>setSessionConfig</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>setSessionTarget</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>getAllOpList</span>
<a name="line-28"></a> <span class='hs-comment'>-- * Internal helper.</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>useProtoAsVoidPtrLen</span>
<a name="line-30"></a> <span class='hs-layout'>)</span>
<a name="line-31"></a> <span class='hs-keyword'>where</span>
<a name="line-32"></a>
<a name="line-33"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>Async</span> <span class='hs-layout'>(</span><span class='hs-conid'>Async</span><span class='hs-layout'>,</span> <span class='hs-varid'>async</span><span class='hs-layout'>,</span> <span class='hs-varid'>cancel</span><span class='hs-layout'>,</span> <span class='hs-varid'>waitCatch</span><span class='hs-layout'>)</span>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>MVar</span> <span class='hs-layout'>(</span><span class='hs-conid'>MVar</span><span class='hs-layout'>,</span> <span class='hs-varid'>modifyMVarMasked_</span><span class='hs-layout'>,</span> <span class='hs-varid'>newMVar</span><span class='hs-layout'>,</span> <span class='hs-varid'>takeMVar</span><span class='hs-layout'>)</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Exception</span> <span class='hs-layout'>(</span><span class='hs-conid'>Exception</span><span class='hs-layout'>,</span> <span class='hs-varid'>throwIO</span><span class='hs-layout'>,</span> <span class='hs-varid'>bracket</span><span class='hs-layout'>,</span> <span class='hs-varid'>finally</span><span class='hs-layout'>,</span> <span class='hs-varid'>mask_</span><span class='hs-layout'>)</span>
<a name="line-36"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span> <span class='hs-layout'>(</span><span class='hs-varid'>when</span><span class='hs-layout'>)</span>
<a name="line-37"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Int</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int64</span><span class='hs-layout'>)</span>
<a name="line-38"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Typeable</span> <span class='hs-layout'>(</span><span class='hs-conid'>Typeable</span><span class='hs-layout'>)</span>
<a name="line-39"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span> <span class='hs-layout'>(</span><span class='hs-conid'>Word8</span><span class='hs-layout'>)</span>
<a name="line-40"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span><span class='hs-layout'>,</span> <span class='hs-conid'>FunPtr</span><span class='hs-layout'>,</span> <span class='hs-varid'>nullPtr</span><span class='hs-layout'>,</span> <span class='hs-varid'>castPtr</span><span class='hs-layout'>)</span>
<a name="line-41"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>C</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span> <span class='hs-layout'>(</span><span class='hs-conid'>CString</span><span class='hs-layout'>)</span>
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>ForeignPtr</span> <span class='hs-layout'>(</span><span class='hs-varid'>newForeignPtr</span><span class='hs-layout'>,</span> <span class='hs-varid'>withForeignPtr</span><span class='hs-layout'>)</span>
<a name="line-43"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Marshal</span><span class='hs-varop'>.</span><span class='hs-conid'>Alloc</span> <span class='hs-layout'>(</span><span class='hs-varid'>free</span><span class='hs-layout'>)</span>
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Marshal</span><span class='hs-varop'>.</span><span class='hs-conid'>Array</span> <span class='hs-layout'>(</span><span class='hs-varid'>withArrayLen</span><span class='hs-layout'>,</span> <span class='hs-varid'>peekArray</span><span class='hs-layout'>,</span> <span class='hs-varid'>mallocArray</span><span class='hs-layout'>,</span> <span class='hs-varid'>copyArray</span><span class='hs-layout'>)</span>
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-conid'>Unsafe</span> <span class='hs-layout'>(</span><span class='hs-varid'>unsafePerformIO</span><span class='hs-layout'>)</span>
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>B</span>
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>T</span>
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Encoding</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>T</span>
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Encoding</span><span class='hs-varop'>.</span><span class='hs-conid'>Error</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>T</span>
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span><span class='hs-varop'>.</span><span class='hs-conid'>Storable</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>S</span>
<a name="line-51"></a>
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ProtoLens</span> <span class='hs-layout'>(</span><span class='hs-conid'>Message</span><span class='hs-layout'>,</span> <span class='hs-varid'>encodeMessage</span><span class='hs-layout'>)</span>
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Graph</span> <span class='hs-layout'>(</span><span class='hs-conid'>GraphDef</span><span class='hs-layout'>)</span>
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-layout'>(</span><span class='hs-conid'>DataType</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Protobuf</span><span class='hs-varop'>.</span><span class='hs-conid'>Config</span> <span class='hs-layout'>(</span><span class='hs-conid'>ConfigProto</span><span class='hs-layout'>)</span>
<a name="line-56"></a>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Raw</span>
<a name="line-58"></a>
<a name="line-59"></a><a name="TensorFlowException"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>TensorFlowException</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorFlowException</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Code</span> <span class='hs-conid'>T</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span>
<a name="line-60"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span><span class='hs-layout'>,</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Typeable</span><span class='hs-layout'>)</span>
<a name="line-61"></a>
<a name="line-62"></a><a name="instance%20Exception%20TensorFlowException"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Exception</span> <span class='hs-conid'>TensorFlowException</span>
<a name="line-63"></a>
<a name="line-64"></a><a name="TensorData"></a><span class='hs-comment'>-- | All of the data needed to represent a tensor.</span>
<a name="line-65"></a><a name="TensorData"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>TensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorData</span>
<a name="line-66"></a> <span class='hs-layout'>{</span> <span class='hs-varid'>tensorDataDimensions</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span>
<a name="line-67"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tensorDataType</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-conid'>DataType</span>
<a name="line-68"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tensorDataBytes</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-conid'>Word8</span><span class='hs-layout'>)</span>
<a name="line-69"></a> <span class='hs-layout'>}</span>
<a name="line-70"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span><span class='hs-layout'>,</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>)</span>
<a name="line-71"></a>
<a name="line-72"></a><a name="withSession"></a><span class='hs-comment'>-- | Runs the given action after creating a session with options</span>
<a name="line-73"></a><span class='hs-comment'>-- populated by the given optionSetter.</span>
<a name="line-74"></a><span class='hs-definition'>withSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span>
<a name="line-75"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-76"></a> <span class='hs-comment'>-- ^ The action can spawn concurrent tasks which will</span>
<a name="line-77"></a> <span class='hs-comment'>-- be canceled before withSession returns.</span>
<a name="line-78"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-79"></a><span class='hs-definition'>withSession</span> <span class='hs-varid'>optionSetter</span> <span class='hs-varid'>action</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-80"></a> <span class='hs-varid'>drain</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newMVar</span> <span class='hs-conid'>[]</span>
<a name="line-81"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cleanup</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span>
<a name="line-82"></a> <span class='hs-comment'>-- Closes the session to nudge the pending run calls to fail and exit.</span>
<a name="line-83"></a> <span class='hs-varid'>finally</span> <span class='hs-layout'>(</span><span class='hs-varid'>checkStatus</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>closeSession</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
<a name="line-84"></a> <span class='hs-varid'>runners</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>takeMVar</span> <span class='hs-varid'>drain</span>
<a name="line-85"></a> <span class='hs-comment'>-- Collects all runners before deleting the session.</span>
<a name="line-86"></a> <span class='hs-varid'>mapM_</span> <span class='hs-varid'>shutDownRunner</span> <span class='hs-varid'>runners</span>
<a name="line-87"></a> <span class='hs-varid'>checkStatus</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteSession</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-88"></a> <span class='hs-varid'>bracket</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>newSessionOptions</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteSessionOptions</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>options</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-89"></a> <span class='hs-varid'>optionSetter</span> <span class='hs-varid'>options</span>
<a name="line-90"></a> <span class='hs-varid'>bracket</span>
<a name="line-91"></a> <span class='hs-layout'>(</span><span class='hs-varid'>checkStatus</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>newSession</span> <span class='hs-varid'>options</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-92"></a> <span class='hs-varid'>cleanup</span>
<a name="line-93"></a> <span class='hs-layout'>(</span><span class='hs-varid'>action</span> <span class='hs-layout'>(</span><span class='hs-varid'>asyncCollector</span> <span class='hs-varid'>drain</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-94"></a>
<a name="line-95"></a><a name="asyncCollector"></a><span class='hs-definition'>asyncCollector</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MVar</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Async</span> <span class='hs-conid'>()</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-96"></a><span class='hs-definition'>asyncCollector</span> <span class='hs-varid'>drain</span> <span class='hs-varid'>runner</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>modifyMVarMasked_</span> <span class='hs-varid'>drain</span> <span class='hs-varid'>launchAndRecord</span>
<a name="line-97"></a> <span class='hs-keyword'>where</span>
<a name="line-98"></a> <span class='hs-varid'>launchAndRecord</span> <span class='hs-varid'>restRunners</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-conop'>:</span> <span class='hs-varid'>restRunners</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>async</span> <span class='hs-varid'>runner</span>
<a name="line-99"></a>
<a name="line-100"></a><a name="shutDownRunner"></a><span class='hs-definition'>shutDownRunner</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Async</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-101"></a><span class='hs-definition'>shutDownRunner</span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-102"></a> <span class='hs-varid'>cancel</span> <span class='hs-varid'>r</span>
<a name="line-103"></a> <span class='hs-comment'>-- TODO(gnezdo): manage exceptions better than print.</span>
<a name="line-104"></a> <span class='hs-varid'>either</span> <span class='hs-varid'>print</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>waitCatch</span> <span class='hs-varid'>r</span>
<a name="line-105"></a>
<a name="line-106"></a><a name="extendGraph"></a><span class='hs-definition'>extendGraph</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>GraphDef</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-107"></a><span class='hs-definition'>extendGraph</span> <span class='hs-varid'>session</span> <span class='hs-varid'>pb</span> <span class='hs-keyglyph'>=</span>
<a name="line-108"></a> <span class='hs-varid'>useProtoAsVoidPtrLen</span> <span class='hs-varid'>pb</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>ptr</span> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-109"></a> <span class='hs-varid'>checkStatus</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>extendGraph</span> <span class='hs-varid'>session</span> <span class='hs-varid'>ptr</span> <span class='hs-varid'>len</span>
<a name="line-110"></a>
<a name="line-111"></a>
<a name="line-112"></a><a name="run"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span>
<a name="line-113"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-layout'>,</span> <span class='hs-conid'>TensorData</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Feeds.</span>
<a name="line-114"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Fetches.</span>
<a name="line-115"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-keyglyph'>]</span> <span class='hs-comment'>-- ^ Targets.</span>
<a name="line-116"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>TensorData</span><span class='hs-keyglyph'>]</span>
<a name="line-117"></a><span class='hs-definition'>run</span> <span class='hs-varid'>session</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>fetches</span> <span class='hs-varid'>targets</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-118"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>nullTensor</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>nullPtr</span>
<a name="line-119"></a> <span class='hs-comment'>-- Use mask to avoid leaking input tensors before they are passed to 'run'</span>
<a name="line-120"></a> <span class='hs-comment'>-- and output tensors before they are passed to 'createTensorData'.</span>
<a name="line-121"></a> <span class='hs-varid'>mask_</span> <span class='hs-varop'>$</span>
<a name="line-122"></a> <span class='hs-comment'>-- Feeds</span>
<a name="line-123"></a> <span class='hs-varid'>withStringArrayLen</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>feeds</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>feedsLen</span> <span class='hs-varid'>feedNames</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-124"></a> <span class='hs-varid'>mapM</span> <span class='hs-layout'>(</span><span class='hs-varid'>createRawTensor</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snd</span><span class='hs-layout'>)</span> <span class='hs-varid'>feeds</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>feedTensors</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-125"></a> <span class='hs-varid'>withArrayLen</span> <span class='hs-varid'>feedTensors</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-varid'>cFeedTensors</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-126"></a> <span class='hs-comment'>-- Fetches.</span>
<a name="line-127"></a> <span class='hs-varid'>withStringArrayLen</span> <span class='hs-varid'>fetches</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>fetchesLen</span> <span class='hs-varid'>fetchNames</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-128"></a> <span class='hs-comment'>-- tensorOuts is an array of null Tensor pointers that will be filled</span>
<a name="line-129"></a> <span class='hs-comment'>-- by the call to Raw.run.</span>
<a name="line-130"></a> <span class='hs-varid'>withArrayLen</span> <span class='hs-layout'>(</span><span class='hs-varid'>replicate</span> <span class='hs-varid'>fetchesLen</span> <span class='hs-varid'>nullTensor</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-varid'>tensorOuts</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-131"></a> <span class='hs-comment'>-- Targets.</span>
<a name="line-132"></a> <span class='hs-varid'>withStringArrayLen</span> <span class='hs-varid'>targets</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>targetsLen</span> <span class='hs-varid'>ctargets</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-133"></a> <span class='hs-varid'>checkStatus</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>run</span>
<a name="line-134"></a> <span class='hs-varid'>session</span>
<a name="line-135"></a> <span class='hs-varid'>nullPtr</span>
<a name="line-136"></a> <span class='hs-varid'>feedNames</span> <span class='hs-varid'>cFeedTensors</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>feedsLen</span><span class='hs-layout'>)</span>
<a name="line-137"></a> <span class='hs-varid'>fetchNames</span> <span class='hs-varid'>tensorOuts</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>fetchesLen</span><span class='hs-layout'>)</span>
<a name="line-138"></a> <span class='hs-varid'>ctargets</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>targetsLen</span><span class='hs-layout'>)</span>
<a name="line-139"></a> <span class='hs-varid'>nullPtr</span>
<a name="line-140"></a> <span class='hs-varid'>outTensors</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>peekArray</span> <span class='hs-varid'>fetchesLen</span> <span class='hs-varid'>tensorOuts</span>
<a name="line-141"></a> <span class='hs-varid'>mapM</span> <span class='hs-varid'>createTensorData</span> <span class='hs-varid'>outTensors</span>
<a name="line-142"></a>
<a name="line-143"></a>
<a name="line-144"></a><span class='hs-comment'>-- Internal.</span>
<a name="line-145"></a>
<a name="line-146"></a>
<a name="line-147"></a><a name="withStringList"></a><span class='hs-comment'>-- | Use a list of ByteString as a list of CString.</span>
<a name="line-148"></a><span class='hs-definition'>withStringList</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>[</span><span class='hs-conid'>CString</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-149"></a><span class='hs-definition'>withStringList</span> <span class='hs-varid'>strings</span> <span class='hs-varid'>fn</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>go</span> <span class='hs-varid'>strings</span> <span class='hs-conid'>[]</span>
<a name="line-150"></a> <span class='hs-keyword'>where</span>
<a name="line-151"></a> <span class='hs-varid'>go</span> <span class='hs-conid'>[]</span> <span class='hs-varid'>cs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fn</span> <span class='hs-layout'>(</span><span class='hs-varid'>reverse</span> <span class='hs-varid'>cs</span><span class='hs-layout'>)</span>
<a name="line-152"></a> <span class='hs-comment'>-- TODO(fmayle): Is it worth using unsafeAsCString here?</span>
<a name="line-153"></a> <span class='hs-varid'>go</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varid'>cs</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>useAsCString</span> <span class='hs-varid'>x</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>c</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>go</span> <span class='hs-varid'>xs</span> <span class='hs-layout'>(</span><span class='hs-varid'>c</span><span class='hs-conop'>:</span><span class='hs-varid'>cs</span><span class='hs-layout'>)</span>
<a name="line-154"></a>
<a name="line-155"></a>
<a name="line-156"></a><a name="withStringArrayLen"></a><span class='hs-comment'>-- | Use a list of ByteString as an array of CString.</span>
<a name="line-157"></a><span class='hs-definition'>withStringArrayLen</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-158"></a><span class='hs-definition'>withStringArrayLen</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>fn</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withStringList</span> <span class='hs-varid'>xs</span> <span class='hs-layout'>(</span><span class='hs-varop'>`withArrayLen`</span> <span class='hs-varid'>fn</span><span class='hs-layout'>)</span>
<a name="line-159"></a>
<a name="line-160"></a>
<a name="line-161"></a><a name="createRawTensor"></a><span class='hs-comment'>-- | Create a Raw.Tensor from a TensorData.</span>
<a name="line-162"></a><span class='hs-definition'>createRawTensor</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorData</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-163"></a><span class='hs-definition'>createRawTensor</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorData</span> <span class='hs-varid'>dims</span> <span class='hs-varid'>dt</span> <span class='hs-varid'>byteVec</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-164"></a> <span class='hs-varid'>withArrayLen</span> <span class='hs-layout'>(</span><span class='hs-varid'>map</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>dims</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>cdimsLen</span> <span class='hs-varid'>cdims</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-165"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>length</span> <span class='hs-varid'>byteVec</span>
<a name="line-166"></a> <span class='hs-varid'>dest</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>mallocArray</span> <span class='hs-varid'>len</span>
<a name="line-167"></a> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>unsafeWith</span> <span class='hs-varid'>byteVec</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>copyArray</span> <span class='hs-varid'>dest</span> <span class='hs-varid'>x</span> <span class='hs-varid'>len</span>
<a name="line-168"></a> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>newTensor</span> <span class='hs-layout'>(</span><span class='hs-varid'>toEnum</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varid'>dt</span><span class='hs-layout'>)</span>
<a name="line-169"></a> <span class='hs-varid'>cdims</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>cdimsLen</span><span class='hs-layout'>)</span>
<a name="line-170"></a> <span class='hs-layout'>(</span><span class='hs-varid'>castPtr</span> <span class='hs-varid'>dest</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-171"></a> <span class='hs-varid'>tensorDeallocFunPtr</span> <span class='hs-varid'>nullPtr</span>
<a name="line-172"></a>
<a name="line-173"></a><a name="tensorDeallocFunPtr"></a><span class='hs-comment'>{-# NOINLINE tensorDeallocFunPtr #-}</span>
<a name="line-174"></a><span class='hs-definition'>tensorDeallocFunPtr</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>FunPtr</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorDeallocFn</span>
<a name="line-175"></a><span class='hs-definition'>tensorDeallocFunPtr</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>unsafePerformIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>wrapTensorDealloc</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>free</span> <span class='hs-varid'>x</span>
<a name="line-176"></a>
<a name="line-177"></a><a name="createTensorData"></a><span class='hs-comment'>-- | Create a TensorData from a Raw.Tensor.</span>
<a name="line-178"></a><span class='hs-comment'>--</span>
<a name="line-179"></a><span class='hs-comment'>-- Takes ownership of the Raw.Tensor.</span>
<a name="line-180"></a><span class='hs-definition'>createTensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>TensorData</span>
<a name="line-181"></a><span class='hs-definition'>createTensorData</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-182"></a> <span class='hs-comment'>-- Read dimensions.</span>
<a name="line-183"></a> <span class='hs-varid'>numDims</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>numDims</span> <span class='hs-varid'>t</span>
<a name="line-184"></a> <span class='hs-varid'>dims</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>mapM</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>dim</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>[</span><span class='hs-num'>0</span><span class='hs-keyglyph'>..</span><span class='hs-varid'>numDims</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-keyglyph'>]</span>
<a name="line-185"></a> <span class='hs-comment'>-- Read type.</span>
<a name="line-186"></a> <span class='hs-varid'>dtype</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>toEnum</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorType</span> <span class='hs-varid'>t</span>
<a name="line-187"></a> <span class='hs-comment'>-- Read data.</span>
<a name="line-188"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorByteSize</span> <span class='hs-varid'>t</span>
<a name="line-189"></a> <span class='hs-varid'>bytes</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>castPtr</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorData</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>Word8</span><span class='hs-layout'>)</span>
<a name="line-190"></a> <span class='hs-comment'>-- TODO(fmayle): Don't copy the data.</span>
<a name="line-191"></a> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>fromList</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>peekArray</span> <span class='hs-varid'>len</span> <span class='hs-varid'>bytes</span>
<a name="line-192"></a> <span class='hs-comment'>-- Free tensor.</span>
<a name="line-193"></a> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteTensor</span> <span class='hs-varid'>t</span>
<a name="line-194"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>TensorData</span> <span class='hs-layout'>(</span><span class='hs-varid'>map</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>dims</span><span class='hs-layout'>)</span> <span class='hs-varid'>dtype</span> <span class='hs-varid'>v</span>
<a name="line-195"></a>
<a name="line-196"></a><a name="checkStatus"></a><span class='hs-comment'>-- | Runs the given action which does FFI calls updating a provided</span>
<a name="line-197"></a><span class='hs-comment'>-- status object. If the status is not OK it is thrown as</span>
<a name="line-198"></a><span class='hs-comment'>-- TensorFlowException.</span>
<a name="line-199"></a><span class='hs-definition'>checkStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-200"></a><span class='hs-definition'>checkStatus</span> <span class='hs-varid'>fn</span> <span class='hs-keyglyph'>=</span>
<a name="line-201"></a> <span class='hs-varid'>bracket</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>newStatus</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteStatus</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-202"></a> <span class='hs-varid'>result</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>fn</span> <span class='hs-varid'>status</span>
<a name="line-203"></a> <span class='hs-varid'>code</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>getCode</span> <span class='hs-varid'>status</span>
<a name="line-204"></a> <span class='hs-varid'>when</span> <span class='hs-layout'>(</span><span class='hs-varid'>code</span> <span class='hs-varop'>/=</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>TF_OK</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
<a name="line-205"></a> <span class='hs-varid'>msg</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>T</span><span class='hs-varop'>.</span><span class='hs-varid'>decodeUtf8With</span> <span class='hs-conid'>T</span><span class='hs-varop'>.</span><span class='hs-varid'>lenientDecode</span> <span class='hs-varop'>&lt;$&gt;</span>
<a name="line-206"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>message</span> <span class='hs-varid'>status</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>packCString</span><span class='hs-layout'>)</span>
<a name="line-207"></a> <span class='hs-varid'>throwIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>TensorFlowException</span> <span class='hs-varid'>code</span> <span class='hs-varid'>msg</span>
<a name="line-208"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>result</span>
<a name="line-209"></a>
<a name="line-210"></a><a name="setSessionConfig"></a><span class='hs-definition'>setSessionConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ConfigProto</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-211"></a><span class='hs-definition'>setSessionConfig</span> <span class='hs-varid'>pb</span> <span class='hs-varid'>opt</span> <span class='hs-keyglyph'>=</span>
<a name="line-212"></a> <span class='hs-varid'>useProtoAsVoidPtrLen</span> <span class='hs-varid'>pb</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>ptr</span> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-213"></a> <span class='hs-varid'>checkStatus</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>setConfig</span> <span class='hs-varid'>opt</span> <span class='hs-varid'>ptr</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-214"></a>
<a name="line-215"></a><a name="setSessionTarget"></a><span class='hs-definition'>setSessionTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-216"></a><span class='hs-definition'>setSessionTarget</span> <span class='hs-varid'>target</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>useAsCString</span> <span class='hs-varid'>target</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>setTarget</span>
<a name="line-217"></a>
<a name="line-218"></a><a name="useProtoAsVoidPtrLen"></a><span class='hs-comment'>-- | Serializes the given msg and provides it as (ptr,len) argument</span>
<a name="line-219"></a><span class='hs-comment'>-- to the given action.</span>
<a name="line-220"></a><span class='hs-definition'>useProtoAsVoidPtrLen</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Message</span> <span class='hs-varid'>msg</span><span class='hs-layout'>,</span> <span class='hs-conid'>Num</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span>
<a name="line-221"></a> <span class='hs-varid'>msg</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-222"></a><span class='hs-definition'>useProtoAsVoidPtrLen</span> <span class='hs-varid'>msg</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>useAsCStringLen</span> <span class='hs-layout'>(</span><span class='hs-varid'>encodeMessage</span> <span class='hs-varid'>msg</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span>
<a name="line-223"></a> <span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-varid'>bytes</span><span class='hs-layout'>,</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span> <span class='hs-layout'>(</span><span class='hs-varid'>castPtr</span> <span class='hs-varid'>bytes</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-224"></a>
<a name="line-225"></a><a name="getAllOpList"></a><span class='hs-comment'>-- | Returns the serialized OpList of all OpDefs defined in this</span>
<a name="line-226"></a><span class='hs-comment'>-- address space.</span>
<a name="line-227"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span>
<a name="line-228"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-229"></a> <span class='hs-varid'>foreignPtr</span> <span class='hs-keyglyph'>&lt;-</span>
<a name="line-230"></a> <span class='hs-varid'>mask_</span> <span class='hs-layout'>(</span><span class='hs-varid'>newForeignPtr</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteBuffer</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>checkCall</span><span class='hs-layout'>)</span>
<a name="line-231"></a> <span class='hs-comment'>-- Makes a copy because it is more reliable than eviscerating</span>
<a name="line-232"></a> <span class='hs-comment'>-- Buffer to steal its memory (including custom deallocator).</span>
<a name="line-233"></a> <span class='hs-varid'>withForeignPtr</span> <span class='hs-varid'>foreignPtr</span> <span class='hs-varop'>$</span>
<a name="line-234"></a> <span class='hs-keyglyph'>\</span><span class='hs-varid'>ptr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>packCStringLen</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-conid'>(,)</span>
<a name="line-235"></a> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>castPtr</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>getBufferData</span> <span class='hs-varid'>ptr</span><span class='hs-layout'>)</span>
<a name="line-236"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>getBufferLength</span> <span class='hs-varid'>ptr</span><span class='hs-layout'>)</span>
<a name="line-237"></a> <span class='hs-keyword'>where</span>
<a name="line-238"></a> <span class='hs-varid'>checkCall</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-239"></a> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>getAllOpList</span>
<a name="line-240"></a> <span class='hs-varid'>when</span> <span class='hs-layout'>(</span><span class='hs-varid'>p</span> <span class='hs-varop'>==</span> <span class='hs-varid'>nullPtr</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>throwIO</span> <span class='hs-varid'>exception</span><span class='hs-layout'>)</span>
<a name="line-241"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>p</span>
<a name="line-242"></a> <span class='hs-varid'>exception</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorFlowException</span>
<a name="line-243"></a> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>TF_UNKNOWN</span> <span class='hs-str'>"GetAllOpList failure, check logs"</span>
</pre></body>
</html>

View file

@ -0,0 +1,514 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>.stack-work/dist/x86_64-linux-dkd1ce2ff9c9560b648268df668d177711/Cabal-1.22.5.0/build/TensorFlow/Internal/Raw.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- GENERATED by C-&gt;Haskell Compiler, version 0.28.1 Switcheroo, 1 April 2016 (Haskell)</span>
<a name="line-2"></a><span class='hs-comment'>-- Edit the ORIGNAL .chs file instead!</span>
<a name="line-3"></a>
<a name="line-4"></a>
<a name="line-5"></a><span class='hs-comment'>{-# LINE 1 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-6"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-7"></a><span class='hs-comment'>--</span>
<a name="line-8"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-9"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-10"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-11"></a><span class='hs-comment'>--</span>
<a name="line-12"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-13"></a><span class='hs-comment'>--</span>
<a name="line-14"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-15"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-16"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-17"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-18"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-19"></a>
<a name="line-20"></a><span class='hs-comment'>{-# LANGUAGE ForeignFunctionInterface #-}</span>
<a name="line-21"></a>
<a name="line-22"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span> <span class='hs-keyword'>where</span>
<a name="line-23"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>C</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>C2HSImp</span>
<a name="line-24"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>C2HSImp</span>
<a name="line-25"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Storable</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>C2HSImp</span>
<a name="line-26"></a>
<a name="line-27"></a>
<a name="line-28"></a>
<a name="line-29"></a>
<a name="line-30"></a>
<a name="line-31"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>C</span>
<a name="line-33"></a>
<a name="line-34"></a><a name="DataType"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>DataType</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FLOAT</span>
<a name="line-35"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_DOUBLE</span>
<a name="line-36"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INT32</span>
<a name="line-37"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UINT8</span>
<a name="line-38"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INT16</span>
<a name="line-39"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INT8</span>
<a name="line-40"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_STRING</span>
<a name="line-41"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_COMPLEX64</span>
<a name="line-42"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_COMPLEX</span>
<a name="line-43"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INT64</span>
<a name="line-44"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_BOOL</span>
<a name="line-45"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_QINT8</span>
<a name="line-46"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_QUINT8</span>
<a name="line-47"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_QINT32</span>
<a name="line-48"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_BFLOAT16</span>
<a name="line-49"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_QINT16</span>
<a name="line-50"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_QUINT16</span>
<a name="line-51"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UINT16</span>
<a name="line-52"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_COMPLEX128</span>
<a name="line-53"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_HALF</span>
<a name="line-54"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_RESOURCE</span>
<a name="line-55"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span><span class='hs-layout'>,</span><span class='hs-conid'>Eq</span><span class='hs-layout'>)</span>
<a name="line-56"></a><a name="instance%20Enum%20DataType"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Enum</span> <span class='hs-conid'>DataType</span> <span class='hs-keyword'>where</span>
<a name="line-57"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_FLOAT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DOUBLE</span>
<a name="line-58"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_DOUBLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT32</span>
<a name="line-59"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT8</span>
<a name="line-60"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT16</span>
<a name="line-61"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT8</span>
<a name="line-62"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_STRING</span>
<a name="line-63"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_STRING</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX64</span>
<a name="line-64"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_COMPLEX64</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT64</span>
<a name="line-65"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_COMPLEX</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT64</span>
<a name="line-66"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INT64</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BOOL</span>
<a name="line-67"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_BOOL</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT8</span>
<a name="line-68"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_QINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT8</span>
<a name="line-69"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_QUINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT32</span>
<a name="line-70"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_QINT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BFLOAT16</span>
<a name="line-71"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_BFLOAT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT16</span>
<a name="line-72"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_QINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT16</span>
<a name="line-73"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_QUINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT16</span>
<a name="line-74"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX128</span>
<a name="line-75"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_COMPLEX128</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_HALF</span>
<a name="line-76"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_HALF</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_RESOURCE</span>
<a name="line-77"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_RESOURCE</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"DataType.succ: TF_RESOURCE has no successor"</span>
<a name="line-78"></a>
<a name="line-79"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_DOUBLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FLOAT</span>
<a name="line-80"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DOUBLE</span>
<a name="line-81"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT32</span>
<a name="line-82"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT8</span>
<a name="line-83"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT16</span>
<a name="line-84"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_STRING</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT8</span>
<a name="line-85"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_COMPLEX64</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_STRING</span>
<a name="line-86"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_COMPLEX</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_STRING</span>
<a name="line-87"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INT64</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX64</span>
<a name="line-88"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_BOOL</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT64</span>
<a name="line-89"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_QINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BOOL</span>
<a name="line-90"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_QUINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT8</span>
<a name="line-91"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_QINT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT8</span>
<a name="line-92"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_BFLOAT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT32</span>
<a name="line-93"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_QINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BFLOAT16</span>
<a name="line-94"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_QUINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT16</span>
<a name="line-95"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT16</span>
<a name="line-96"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_COMPLEX128</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT16</span>
<a name="line-97"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_HALF</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX128</span>
<a name="line-98"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_RESOURCE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_HALF</span>
<a name="line-99"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_FLOAT</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"DataType.pred: TF_FLOAT has no predecessor"</span>
<a name="line-100"></a>
<a name="line-101"></a> <span class='hs-varid'>enumFromTo</span> <span class='hs-varid'>from</span> <span class='hs-varid'>to</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>go</span> <span class='hs-varid'>from</span>
<a name="line-102"></a> <span class='hs-keyword'>where</span>
<a name="line-103"></a> <span class='hs-varid'>end</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varid'>to</span>
<a name="line-104"></a> <span class='hs-varid'>go</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>compare</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromEnum</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span> <span class='hs-varid'>end</span> <span class='hs-keyword'>of</span>
<a name="line-105"></a> <span class='hs-conid'>LT</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>v</span> <span class='hs-conop'>:</span> <span class='hs-varid'>go</span> <span class='hs-layout'>(</span><span class='hs-varid'>succ</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span>
<a name="line-106"></a> <span class='hs-conid'>EQ</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>v</span><span class='hs-keyglyph'>]</span>
<a name="line-107"></a> <span class='hs-conid'>GT</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>[]</span>
<a name="line-108"></a>
<a name="line-109"></a> <span class='hs-varid'>enumFrom</span> <span class='hs-varid'>from</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>enumFromTo</span> <span class='hs-varid'>from</span> <span class='hs-conid'>TF_RESOURCE</span>
<a name="line-110"></a>
<a name="line-111"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_FLOAT</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>1</span>
<a name="line-112"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_DOUBLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>2</span>
<a name="line-113"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>3</span>
<a name="line-114"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>4</span>
<a name="line-115"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>5</span>
<a name="line-116"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>6</span>
<a name="line-117"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_STRING</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>7</span>
<a name="line-118"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_COMPLEX64</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>8</span>
<a name="line-119"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_COMPLEX</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>8</span>
<a name="line-120"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INT64</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>9</span>
<a name="line-121"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_BOOL</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>10</span>
<a name="line-122"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_QINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>11</span>
<a name="line-123"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_QUINT8</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>12</span>
<a name="line-124"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_QINT32</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>13</span>
<a name="line-125"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_BFLOAT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>14</span>
<a name="line-126"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_QINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>15</span>
<a name="line-127"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_QUINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>16</span>
<a name="line-128"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UINT16</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>17</span>
<a name="line-129"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_COMPLEX128</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>18</span>
<a name="line-130"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_HALF</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>19</span>
<a name="line-131"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_RESOURCE</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>20</span>
<a name="line-132"></a>
<a name="line-133"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>1</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FLOAT</span>
<a name="line-134"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>2</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DOUBLE</span>
<a name="line-135"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>3</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT32</span>
<a name="line-136"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>4</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT8</span>
<a name="line-137"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>5</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT16</span>
<a name="line-138"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>6</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT8</span>
<a name="line-139"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>7</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_STRING</span>
<a name="line-140"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX64</span>
<a name="line-141"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>9</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INT64</span>
<a name="line-142"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>10</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BOOL</span>
<a name="line-143"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>11</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT8</span>
<a name="line-144"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>12</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT8</span>
<a name="line-145"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>13</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT32</span>
<a name="line-146"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>14</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_BFLOAT16</span>
<a name="line-147"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>15</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QINT16</span>
<a name="line-148"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_QUINT16</span>
<a name="line-149"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>17</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UINT16</span>
<a name="line-150"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>18</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_COMPLEX128</span>
<a name="line-151"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>19</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_HALF</span>
<a name="line-152"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>20</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_RESOURCE</span>
<a name="line-153"></a> <span class='hs-varid'>toEnum</span> <span class='hs-varid'>unmatched</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"DataType.toEnum: Cannot match "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>unmatched</span><span class='hs-layout'>)</span>
<a name="line-154"></a>
<a name="line-155"></a><span class='hs-comment'>{-# LINE 24 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-156"></a>
<a name="line-157"></a><a name="Code"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Code</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OK</span>
<a name="line-158"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_CANCELLED</span>
<a name="line-159"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UNKNOWN</span>
<a name="line-160"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span>
<a name="line-161"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span>
<a name="line-162"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_NOT_FOUND</span>
<a name="line-163"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span>
<a name="line-164"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span>
<a name="line-165"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span>
<a name="line-166"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span>
<a name="line-167"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_ABORTED</span>
<a name="line-168"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span>
<a name="line-169"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span>
<a name="line-170"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_INTERNAL</span>
<a name="line-171"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UNAVAILABLE</span>
<a name="line-172"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_DATA_LOSS</span>
<a name="line-173"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span>
<a name="line-174"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span><span class='hs-layout'>,</span><span class='hs-conid'>Eq</span><span class='hs-layout'>)</span>
<a name="line-175"></a><a name="instance%20Enum%20Code"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Enum</span> <span class='hs-conid'>Code</span> <span class='hs-keyword'>where</span>
<a name="line-176"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_OK</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_CANCELLED</span>
<a name="line-177"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_CANCELLED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNKNOWN</span>
<a name="line-178"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UNKNOWN</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span>
<a name="line-179"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span>
<a name="line-180"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_NOT_FOUND</span>
<a name="line-181"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_NOT_FOUND</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span>
<a name="line-182"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span>
<a name="line-183"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span>
<a name="line-184"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span>
<a name="line-185"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ABORTED</span>
<a name="line-186"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_ABORTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span>
<a name="line-187"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span>
<a name="line-188"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INTERNAL</span>
<a name="line-189"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_INTERNAL</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNAVAILABLE</span>
<a name="line-190"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UNAVAILABLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DATA_LOSS</span>
<a name="line-191"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_DATA_LOSS</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span>
<a name="line-192"></a> <span class='hs-varid'>succ</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"Code.succ: TF_UNAUTHENTICATED has no successor"</span>
<a name="line-193"></a>
<a name="line-194"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_CANCELLED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OK</span>
<a name="line-195"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UNKNOWN</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_CANCELLED</span>
<a name="line-196"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNKNOWN</span>
<a name="line-197"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span>
<a name="line-198"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_NOT_FOUND</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span>
<a name="line-199"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_NOT_FOUND</span>
<a name="line-200"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span>
<a name="line-201"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span>
<a name="line-202"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span>
<a name="line-203"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_ABORTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span>
<a name="line-204"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ABORTED</span>
<a name="line-205"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span>
<a name="line-206"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_INTERNAL</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span>
<a name="line-207"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UNAVAILABLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INTERNAL</span>
<a name="line-208"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_DATA_LOSS</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNAVAILABLE</span>
<a name="line-209"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DATA_LOSS</span>
<a name="line-210"></a> <span class='hs-varid'>pred</span> <span class='hs-conid'>TF_OK</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"Code.pred: TF_OK has no predecessor"</span>
<a name="line-211"></a>
<a name="line-212"></a> <span class='hs-varid'>enumFromTo</span> <span class='hs-varid'>from</span> <span class='hs-varid'>to</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>go</span> <span class='hs-varid'>from</span>
<a name="line-213"></a> <span class='hs-keyword'>where</span>
<a name="line-214"></a> <span class='hs-varid'>end</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varid'>to</span>
<a name="line-215"></a> <span class='hs-varid'>go</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>compare</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromEnum</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span> <span class='hs-varid'>end</span> <span class='hs-keyword'>of</span>
<a name="line-216"></a> <span class='hs-conid'>LT</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>v</span> <span class='hs-conop'>:</span> <span class='hs-varid'>go</span> <span class='hs-layout'>(</span><span class='hs-varid'>succ</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span>
<a name="line-217"></a> <span class='hs-conid'>EQ</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>v</span><span class='hs-keyglyph'>]</span>
<a name="line-218"></a> <span class='hs-conid'>GT</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>[]</span>
<a name="line-219"></a>
<a name="line-220"></a> <span class='hs-varid'>enumFrom</span> <span class='hs-varid'>from</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>enumFromTo</span> <span class='hs-varid'>from</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span>
<a name="line-221"></a>
<a name="line-222"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_OK</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>0</span>
<a name="line-223"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_CANCELLED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>1</span>
<a name="line-224"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UNKNOWN</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>2</span>
<a name="line-225"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>3</span>
<a name="line-226"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>4</span>
<a name="line-227"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_NOT_FOUND</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>5</span>
<a name="line-228"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>6</span>
<a name="line-229"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>7</span>
<a name="line-230"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>8</span>
<a name="line-231"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>9</span>
<a name="line-232"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_ABORTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>10</span>
<a name="line-233"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>11</span>
<a name="line-234"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>12</span>
<a name="line-235"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_INTERNAL</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>13</span>
<a name="line-236"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UNAVAILABLE</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>14</span>
<a name="line-237"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_DATA_LOSS</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>15</span>
<a name="line-238"></a> <span class='hs-varid'>fromEnum</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>16</span>
<a name="line-239"></a>
<a name="line-240"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OK</span>
<a name="line-241"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>1</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_CANCELLED</span>
<a name="line-242"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>2</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNKNOWN</span>
<a name="line-243"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>3</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INVALID_ARGUMENT</span>
<a name="line-244"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>4</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DEADLINE_EXCEEDED</span>
<a name="line-245"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>5</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_NOT_FOUND</span>
<a name="line-246"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>6</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ALREADY_EXISTS</span>
<a name="line-247"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>7</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_PERMISSION_DENIED</span>
<a name="line-248"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_RESOURCE_EXHAUSTED</span>
<a name="line-249"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>9</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_FAILED_PRECONDITION</span>
<a name="line-250"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>10</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_ABORTED</span>
<a name="line-251"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>11</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_OUT_OF_RANGE</span>
<a name="line-252"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>12</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNIMPLEMENTED</span>
<a name="line-253"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>13</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_INTERNAL</span>
<a name="line-254"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>14</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNAVAILABLE</span>
<a name="line-255"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>15</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_DATA_LOSS</span>
<a name="line-256"></a> <span class='hs-varid'>toEnum</span> <span class='hs-num'>16</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TF_UNAUTHENTICATED</span>
<a name="line-257"></a> <span class='hs-varid'>toEnum</span> <span class='hs-varid'>unmatched</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"Code.toEnum: Cannot match "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>unmatched</span><span class='hs-layout'>)</span>
<a name="line-258"></a>
<a name="line-259"></a><span class='hs-comment'>{-# LINE 25 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-260"></a>
<a name="line-261"></a>
<a name="line-262"></a>
<a name="line-263"></a><a name="Status"></a><span class='hs-comment'>-- Status.</span>
<a name="line-264"></a><a name="Status"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Status</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-265"></a><span class='hs-comment'>{-# LINE 29 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-266"></a>
<a name="line-267"></a>
<a name="line-268"></a><a name="newStatus"></a><span class='hs-definition'>newStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Status</span>
<a name="line-269"></a><span class='hs-definition'>newStatus</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewStatus</span>
<a name="line-270"></a><span class='hs-comment'>{-# LINE 32 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-271"></a>
<a name="line-272"></a>
<a name="line-273"></a><a name="deleteStatus"></a><span class='hs-definition'>deleteStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-274"></a><span class='hs-definition'>deleteStatus</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteStatus</span>
<a name="line-275"></a><span class='hs-comment'>{-# LINE 35 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-276"></a>
<a name="line-277"></a>
<a name="line-278"></a><a name="setStatus"></a><span class='hs-definition'>setStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Code</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-279"></a><span class='hs-definition'>setStatus</span> <span class='hs-varid'>s</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFSetStatus</span> <span class='hs-varid'>s</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-280"></a>
<a name="line-281"></a><a name="getCode"></a><span class='hs-definition'>getCode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Code</span>
<a name="line-282"></a><span class='hs-definition'>getCode</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>toEnum</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>tFGetCode</span> <span class='hs-varid'>s</span>
<a name="line-283"></a>
<a name="line-284"></a><a name="message"></a><span class='hs-definition'>message</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>CString</span>
<a name="line-285"></a><span class='hs-definition'>message</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFMessage</span>
<a name="line-286"></a><span class='hs-comment'>{-# LINE 44 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-287"></a>
<a name="line-288"></a>
<a name="line-289"></a>
<a name="line-290"></a><a name="Buffer"></a><span class='hs-comment'>-- Buffer.</span>
<a name="line-291"></a><a name="Buffer"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Buffer</span>
<a name="line-292"></a><a name="BufferPtr"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Buffer</span><span class='hs-layout'>)</span>
<a name="line-293"></a><span class='hs-comment'>{-# LINE 49 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-294"></a>
<a name="line-295"></a>
<a name="line-296"></a><a name="getBufferData"></a><span class='hs-definition'>getBufferData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span>
<a name="line-297"></a><span class='hs-definition'>getBufferData</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>ptr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span> <span class='hs-layout'>{</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-varid'>peekByteOff</span> <span class='hs-varid'>ptr</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-298"></a><span class='hs-comment'>{-# LINE 52 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-299"></a>
<a name="line-300"></a>
<a name="line-301"></a><a name="getBufferLength"></a><span class='hs-definition'>getBufferLength</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>CULong</span>
<a name="line-302"></a><span class='hs-definition'>getBufferLength</span> <span class='hs-keyglyph'>=</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>ptr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span> <span class='hs-layout'>{</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-varid'>peekByteOff</span> <span class='hs-varid'>ptr</span> <span class='hs-num'>8</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-303"></a><span class='hs-comment'>{-# LINE 55 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-304"></a>
<a name="line-305"></a>
<a name="line-306"></a><a name="Tensor"></a><span class='hs-comment'>-- Tensor.</span>
<a name="line-307"></a><a name="Tensor"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Tensor</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-308"></a><span class='hs-comment'>{-# LINE 58 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-309"></a>
<a name="line-310"></a>
<a name="line-311"></a><a name="instance%20Storable%20Tensor"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Storable</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyword'>where</span>
<a name="line-312"></a> <span class='hs-varid'>sizeOf</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>sizeOf</span> <span class='hs-varid'>t</span>
<a name="line-313"></a> <span class='hs-varid'>alignment</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>alignment</span> <span class='hs-varid'>t</span>
<a name="line-314"></a> <span class='hs-varid'>peek</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-conid'>Tensor</span> <span class='hs-layout'>(</span><span class='hs-varid'>peek</span> <span class='hs-layout'>(</span><span class='hs-varid'>castPtr</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-315"></a> <span class='hs-varid'>poke</span> <span class='hs-varid'>p</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>poke</span> <span class='hs-layout'>(</span><span class='hs-varid'>castPtr</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span>
<a name="line-316"></a>
<a name="line-317"></a><a name="newTensor"></a><span class='hs-definition'>newTensor</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>DataType</span>
<a name="line-318"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CLong</span> <span class='hs-comment'>-- dimensions array</span>
<a name="line-319"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-comment'>-- num dimensions</span>
<a name="line-320"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-comment'>-- data</span>
<a name="line-321"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-comment'>-- data len</span>
<a name="line-322"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>FunPtr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-comment'>-- deallocator</span>
<a name="line-323"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-comment'>-- deallocator arg</span>
<a name="line-324"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Tensor</span>
<a name="line-325"></a><span class='hs-definition'>newTensor</span> <span class='hs-varid'>dt</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewTensor</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fromEnum</span> <span class='hs-varid'>dt</span><span class='hs-layout'>)</span>
<a name="line-326"></a>
<a name="line-327"></a><a name="deleteTensor"></a><span class='hs-definition'>deleteTensor</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-328"></a><span class='hs-definition'>deleteTensor</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteTensor</span>
<a name="line-329"></a><span class='hs-comment'>{-# LINE 77 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-330"></a>
<a name="line-331"></a>
<a name="line-332"></a><a name="tensorType"></a><span class='hs-definition'>tensorType</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>DataType</span>
<a name="line-333"></a><span class='hs-definition'>tensorType</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>toEnum</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>tFTensorType</span> <span class='hs-varid'>t</span>
<a name="line-334"></a>
<a name="line-335"></a><a name="numDims"></a><span class='hs-definition'>numDims</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>CInt</span>
<a name="line-336"></a><span class='hs-definition'>numDims</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNumDims</span>
<a name="line-337"></a><span class='hs-comment'>{-# LINE 83 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-338"></a>
<a name="line-339"></a>
<a name="line-340"></a><a name="dim"></a><span class='hs-definition'>dim</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>CLong</span>
<a name="line-341"></a><span class='hs-definition'>dim</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDim</span>
<a name="line-342"></a><span class='hs-comment'>{-# LINE 86 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-343"></a>
<a name="line-344"></a>
<a name="line-345"></a><a name="tensorByteSize"></a><span class='hs-definition'>tensorByteSize</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>CULong</span>
<a name="line-346"></a><span class='hs-definition'>tensorByteSize</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFTensorByteSize</span>
<a name="line-347"></a><span class='hs-comment'>{-# LINE 89 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-348"></a>
<a name="line-349"></a>
<a name="line-350"></a><a name="tensorData"></a><span class='hs-definition'>tensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span>
<a name="line-351"></a><span class='hs-definition'>tensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFTensorData</span>
<a name="line-352"></a><span class='hs-comment'>{-# LINE 92 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-353"></a>
<a name="line-354"></a>
<a name="line-355"></a>
<a name="line-356"></a><a name="SessionOptions"></a><span class='hs-comment'>-- Session Options.</span>
<a name="line-357"></a><a name="SessionOptions"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-358"></a><span class='hs-comment'>{-# LINE 96 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-359"></a>
<a name="line-360"></a>
<a name="line-361"></a><a name="newSessionOptions"></a><span class='hs-definition'>newSessionOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>SessionOptions</span>
<a name="line-362"></a><span class='hs-definition'>newSessionOptions</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewSessionOptions</span>
<a name="line-363"></a><span class='hs-comment'>{-# LINE 99 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-364"></a>
<a name="line-365"></a>
<a name="line-366"></a><a name="setTarget"></a><span class='hs-definition'>setTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-367"></a><span class='hs-definition'>setTarget</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFSetTarget</span>
<a name="line-368"></a><span class='hs-comment'>{-# LINE 102 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-369"></a>
<a name="line-370"></a>
<a name="line-371"></a><a name="setConfig"></a><span class='hs-definition'>setConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-372"></a><span class='hs-definition'>setConfig</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFSetConfig</span>
<a name="line-373"></a><span class='hs-comment'>{-# LINE 105 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-374"></a>
<a name="line-375"></a>
<a name="line-376"></a><a name="deleteSessionOptions"></a><span class='hs-definition'>deleteSessionOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-377"></a><span class='hs-definition'>deleteSessionOptions</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteSessionOptions</span>
<a name="line-378"></a><span class='hs-comment'>{-# LINE 108 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-379"></a>
<a name="line-380"></a>
<a name="line-381"></a>
<a name="line-382"></a><a name="Session"></a><span class='hs-comment'>-- Session.</span>
<a name="line-383"></a><a name="Session"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Session</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Session</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-384"></a><span class='hs-comment'>{-# LINE 112 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-385"></a>
<a name="line-386"></a>
<a name="line-387"></a><a name="newSession"></a><span class='hs-definition'>newSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Session</span>
<a name="line-388"></a><span class='hs-definition'>newSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewSession</span>
<a name="line-389"></a><span class='hs-comment'>{-# LINE 115 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-390"></a>
<a name="line-391"></a>
<a name="line-392"></a><a name="closeSession"></a><span class='hs-definition'>closeSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-393"></a><span class='hs-definition'>closeSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFCloseSession</span>
<a name="line-394"></a><span class='hs-comment'>{-# LINE 118 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-395"></a>
<a name="line-396"></a>
<a name="line-397"></a><a name="deleteSession"></a><span class='hs-definition'>deleteSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-398"></a><span class='hs-definition'>deleteSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteSession</span>
<a name="line-399"></a><span class='hs-comment'>{-# LINE 121 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-400"></a>
<a name="line-401"></a>
<a name="line-402"></a><a name="extendGraph"></a><span class='hs-definition'>extendGraph</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-403"></a><span class='hs-definition'>extendGraph</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFExtendGraph</span>
<a name="line-404"></a><span class='hs-comment'>{-# LINE 124 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-405"></a>
<a name="line-406"></a>
<a name="line-407"></a><a name="run"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span>
<a name="line-408"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-comment'>-- RunOptions proto.</span>
<a name="line-409"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-comment'>-- Input (names, tensors, count).</span>
<a name="line-410"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>Tensor</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-comment'>-- Output (names, tensors, count).</span>
<a name="line-411"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-comment'>-- Target nodes (names, count).</span>
<a name="line-412"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-comment'>-- RunMetadata proto.</span>
<a name="line-413"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span>
<a name="line-414"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-415"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFRun</span>
<a name="line-416"></a><span class='hs-comment'>{-# LINE 134 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-417"></a>
<a name="line-418"></a>
<a name="line-419"></a><a name="TensorDeallocFn"></a><span class='hs-comment'>-- FFI helpers.</span>
<a name="line-420"></a><a name="TensorDeallocFn"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>TensorDeallocFn</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-421"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-str'>"wrapper"</span>
<a name="line-422"></a> <span class='hs-varid'>wrapTensorDealloc</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorDeallocFn</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>FunPtr</span> <span class='hs-conid'>TensorDeallocFn</span><span class='hs-layout'>)</span>
<a name="line-423"></a>
<a name="line-424"></a>
<a name="line-425"></a><a name="getAllOpList"></a><span class='hs-comment'>-- | Get the OpList of all OpDefs defined in this address space.</span>
<a name="line-426"></a><span class='hs-comment'>-- Returns a BufferPtr, ownership of which is transferred to the caller</span>
<a name="line-427"></a><span class='hs-comment'>-- (and can be freed using deleteBuffer).</span>
<a name="line-428"></a><span class='hs-comment'>--</span>
<a name="line-429"></a><span class='hs-comment'>-- The data in the buffer will be the serialized OpList proto for ops registered</span>
<a name="line-430"></a><span class='hs-comment'>-- in this address space.</span>
<a name="line-431"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>BufferPtr</span>
<a name="line-432"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFGetAllOpList</span>
<a name="line-433"></a><span class='hs-comment'>{-# LINE 149 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-434"></a>
<a name="line-435"></a>
<a name="line-436"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-str'>"&amp;TF_DeleteBuffer"</span>
<a name="line-437"></a> <span class='hs-varid'>deleteBuffer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>FunPtr</span> <span class='hs-layout'>(</span><span class='hs-conid'>BufferPtr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span>
<a name="line-438"></a>
<a name="line-439"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_NewStatus"</span>
<a name="line-440"></a> <span class='hs-varid'>tFNewStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-441"></a>
<a name="line-442"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_DeleteStatus"</span>
<a name="line-443"></a> <span class='hs-varid'>tFDeleteStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-444"></a>
<a name="line-445"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_SetStatus"</span>
<a name="line-446"></a> <span class='hs-varid'>tFSetStatus</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-447"></a>
<a name="line-448"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_GetCode"</span>
<a name="line-449"></a> <span class='hs-varid'>tFGetCode</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-450"></a>
<a name="line-451"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_Message"</span>
<a name="line-452"></a> <span class='hs-varid'>tFMessage</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-453"></a>
<a name="line-454"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_NewTensor"</span>
<a name="line-455"></a> <span class='hs-varid'>tFNewTensor</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CLong</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>FunPtr</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-456"></a>
<a name="line-457"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_DeleteTensor"</span>
<a name="line-458"></a> <span class='hs-varid'>tFDeleteTensor</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-459"></a>
<a name="line-460"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_TensorType"</span>
<a name="line-461"></a> <span class='hs-varid'>tFTensorType</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-462"></a>
<a name="line-463"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_NumDims"</span>
<a name="line-464"></a> <span class='hs-varid'>tFNumDims</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-465"></a>
<a name="line-466"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_Dim"</span>
<a name="line-467"></a> <span class='hs-varid'>tFDim</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CLong</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-468"></a>
<a name="line-469"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_TensorByteSize"</span>
<a name="line-470"></a> <span class='hs-varid'>tFTensorByteSize</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-471"></a>
<a name="line-472"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_TensorData"</span>
<a name="line-473"></a> <span class='hs-varid'>tFTensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-474"></a>
<a name="line-475"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_NewSessionOptions"</span>
<a name="line-476"></a> <span class='hs-varid'>tFNewSessionOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-477"></a>
<a name="line-478"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_SetTarget"</span>
<a name="line-479"></a> <span class='hs-varid'>tFSetTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-480"></a>
<a name="line-481"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_SetConfig"</span>
<a name="line-482"></a> <span class='hs-varid'>tFSetConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-483"></a>
<a name="line-484"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_DeleteSessionOptions"</span>
<a name="line-485"></a> <span class='hs-varid'>tFDeleteSessionOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-486"></a>
<a name="line-487"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_NewSession"</span>
<a name="line-488"></a> <span class='hs-varid'>tFNewSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>SessionOptions</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-489"></a>
<a name="line-490"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_CloseSession"</span>
<a name="line-491"></a> <span class='hs-varid'>tFCloseSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-492"></a>
<a name="line-493"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_DeleteSession"</span>
<a name="line-494"></a> <span class='hs-varid'>tFDeleteSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-495"></a>
<a name="line-496"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_ExtendGraph"</span>
<a name="line-497"></a> <span class='hs-varid'>tFExtendGraph</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CULong</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-498"></a>
<a name="line-499"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_Run"</span>
<a name="line-500"></a> <span class='hs-varid'>tFRun</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Session</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>BufferPtr</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>Ptr</span> <span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CChar</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>C2HSImp</span><span class='hs-varop'>.</span><span class='hs-conid'>CInt</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>BufferPtr</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-conid'>Status</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-501"></a>
<a name="line-502"></a><span class='hs-keyword'>foreign</span> <span class='hs-keyword'>import</span> <span class='hs-keyword'>ccall</span> <span class='hs-keyword'>safe</span> <span class='hs-str'>"TensorFlow/Internal/Raw.chs.h TF_GetAllOpList"</span>
<a name="line-503"></a> <span class='hs-varid'>tFGetAllOpList</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>IO</span> <span class='hs-layout'>(</span><span class='hs-conid'>BufferPtr</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Internal/VarInt.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE BangPatterns #-}</span>
<a name="line-16"></a>
<a name="line-17"></a><span class='hs-comment'>{-|
<a name="line-18"></a>Module : TensorFlow.Internal.VarInt
<a name="line-19"></a>Description : Encoders and decoders for varint types.
<a name="line-20"></a>
<a name="line-21"></a>Originally taken from internal proto-lens code.
<a name="line-22"></a>-}</span>
<a name="line-23"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>VarInt</span>
<a name="line-24"></a> <span class='hs-layout'>(</span> <span class='hs-varid'>getVarInt</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>putVarInt</span>
<a name="line-26"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-27"></a>
<a name="line-28"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Attoparsec</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Parse</span>
<a name="line-29"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Bits</span>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Lazy</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Builder</span>
<a name="line-31"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span> <span class='hs-layout'>(</span><span class='hs-conid'>Word64</span><span class='hs-layout'>)</span>
<a name="line-33"></a>
<a name="line-34"></a><a name="getVarInt"></a><span class='hs-comment'>-- | Decode an unsigned varint.</span>
<a name="line-35"></a><span class='hs-definition'>getVarInt</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Parser</span> <span class='hs-conid'>Word64</span>
<a name="line-36"></a><span class='hs-definition'>getVarInt</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>loop</span> <span class='hs-num'>1</span> <span class='hs-num'>0</span>
<a name="line-37"></a> <span class='hs-keyword'>where</span>
<a name="line-38"></a> <span class='hs-varid'>loop</span> <span class='hs-varop'>!</span><span class='hs-varid'>s</span> <span class='hs-varop'>!</span><span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-39"></a> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>anyWord8</span>
<a name="line-40"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>n'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>n</span> <span class='hs-varop'>+</span> <span class='hs-varid'>s</span> <span class='hs-varop'>*</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-layout'>(</span><span class='hs-varid'>b</span> <span class='hs-varop'>.&amp;.</span> <span class='hs-num'>127</span><span class='hs-layout'>)</span>
<a name="line-41"></a> <span class='hs-keyword'>if</span> <span class='hs-layout'>(</span><span class='hs-varid'>b</span> <span class='hs-varop'>.&amp;.</span> <span class='hs-num'>128</span><span class='hs-layout'>)</span> <span class='hs-varop'>==</span> <span class='hs-num'>0</span>
<a name="line-42"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>return</span> <span class='hs-varid'>n'</span>
<a name="line-43"></a> <span class='hs-keyword'>else</span> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-num'>128</span><span class='hs-varop'>*</span><span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-varid'>n'</span>
<a name="line-44"></a>
<a name="line-45"></a><a name="putVarInt"></a><span class='hs-comment'>-- | Encode a Word64.</span>
<a name="line-46"></a><span class='hs-definition'>putVarInt</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-47"></a><span class='hs-definition'>putVarInt</span> <span class='hs-varid'>n</span>
<a name="line-48"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>n</span> <span class='hs-varop'>&lt;</span> <span class='hs-num'>128</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>word8</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span>
<a name="line-49"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>word8</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-varid'>n</span> <span class='hs-varop'>.&amp;.</span> <span class='hs-num'>127</span> <span class='hs-varop'>.|.</span> <span class='hs-num'>128</span><span class='hs-layout'>)</span>
<a name="line-50"></a> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-varid'>putVarInt</span> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-varop'>`shiftR`</span> <span class='hs-num'>7</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Nodes.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE MultiParamTypeClasses #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE RankNTypes #-}</span>
<a name="line-19"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
<a name="line-20"></a><span class='hs-comment'>{-# LANGUAGE TypeFamilies #-}</span>
<a name="line-21"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Nodes</span> <span class='hs-keyword'>where</span>
<a name="line-22"></a>
<a name="line-23"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Applicative</span> <span class='hs-layout'>(</span><span class='hs-varid'>liftA2</span><span class='hs-layout'>,</span> <span class='hs-varid'>liftA3</span><span class='hs-layout'>)</span>
<a name="line-24"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-layout'>)</span>
<a name="line-25"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-26"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span><span class='hs-layout'>)</span>
<a name="line-27"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span> <span class='hs-layout'>(</span><span class='hs-conid'>IsString</span><span class='hs-layout'>)</span>
<a name="line-28"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-layout'>(</span><span class='hs-conid'>Text</span><span class='hs-layout'>)</span>
<a name="line-29"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>^.</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Map</span>
<a name="line-31"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Set</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>V</span>
<a name="line-33"></a>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Build</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span>
<a name="line-36"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-37"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-38"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>FFI</span>
<a name="line-39"></a>
<a name="line-40"></a><a name="Fetchable"></a><span class='hs-comment'>-- | Types that contain ops which can be run.</span>
<a name="line-41"></a><a name="Fetchable"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyword'>where</span>
<a name="line-42"></a> <span class='hs-varid'>getNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span> <span class='hs-conid'>NodeName</span><span class='hs-layout'>)</span>
<a name="line-43"></a>
<a name="line-44"></a><a name="Fetchable"></a><span class='hs-comment'>-- | Types that tensor representations (e.g. 'Tensor', 'ControlNode') can be</span>
<a name="line-45"></a><a name="Fetchable"></a><span class='hs-comment'>-- fetched into.</span>
<a name="line-46"></a><a name="Fetchable"></a><span class='hs-comment'>--</span>
<a name="line-47"></a><a name="Fetchable"></a><span class='hs-comment'>-- Includes collections of tensors (e.g. tuples).</span>
<a name="line-48"></a><a name="Fetchable"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>where</span>
<a name="line-49"></a> <span class='hs-varid'>getFetch</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetch</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-50"></a>
<a name="line-51"></a><a name="Fetch"></a><span class='hs-comment'>-- | Fetch action. Keeps track of what needs to be fetched and how to decode</span>
<a name="line-52"></a><a name="Fetch"></a><span class='hs-comment'>-- the fetched data.</span>
<a name="line-53"></a><a name="Fetch"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Fetch</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Fetch</span>
<a name="line-54"></a> <span class='hs-layout'>{</span> <span class='hs-comment'>-- | Nodes to fetch</span>
<a name="line-55"></a> <span class='hs-varid'>fetches</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Set</span> <span class='hs-conid'>Text</span>
<a name="line-56"></a> <span class='hs-comment'>-- | Function to create an 'a' from the fetched data.</span>
<a name="line-57"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>fetchRestore</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Map</span> <span class='hs-conid'>Text</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>a</span>
<a name="line-58"></a> <span class='hs-layout'>}</span>
<a name="line-59"></a>
<a name="line-60"></a><a name="instance%20Functor%20Fetch"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Functor</span> <span class='hs-conid'>Fetch</span> <span class='hs-keyword'>where</span>
<a name="line-61"></a> <span class='hs-varid'>fmap</span> <span class='hs-varid'>f</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetch</span> <span class='hs-varid'>fetch</span> <span class='hs-varid'>restore</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Fetch</span> <span class='hs-varid'>fetch</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varop'>.</span> <span class='hs-varid'>restore</span><span class='hs-layout'>)</span>
<a name="line-62"></a>
<a name="line-63"></a><a name="instance%20Applicative%20Fetch"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Applicative</span> <span class='hs-conid'>Fetch</span> <span class='hs-keyword'>where</span>
<a name="line-64"></a> <span class='hs-varid'>pure</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Fetch</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-65"></a> <span class='hs-conid'>Fetch</span> <span class='hs-varid'>fetch</span> <span class='hs-varid'>restore</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-conid'>Fetch</span> <span class='hs-varid'>fetch'</span> <span class='hs-varid'>restore'</span> <span class='hs-keyglyph'>=</span>
<a name="line-66"></a> <span class='hs-conid'>Fetch</span> <span class='hs-layout'>(</span><span class='hs-varid'>fetch</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-varid'>fetch'</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>restore</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>restore'</span><span class='hs-layout'>)</span>
<a name="line-67"></a>
<a name="line-68"></a><a name="nodesUnion"></a><span class='hs-definition'>nodesUnion</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Monoid</span> <span class='hs-varid'>b</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traversable</span> <span class='hs-varid'>t</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span> <span class='hs-varid'>b</span>
<a name="line-69"></a><span class='hs-definition'>nodesUnion</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-varid'>foldMap</span> <span class='hs-varid'>id</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>sequenceA</span>
<a name="line-70"></a>
<a name="line-71"></a><a name="instance%20Nodes%20(t1,%20t2)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>Nodes</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Nodes</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-72"></a> <span class='hs-varid'>getNodes</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>y</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>nodesUnion</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>getNodes</span> <span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>y</span><span class='hs-keyglyph'>]</span>
<a name="line-73"></a>
<a name="line-74"></a><a name="instance%20Nodes%20(t1,%20t2,%20t3)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>Nodes</span> <span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t3</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Nodes</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-75"></a> <span class='hs-varid'>getNodes</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>y</span><span class='hs-layout'>,</span> <span class='hs-varid'>z</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>nodesUnion</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>getNodes</span> <span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>y</span><span class='hs-layout'>,</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>z</span><span class='hs-keyglyph'>]</span>
<a name="line-76"></a>
<a name="line-77"></a><a name="instance%20Fetchable%20(t1,%20t2)%20(a1,%20a2)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t1</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t2</span> <span class='hs-varid'>a2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-78"></a> <span class='hs-varid'>getFetch</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>y</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>liftA2</span> <span class='hs-conid'>(,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>x</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>y</span>
<a name="line-79"></a>
<a name="line-80"></a><a name="instance%20Fetchable%20(t1,%20t2,%20t3)%20(a1,%20a2,%20a3)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t1</span> <span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t2</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t3</span> <span class='hs-varid'>a3</span><span class='hs-layout'>)</span>
<a name="line-81"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-layout'>(</span><span class='hs-varid'>t1</span><span class='hs-layout'>,</span> <span class='hs-varid'>t2</span><span class='hs-layout'>,</span> <span class='hs-varid'>t3</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>a1</span><span class='hs-layout'>,</span> <span class='hs-varid'>a2</span><span class='hs-layout'>,</span> <span class='hs-varid'>a3</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-82"></a> <span class='hs-varid'>getFetch</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-layout'>,</span> <span class='hs-varid'>y</span><span class='hs-layout'>,</span> <span class='hs-varid'>z</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-83"></a> <span class='hs-varid'>liftA3</span> <span class='hs-conid'>(,,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>x</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>y</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>z</span>
<a name="line-84"></a>
<a name="line-85"></a><a name="instance%20Nodes%20%5bt%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Nodes</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>t</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-86"></a> <span class='hs-varid'>getNodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>nodesUnion</span> <span class='hs-varop'>.</span> <span class='hs-varid'>map</span> <span class='hs-varid'>getNodes</span>
<a name="line-87"></a>
<a name="line-88"></a><a name="instance%20Fetchable%20%5bt%5d%20%5ba%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>t</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-89"></a> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>sequenceA</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>mapM</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>ts</span>
<a name="line-90"></a>
<a name="line-91"></a><a name="instance%20Nodes%20ControlNode"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Nodes</span> <span class='hs-conid'>ControlNode</span> <span class='hs-keyword'>where</span>
<a name="line-92"></a> <span class='hs-varid'>getNodes</span> <span class='hs-layout'>(</span><span class='hs-conid'>ControlNode</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>singleton</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-varid'>o</span>
<a name="line-93"></a>
<a name="line-94"></a><a name="instance%20Fetchable%20ControlNode%20a"></a><span class='hs-comment'>-- We use the constraint @(a ~ ())@ to help with type inference. For example,</span>
<a name="line-95"></a><a name="instance%20Fetchable%20ControlNode%20a"></a><span class='hs-comment'>-- if @t :: ControlNode@, then this constraint ensures that @run t :: Session</span>
<a name="line-96"></a><a name="instance%20Fetchable%20ControlNode%20a"></a><span class='hs-comment'>-- ()@. If we used @instance Fetchable ControlNode ()@ instead, then that</span>
<a name="line-97"></a><a name="instance%20Fetchable%20ControlNode%20a"></a><span class='hs-comment'>-- expression would be ambiguous without explicitly specifying the return type.</span>
<a name="line-98"></a><a name="instance%20Fetchable%20ControlNode%20a"></a><span class='hs-keyword'>instance</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-conid'>ControlNode</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>where</span>
<a name="line-99"></a> <span class='hs-varid'>getFetch</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>pure</span> <span class='hs-conid'>()</span>
<a name="line-100"></a>
<a name="line-101"></a><a name="instance%20Nodes%20(Tensor%20v%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Nodes</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-102"></a> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>singleton</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>getOrAddOp</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-varop'>.</span> <span class='hs-varid'>outputOp</span><span class='hs-layout'>)</span>
<a name="line-103"></a>
<a name="line-104"></a><a name="fetchTensorList"></a><span class='hs-definition'>fetchTensorList</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetch</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-105"></a><span class='hs-definition'>fetchTensorList</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-varid'>fmap</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>fetchTensorVector</span> <span class='hs-varid'>t</span>
<a name="line-106"></a>
<a name="line-107"></a><a name="fetchTensorVector"></a><span class='hs-definition'>fetchTensorVector</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varid'>v</span> <span class='hs-varop'>.</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span>
<a name="line-108"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetch</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span><span class='hs-layout'>,</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-109"></a><span class='hs-definition'>fetchTensorVector</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-110"></a> <span class='hs-varid'>outputName</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>renderOutput</span> <span class='hs-varid'>o</span>
<a name="line-111"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Fetch</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>singleton</span> <span class='hs-varid'>outputName</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>tensors</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-112"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>tensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensors</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.!</span> <span class='hs-varid'>outputName</span>
<a name="line-113"></a> <span class='hs-varid'>shape</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Shape</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorDataDimensions</span> <span class='hs-varid'>tensorData</span>
<a name="line-114"></a> <span class='hs-varid'>vec</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>decodeTensorData</span> <span class='hs-varop'>$</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>tensorData</span>
<a name="line-115"></a>
<a name="line-116"></a> <span class='hs-varid'>expectedType</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorType</span> <span class='hs-layout'>(</span><span class='hs-varid'>undefined</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-117"></a> <span class='hs-varid'>actualType</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorDataType</span> <span class='hs-varid'>tensorData</span>
<a name="line-118"></a> <span class='hs-varid'>badTypeError</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-varop'>$</span> <span class='hs-str'>"Bad tensor type: expected "</span>
<a name="line-119"></a> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>expectedType</span>
<a name="line-120"></a> <span class='hs-varop'>++</span> <span class='hs-str'>", got "</span>
<a name="line-121"></a> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>actualType</span>
<a name="line-122"></a> <span class='hs-keyword'>in</span> <span class='hs-keyword'>if</span> <span class='hs-varid'>expectedType</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>actualType</span>
<a name="line-123"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>badTypeError</span>
<a name="line-124"></a> <span class='hs-keyword'>else</span> <span class='hs-layout'>(</span><span class='hs-varid'>shape</span><span class='hs-layout'>,</span> <span class='hs-varid'>vec</span><span class='hs-layout'>)</span>
<a name="line-125"></a>
<a name="line-126"></a><a name="instance%20Fetchable%20(Tensor%20v%20a)%20(V.Vector%20a')"></a><span class='hs-comment'>-- The constraint "a ~ a'" means that the input/output of fetch can constrain</span>
<a name="line-127"></a><a name="instance%20Fetchable%20(Tensor%20v%20a)%20(V.Vector%20a')"></a><span class='hs-comment'>-- the TensorType of each other.</span>
<a name="line-128"></a><a name="instance%20Fetchable%20(Tensor%20v%20a)%20(V.Vector%20a')"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-varid'>a'</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a'</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-129"></a> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-varid'>snd</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>fetchTensorVector</span> <span class='hs-varid'>t</span>
<a name="line-130"></a>
<a name="line-131"></a><a name="Scalar"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Scalar</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Scalar</span> <span class='hs-layout'>{</span><span class='hs-varid'>unScalar</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span><span class='hs-layout'>}</span>
<a name="line-132"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span><span class='hs-layout'>,</span> <span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Num</span><span class='hs-layout'>,</span> <span class='hs-conid'>Fractional</span><span class='hs-layout'>,</span> <span class='hs-conid'>Floating</span><span class='hs-layout'>,</span> <span class='hs-conid'>Real</span><span class='hs-layout'>,</span> <span class='hs-conid'>RealFloat</span><span class='hs-layout'>,</span>
<a name="line-133"></a> <span class='hs-conid'>RealFrac</span><span class='hs-layout'>,</span> <span class='hs-conid'>IsString</span><span class='hs-layout'>)</span>
<a name="line-134"></a>
<a name="line-135"></a><a name="instance%20Fetchable%20(Tensor%20v%20a)%20(Scalar%20a')"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-varid'>a'</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Fetchable</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>Scalar</span> <span class='hs-varid'>a'</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-136"></a> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-conid'>Scalar</span> <span class='hs-varop'>.</span> <span class='hs-varid'>headFromSingleton</span> <span class='hs-varop'>.</span> <span class='hs-varid'>snd</span><span class='hs-layout'>)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>fetchTensorList</span> <span class='hs-varid'>t</span>
<a name="line-137"></a> <span class='hs-keyword'>where</span>
<a name="line-138"></a> <span class='hs-varid'>headFromSingleton</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span>
<a name="line-139"></a> <span class='hs-varid'>headFromSingleton</span> <span class='hs-varid'>xs</span>
<a name="line-140"></a> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-varop'>$</span> <span class='hs-str'>"Unable to extract singleton from tensor of length "</span>
<a name="line-141"></a> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>length</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Orphans.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE StandaloneDeriving #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# OPTIONS_GHC -fno-warn-orphans #-}</span>
<a name="line-18"></a><span class='hs-comment'>-- Orphan instances for certain proto messages/enums, used internally.</span>
<a name="line-19"></a><span class='hs-comment'>-- TODO(judahjacobson): consider making proto-lens generate some or all of</span>
<a name="line-20"></a><span class='hs-comment'>-- these automatically; or, alternately, make new Haskell datatypes.</span>
<a name="line-21"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Orphans</span><span class='hs-conid'>()</span> <span class='hs-keyword'>where</span>
<a name="line-22"></a>
<a name="line-23"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>AttrValue</span>
<a name="line-24"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>AttrValue</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>AttrValue'ListValue</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>NameAttrList</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-27"></a> <span class='hs-layout'>)</span>
<a name="line-28"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>NodeDef</span>
<a name="line-29"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>NodeDef</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>ResourceHandle</span>
<a name="line-31"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>ResourceHandle</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-32"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-33"></a> <span class='hs-layout'>(</span><span class='hs-conid'>TensorProto</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-34"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorShape</span>
<a name="line-35"></a> <span class='hs-layout'>(</span><span class='hs-conid'>TensorShapeProto</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-conid'>TensorShapeProto'Dim</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-36"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-layout'>(</span><span class='hs-conid'>DataType</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-37"></a>
<a name="line-38"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>AttrValue</span>
<a name="line-39"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>AttrValue'ListValue</span>
<a name="line-40"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>DataType</span>
<a name="line-41"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>NameAttrList</span>
<a name="line-42"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>NodeDef</span>
<a name="line-43"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>ResourceHandle</span>
<a name="line-44"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>TensorProto</span>
<a name="line-45"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>TensorShapeProto</span>
<a name="line-46"></a><span class='hs-keyword'>deriving</span> <span class='hs-keyword'>instance</span> <span class='hs-conid'>Ord</span> <span class='hs-conid'>TensorShapeProto'Dim</span>
</pre></body>
</html>

View file

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Output.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-18"></a>
<a name="line-19"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span>
<a name="line-20"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>ControlNode</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-21"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Device</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-22"></a> <span class='hs-comment'>-- * Ops</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>NodeName</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-24"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Op</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opUnrendered</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpDef</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opName</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opType</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opAttr</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opInputs</span>
<a name="line-31"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opControlInputs</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpType</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-33"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OutputIx</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Output</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>output</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>outputIndex</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>outputOp</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>PendingNodeName</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-39"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-40"></a>
<a name="line-41"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Map</span>
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ProtoLens</span><span class='hs-varop'>.</span><span class='hs-conid'>TextFormat</span> <span class='hs-layout'>(</span><span class='hs-varid'>showMessage</span><span class='hs-layout'>)</span>
<a name="line-43"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span> <span class='hs-layout'>(</span><span class='hs-conid'>IsString</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-layout'>(</span><span class='hs-conid'>Text</span><span class='hs-layout'>)</span>
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Text</span>
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-conid'>Lens'</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traversal'</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.~</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>^.</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span><span class='hs-varop'>.</span><span class='hs-conid'>Unchecked</span> <span class='hs-layout'>(</span><span class='hs-varid'>lens</span><span class='hs-layout'>)</span>
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>AttrValue</span> <span class='hs-layout'>(</span><span class='hs-conid'>AttrValue</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>NodeDef</span> <span class='hs-layout'>(</span><span class='hs-conid'>NodeDef</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>name</span><span class='hs-layout'>)</span>
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Default</span> <span class='hs-layout'>(</span><span class='hs-varid'>def</span><span class='hs-layout'>)</span>
<a name="line-51"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-layout'>(</span><span class='hs-conid'>Attribute</span><span class='hs-layout'>,</span> <span class='hs-varid'>attrLens</span><span class='hs-layout'>)</span>
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Orphans</span> <span class='hs-conid'>()</span>
<a name="line-53"></a>
<a name="line-54"></a><a name="ControlNode"></a><span class='hs-comment'>-- | A type of graph node which has no outputs. These nodes are</span>
<a name="line-55"></a><a name="ControlNode"></a><span class='hs-comment'>-- valuable for causing side effects when they are run.</span>
<a name="line-56"></a><a name="ControlNode"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>ControlNode</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ControlNode</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unControlNode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Op</span> <span class='hs-layout'>}</span>
<a name="line-57"></a>
<a name="line-58"></a><a name="OpType"></a><span class='hs-comment'>-- | The type of op of a node in the graph. This corresponds to the proto field</span>
<a name="line-59"></a><a name="OpType"></a><span class='hs-comment'>-- NodeDef.op.</span>
<a name="line-60"></a><a name="OpType"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>OpType</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>OpType</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unOpType</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span> <span class='hs-layout'>}</span>
<a name="line-61"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span><span class='hs-layout'>)</span>
<a name="line-62"></a>
<a name="line-63"></a><a name="instance%20IsString%20OpType"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>IsString</span> <span class='hs-conid'>OpType</span> <span class='hs-keyword'>where</span>
<a name="line-64"></a> <span class='hs-varid'>fromString</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>OpType</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span>
<a name="line-65"></a>
<a name="line-66"></a><a name="Output"></a><span class='hs-comment'>-- | An output of a TensorFlow node.</span>
<a name="line-67"></a><a name="Output"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Output</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Output</span> <span class='hs-varop'>!</span><span class='hs-conid'>OutputIx</span> <span class='hs-varop'>!</span><span class='hs-conid'>Op</span>
<a name="line-68"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span><span class='hs-layout'>)</span>
<a name="line-69"></a>
<a name="line-70"></a><a name="output"></a><span class='hs-definition'>output</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>OutputIx</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Op</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Output</span>
<a name="line-71"></a><span class='hs-definition'>output</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Output</span>
<a name="line-72"></a>
<a name="line-73"></a><a name="outputOp"></a><span class='hs-definition'>outputOp</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>Output</span> <span class='hs-conid'>Op</span>
<a name="line-74"></a><span class='hs-definition'>outputOp</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-varid'>i</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Output</span> <span class='hs-varid'>i</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span>
<a name="line-75"></a>
<a name="line-76"></a><a name="outputIndex"></a><span class='hs-definition'>outputIndex</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>Output</span> <span class='hs-conid'>OutputIx</span>
<a name="line-77"></a><span class='hs-definition'>outputIndex</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-varid'>i</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Output</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-varid'>i</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Output</span> <span class='hs-varid'>i</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span>
<a name="line-78"></a>
<a name="line-79"></a><a name="OutputIx"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>OutputIx</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>OutputIx</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unOutputIx</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Int</span> <span class='hs-layout'>}</span>
<a name="line-80"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Num</span><span class='hs-layout'>,</span> <span class='hs-conid'>Enum</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span><span class='hs-layout'>)</span>
<a name="line-81"></a>
<a name="line-82"></a><a name="Device"></a><span class='hs-comment'>-- | A device that a node can be assigned to.</span>
<a name="line-83"></a><a name="Device"></a><span class='hs-comment'>-- There's a naming convention where the device names</span>
<a name="line-84"></a><a name="Device"></a><span class='hs-comment'>-- are constructed from job and replica names.</span>
<a name="line-85"></a><a name="Device"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Device</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Device</span> <span class='hs-layout'>{</span><span class='hs-varid'>deviceName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span><span class='hs-layout'>}</span>
<a name="line-86"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>IsString</span><span class='hs-layout'>)</span>
<a name="line-87"></a>
<a name="line-88"></a><a name="instance%20Show%20Device"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Show</span> <span class='hs-conid'>Device</span> <span class='hs-keyword'>where</span>
<a name="line-89"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-conid'>Device</span> <span class='hs-varid'>d</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>show</span> <span class='hs-varid'>d</span>
<a name="line-90"></a>
<a name="line-91"></a><a name="Op"></a><span class='hs-comment'>-- | The representation of a node in a TensorFlow graph.</span>
<a name="line-92"></a><a name="Op"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Op</span>
<a name="line-93"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Rendered</span> <span class='hs-varop'>!</span><span class='hs-conid'>NodeDef</span> <span class='hs-comment'>-- ^ Properties are fixed, including the</span>
<a name="line-94"></a> <span class='hs-comment'>-- device, name, and scope.</span>
<a name="line-95"></a> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>Unrendered</span> <span class='hs-varop'>!</span><span class='hs-conid'>OpDef</span> <span class='hs-comment'>-- ^ Properties are not fixed, and may change depending</span>
<a name="line-96"></a> <span class='hs-comment'>-- on which context this op is rendered in.</span>
<a name="line-97"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>)</span>
<a name="line-98"></a>
<a name="line-99"></a><a name="instance%20Show%20Op"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Show</span> <span class='hs-conid'>Op</span> <span class='hs-keyword'>where</span>
<a name="line-100"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-conid'>Rendered</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Rendered "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>showMessage</span> <span class='hs-varid'>n</span>
<a name="line-101"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-conid'>Unrendered</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>"Unrendered "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>o</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>opName</span><span class='hs-layout'>)</span>
<a name="line-102"></a>
<a name="line-103"></a><a name="opUnrendered"></a><span class='hs-comment'>-- | Traverse on the 'Unrendered' of an 'Op'.</span>
<a name="line-104"></a><span class='hs-comment'>--</span>
<a name="line-105"></a><span class='hs-comment'>-- Same implementation as _Left.</span>
<a name="line-106"></a><span class='hs-definition'>opUnrendered</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Traversal'</span> <span class='hs-conid'>Op</span> <span class='hs-conid'>OpDef</span>
<a name="line-107"></a><span class='hs-definition'>opUnrendered</span> <span class='hs-varid'>f</span> <span class='hs-layout'>(</span><span class='hs-conid'>Unrendered</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Unrendered</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span>
<a name="line-108"></a><span class='hs-definition'>opUnrendered</span> <span class='hs-keyword'>_</span> <span class='hs-layout'>(</span><span class='hs-conid'>Rendered</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pure</span> <span class='hs-layout'>(</span><span class='hs-conid'>Rendered</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span>
<a name="line-109"></a>
<a name="line-110"></a><a name="OpDef"></a><span class='hs-comment'>-- | Op definition. This corresponds somewhat to the 'NodeDef' proto.</span>
<a name="line-111"></a><a name="OpDef"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>OpDef</span>
<a name="line-112"></a> <span class='hs-layout'>{</span> <span class='hs-sel'>_opName</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-conid'>PendingNodeName</span>
<a name="line-113"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opType</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-conid'>OpType</span>
<a name="line-114"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opAttrs</span> <span class='hs-keyglyph'>::</span> <span class='hs-varop'>!</span><span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span> <span class='hs-conid'>Text</span> <span class='hs-conid'>AttrValue</span><span class='hs-layout'>)</span>
<a name="line-115"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span>
<a name="line-116"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_opControlInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span>
<a name="line-117"></a> <span class='hs-layout'>}</span> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>)</span>
<a name="line-118"></a>
<a name="line-119"></a><a name="PendingNodeName"></a><span class='hs-comment'>-- | The name specified for an unrendered Op. If an Op has an</span>
<a name="line-120"></a><a name="PendingNodeName"></a><span class='hs-comment'>-- ImplicitName, it will be assigned based on the opType plus a</span>
<a name="line-121"></a><a name="PendingNodeName"></a><span class='hs-comment'>-- unique identifier. Does not contain the "scope" prefix.</span>
<a name="line-122"></a><a name="PendingNodeName"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>PendingNodeName</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ExplicitName</span> <span class='hs-varop'>!</span><span class='hs-conid'>Text</span> <span class='hs-keyglyph'>|</span> <span class='hs-conid'>ImplicitName</span>
<a name="line-123"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span><span class='hs-layout'>)</span>
<a name="line-124"></a>
<a name="line-125"></a><a name="NodeName"></a><span class='hs-comment'>-- | The name of a node in the graph. This corresponds to the proto field</span>
<a name="line-126"></a><a name="NodeName"></a><span class='hs-comment'>-- NodeDef.name. Includes the scope prefix (if any) and a unique identifier</span>
<a name="line-127"></a><a name="NodeName"></a><span class='hs-comment'>-- (if the node was implicitly named).</span>
<a name="line-128"></a><a name="NodeName"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>NodeName</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>NodeName</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unNodeName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Text</span> <span class='hs-layout'>}</span>
<a name="line-129"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Eq</span><span class='hs-layout'>,</span> <span class='hs-conid'>Ord</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span><span class='hs-layout'>)</span>
<a name="line-130"></a>
<a name="line-131"></a><a name="opName"></a><span class='hs-definition'>opName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>OpDef</span> <span class='hs-conid'>PendingNodeName</span>
<a name="line-132"></a><span class='hs-definition'>opName</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_opName</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>o</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span> <span class='hs-layout'>{</span><span class='hs-sel'>_opName</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-133"></a>
<a name="line-134"></a><a name="opType"></a><span class='hs-definition'>opType</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>OpDef</span> <span class='hs-conid'>OpType</span>
<a name="line-135"></a><span class='hs-definition'>opType</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_opType</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>o</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span> <span class='hs-layout'>{</span> <span class='hs-sel'>_opType</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-136"></a>
<a name="line-137"></a><a name="opAttr"></a><span class='hs-definition'>opAttr</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Attribute</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>OpDef</span> <span class='hs-varid'>a</span>
<a name="line-138"></a><span class='hs-definition'>opAttr</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_opAttrs</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>o</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span> <span class='hs-layout'>{</span><span class='hs-sel'>_opAttrs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-139"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>lens</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>findWithDefault</span> <span class='hs-varid'>def</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>flip</span> <span class='hs-layout'>(</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>insert</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-140"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>attrLens</span>
<a name="line-141"></a>
<a name="line-142"></a><a name="opInputs"></a><span class='hs-definition'>opInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Output</span><span class='hs-keyglyph'>]</span>
<a name="line-143"></a><span class='hs-definition'>opInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_opInputs</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>o</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span> <span class='hs-layout'>{</span><span class='hs-sel'>_opInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-144"></a>
<a name="line-145"></a><a name="opControlInputs"></a><span class='hs-definition'>opControlInputs</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>OpDef</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span>
<a name="line-146"></a><span class='hs-definition'>opControlInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_opControlInputs</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>o</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span> <span class='hs-layout'>{</span><span class='hs-sel'>_opControlInputs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>x</span><span class='hs-layout'>}</span><span class='hs-layout'>)</span>
<a name="line-147"></a>
<a name="line-148"></a><a name="instance%20IsString%20Output"></a><span class='hs-comment'>-- TODO(gnezdo): IsString instance is weird and we should move that</span>
<a name="line-149"></a><a name="instance%20IsString%20Output"></a><span class='hs-comment'>-- code into a Build function</span>
<a name="line-150"></a><a name="instance%20IsString%20Output"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>IsString</span> <span class='hs-conid'>Output</span> <span class='hs-keyword'>where</span>
<a name="line-151"></a> <span class='hs-varid'>fromString</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>break</span> <span class='hs-layout'>(</span><span class='hs-varop'>==</span><span class='hs-chr'>':'</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-keyword'>of</span>
<a name="line-152"></a> <span class='hs-layout'>(</span><span class='hs-varid'>n</span><span class='hs-layout'>,</span> <span class='hs-chr'>':'</span><span class='hs-conop'>:</span><span class='hs-varid'>ixStr</span><span class='hs-layout'>)</span>
<a name="line-153"></a> <span class='hs-keyglyph'>|</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-varid'>ix</span><span class='hs-layout'>,</span> <span class='hs-str'>""</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>read</span> <span class='hs-varid'>ixStr</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Output</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromInteger</span> <span class='hs-varid'>ix</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-varid'>assigned</span> <span class='hs-varid'>n</span>
<a name="line-154"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Output</span> <span class='hs-num'>0</span> <span class='hs-varop'>$</span> <span class='hs-varid'>assigned</span> <span class='hs-varid'>s</span>
<a name="line-155"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>assigned</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Rendered</span> <span class='hs-varop'>$</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>name</span> <span class='hs-varop'>.~</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span> <span class='hs-varid'>n</span>
<a name="line-156"></a>
</pre></body>
</html>

View file

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Session.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE TupleSections #-}</span>
<a name="line-19"></a>
<a name="line-20"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span> <span class='hs-layout'>(</span>
<a name="line-21"></a> <span class='hs-conid'>Session</span><span class='hs-layout'>,</span>
<a name="line-22"></a> <span class='hs-comment'>-- * Opaque value created via 'sessionConfig' and 'sessionTarget'.</span>
<a name="line-23"></a> <span class='hs-conid'>SessionOption</span><span class='hs-layout'>,</span>
<a name="line-24"></a> <span class='hs-varid'>sessionConfig</span><span class='hs-layout'>,</span>
<a name="line-25"></a> <span class='hs-varid'>sessionTarget</span><span class='hs-layout'>,</span>
<a name="line-26"></a> <span class='hs-varid'>runSession</span><span class='hs-layout'>,</span>
<a name="line-27"></a> <span class='hs-varid'>runSessionWithOptions</span><span class='hs-layout'>,</span>
<a name="line-28"></a> <span class='hs-varid'>build</span><span class='hs-layout'>,</span>
<a name="line-29"></a> <span class='hs-varid'>buildAnd</span><span class='hs-layout'>,</span>
<a name="line-30"></a> <span class='hs-varid'>buildWithSummary</span><span class='hs-layout'>,</span>
<a name="line-31"></a> <span class='hs-varid'>extend</span><span class='hs-layout'>,</span>
<a name="line-32"></a> <span class='hs-varid'>addGraphDef</span><span class='hs-layout'>,</span>
<a name="line-33"></a> <span class='hs-varid'>run</span><span class='hs-layout'>,</span>
<a name="line-34"></a> <span class='hs-varid'>runWithFeeds</span><span class='hs-layout'>,</span>
<a name="line-35"></a> <span class='hs-varid'>run_</span><span class='hs-layout'>,</span>
<a name="line-36"></a> <span class='hs-varid'>runWithFeeds_</span><span class='hs-layout'>,</span>
<a name="line-37"></a> <span class='hs-varid'>asyncProdNodes</span><span class='hs-layout'>,</span>
<a name="line-38"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-39"></a>
<a name="line-40"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span> <span class='hs-layout'>(</span><span class='hs-varid'>forever</span><span class='hs-layout'>,</span> <span class='hs-varid'>unless</span><span class='hs-layout'>,</span> <span class='hs-varid'>void</span><span class='hs-layout'>)</span>
<a name="line-41"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-conid'>Class</span> <span class='hs-layout'>(</span><span class='hs-conid'>MonadIO</span><span class='hs-layout'>,</span> <span class='hs-varid'>liftIO</span><span class='hs-layout'>)</span>
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Trans</span><span class='hs-varop'>.</span><span class='hs-conid'>Class</span> <span class='hs-layout'>(</span><span class='hs-varid'>lift</span><span class='hs-layout'>)</span>
<a name="line-43"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Trans</span><span class='hs-varop'>.</span><span class='hs-conid'>Reader</span> <span class='hs-layout'>(</span><span class='hs-conid'>ReaderT</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-varid'>ask</span><span class='hs-layout'>,</span> <span class='hs-varid'>asks</span><span class='hs-layout'>)</span>
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-layout'>(</span><span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Functor</span><span class='hs-varop'>.</span><span class='hs-conid'>Identity</span> <span class='hs-layout'>(</span><span class='hs-varid'>runIdentity</span><span class='hs-layout'>)</span>
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-conid'>Strict</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Map</span>
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Set</span>
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span><span class='hs-layout'>)</span>
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Encoding</span> <span class='hs-layout'>(</span><span class='hs-varid'>encodeUtf8</span><span class='hs-layout'>)</span>
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ProtoLens</span> <span class='hs-layout'>(</span><span class='hs-varid'>def</span><span class='hs-layout'>)</span>
<a name="line-51"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.~</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Graph</span> <span class='hs-layout'>(</span><span class='hs-varid'>node</span><span class='hs-layout'>)</span>
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Protobuf</span><span class='hs-varop'>.</span><span class='hs-conid'>Config</span> <span class='hs-layout'>(</span><span class='hs-conid'>ConfigProto</span><span class='hs-layout'>)</span>
<a name="line-54"></a>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Build</span>
<a name="line-56"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>FFI</span>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Raw</span>
<a name="line-58"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Nodes</span>
<a name="line-59"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span> <span class='hs-layout'>(</span><span class='hs-conid'>NodeName</span><span class='hs-layout'>,</span> <span class='hs-varid'>unNodeName</span><span class='hs-layout'>)</span>
<a name="line-60"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span>
<a name="line-61"></a>
<a name="line-62"></a><a name="SessionState"></a><span class='hs-comment'>-- Common state threaded through the session.</span>
<a name="line-63"></a><a name="SessionState"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>SessionState</span>
<a name="line-64"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>SessionState</span> <span class='hs-layout'>{</span>
<a name="line-65"></a> <span class='hs-varid'>rawSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span>
<a name="line-66"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>asyncCollector</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-67"></a> <span class='hs-comment'>-- ^ Starts the given action concurrently.</span>
<a name="line-68"></a> <span class='hs-layout'>}</span>
<a name="line-69"></a>
<a name="line-70"></a><a name="Session"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span>
<a name="line-71"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Session</span> <span class='hs-layout'>(</span><span class='hs-conid'>ReaderT</span> <span class='hs-conid'>SessionState</span> <span class='hs-layout'>(</span><span class='hs-conid'>BuildT</span> <span class='hs-conid'>IO</span><span class='hs-layout'>)</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-72"></a> <span class='hs-keyword'>deriving</span> <span class='hs-layout'>(</span><span class='hs-conid'>Functor</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span><span class='hs-layout'>,</span> <span class='hs-conid'>Monad</span><span class='hs-layout'>,</span> <span class='hs-conid'>MonadIO</span><span class='hs-layout'>)</span>
<a name="line-73"></a>
<a name="line-74"></a><a name="runSession"></a><span class='hs-comment'>-- | Run 'Session' actions in a new TensorFlow session.</span>
<a name="line-75"></a><span class='hs-definition'>runSession</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-76"></a><span class='hs-definition'>runSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runSessionWithOptions</span> <span class='hs-conid'>[]</span>
<a name="line-77"></a>
<a name="line-78"></a><a name="SessionOption"></a><span class='hs-comment'>-- | Setting of an option for the session (see 'runSessionWithOptions').</span>
<a name="line-79"></a><a name="SessionOption"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>SessionOption</span> <span class='hs-keyglyph'>=</span>
<a name="line-80"></a> <span class='hs-conid'>SessionOption</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unSesssionOption</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-conid'>SessionOptions</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span> <span class='hs-layout'>}</span>
<a name="line-81"></a>
<a name="line-82"></a><a name="sessionTarget"></a><span class='hs-comment'>-- | Target can be: "local", ip:port, host:port.</span>
<a name="line-83"></a><span class='hs-comment'>-- The set of supported factories depends on the linked in libraries.</span>
<a name="line-84"></a><span class='hs-comment'>-- REQUIRES "//learning/brain/public:tensorflow_remote" dependency for the binary.</span>
<a name="line-85"></a><span class='hs-definition'>sessionTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ByteString</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>SessionOption</span>
<a name="line-86"></a><span class='hs-definition'>sessionTarget</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>SessionOption</span> <span class='hs-varop'>.</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>setSessionTarget</span>
<a name="line-87"></a>
<a name="line-88"></a><a name="sessionConfig"></a><span class='hs-comment'>-- | Uses the specified config for the created session.</span>
<a name="line-89"></a><span class='hs-definition'>sessionConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ConfigProto</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>SessionOption</span>
<a name="line-90"></a><span class='hs-definition'>sessionConfig</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>SessionOption</span> <span class='hs-varop'>.</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>setSessionConfig</span>
<a name="line-91"></a>
<a name="line-92"></a><a name="runSessionWithOptions"></a><span class='hs-comment'>-- | Run 'Session' actions in a new TensorFlow session created with</span>
<a name="line-93"></a><span class='hs-comment'>-- the given option setter actions ('sessionTarget', 'sessionConfig').</span>
<a name="line-94"></a><span class='hs-definition'>runSessionWithOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>SessionOption</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-95"></a><span class='hs-definition'>runSessionWithOptions</span> <span class='hs-varid'>options</span> <span class='hs-layout'>(</span><span class='hs-conid'>Session</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
<a name="line-96"></a> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>withSession</span> <span class='hs-varid'>applyOptions</span> <span class='hs-varop'>$</span>
<a name="line-97"></a> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>as</span> <span class='hs-varid'>rs</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>evalBuildT</span> <span class='hs-layout'>(</span><span class='hs-varid'>runReaderT</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-conid'>SessionState</span> <span class='hs-varid'>rs</span> <span class='hs-keyword'>as</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-98"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>applyOptions</span> <span class='hs-varid'>opt</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>mapM_</span> <span class='hs-layout'>(</span><span class='hs-varop'>`unSesssionOption`</span> <span class='hs-varid'>opt</span><span class='hs-layout'>)</span> <span class='hs-varid'>options</span>
<a name="line-99"></a>
<a name="line-100"></a><a name="build"></a><span class='hs-comment'>-- | Lift a 'Build' action into a 'Session', including any explicit op</span>
<a name="line-101"></a><span class='hs-comment'>-- renderings.</span>
<a name="line-102"></a><span class='hs-definition'>build</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span>
<a name="line-103"></a><span class='hs-definition'>build</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Session</span> <span class='hs-varop'>.</span> <span class='hs-varid'>lift</span> <span class='hs-varop'>.</span> <span class='hs-varid'>hoistBuildT</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varop'>.</span> <span class='hs-varid'>runIdentity</span><span class='hs-layout'>)</span>
<a name="line-104"></a>
<a name="line-105"></a><a name="buildWithSummary"></a><span class='hs-comment'>-- | Lift a 'Build' action into a 'Session', including any explicit op</span>
<a name="line-106"></a><span class='hs-comment'>-- renderings. Returns the merged summary ops which can be used for</span>
<a name="line-107"></a><span class='hs-comment'>-- logging, see 'TensorFlow.Logging.build' for a convenient wrapper.</span>
<a name="line-108"></a><span class='hs-definition'>buildWithSummary</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>SummaryTensor</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-109"></a><span class='hs-definition'>buildWithSummary</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Session</span> <span class='hs-varop'>$</span> <span class='hs-varid'>lift</span> <span class='hs-varop'>$</span> <span class='hs-conid'>(,)</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>v</span> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-varid'>collectAllSummaries</span>
<a name="line-110"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>BuildT</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-111"></a> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>hoistBuildT</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varop'>.</span> <span class='hs-varid'>runIdentity</span><span class='hs-layout'>)</span> <span class='hs-varid'>b</span>
<a name="line-112"></a>
<a name="line-113"></a><a name="extend"></a><span class='hs-comment'>-- | Add all pending rendered nodes to the TensorFlow graph and runs</span>
<a name="line-114"></a><span class='hs-comment'>-- any pending initializers.</span>
<a name="line-115"></a><span class='hs-comment'>--</span>
<a name="line-116"></a><span class='hs-comment'>-- Note that run, runWithFeeds, etc. will all call this function implicitly.</span>
<a name="line-117"></a><span class='hs-definition'>extend</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Session</span> <span class='hs-conid'>()</span>
<a name="line-118"></a><span class='hs-definition'>extend</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-119"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>withSessionWhen</span> <span class='hs-varid'>vs</span> <span class='hs-varid'>action</span> <span class='hs-keyglyph'>=</span>
<a name="line-120"></a> <span class='hs-varid'>unless</span> <span class='hs-layout'>(</span><span class='hs-varid'>null</span> <span class='hs-varid'>vs</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Session</span> <span class='hs-layout'>(</span><span class='hs-varid'>asks</span> <span class='hs-varid'>rawSession</span><span class='hs-layout'>)</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>action</span>
<a name="line-121"></a> <span class='hs-varid'>nodesToExtend</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varid'>flushNodeBuffer</span>
<a name="line-122"></a> <span class='hs-varid'>withSessionWhen</span> <span class='hs-varid'>nodesToExtend</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>session</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-123"></a> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>extendGraph</span> <span class='hs-varid'>session</span>
<a name="line-124"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>node</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>nodesToExtend</span>
<a name="line-125"></a> <span class='hs-comment'>-- Now that all the nodes are created, run the initializers.</span>
<a name="line-126"></a> <span class='hs-varid'>initializers</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varid'>flushInitializers</span>
<a name="line-127"></a> <span class='hs-varid'>withSessionWhen</span> <span class='hs-varid'>initializers</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>session</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-128"></a> <span class='hs-varid'>void</span> <span class='hs-varop'>$</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>run</span> <span class='hs-varid'>session</span> <span class='hs-conid'>[]</span> <span class='hs-conid'>[]</span> <span class='hs-layout'>(</span><span class='hs-varid'>toNodeNames</span> <span class='hs-varid'>initializers</span><span class='hs-layout'>)</span>
<a name="line-129"></a>
<a name="line-130"></a><a name="buildAnd"></a><span class='hs-comment'>-- | Helper combinator for doing something with the result of a 'Build' action.</span>
<a name="line-131"></a><span class='hs-comment'>-- Example usage:</span>
<a name="line-132"></a><span class='hs-comment'>--</span>
<a name="line-133"></a><span class='hs-comment'>-- &gt; buildAnd run :: Fetchable t a =&gt; Build t -&gt; Session a</span>
<a name="line-134"></a><span class='hs-definition'>buildAnd</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>b</span>
<a name="line-135"></a><span class='hs-definition'>buildAnd</span> <span class='hs-varid'>f</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>build</span> <span class='hs-varid'>m</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-varid'>f</span>
<a name="line-136"></a>
<a name="line-137"></a><a name="run"></a><span class='hs-comment'>-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span>
<a name="line-138"></a><span class='hs-comment'>-- rendered, and fetch the corresponding values for 'a'.</span>
<a name="line-139"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span>
<a name="line-140"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runWithFeeds</span> <span class='hs-conid'>[]</span>
<a name="line-141"></a>
<a name="line-142"></a><a name="runWithFeeds"></a><span class='hs-comment'>-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span>
<a name="line-143"></a><span class='hs-comment'>-- rendered, feed the given input values, and fetch the corresponding result</span>
<a name="line-144"></a><span class='hs-comment'>-- values for 'a'.</span>
<a name="line-145"></a><span class='hs-definition'>runWithFeeds</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Fetchable</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Feed</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span>
<a name="line-146"></a><span class='hs-definition'>runWithFeeds</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-147"></a> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>t</span>
<a name="line-148"></a> <span class='hs-comment'>-- Note that this call to "fetch" shouldn't affect the following "extend"</span>
<a name="line-149"></a> <span class='hs-comment'>-- call, since all nodes in t and its inputs/deps will be rendered by the</span>
<a name="line-150"></a> <span class='hs-comment'>-- above call to getNodes.</span>
<a name="line-151"></a> <span class='hs-varid'>fetch</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getFetch</span> <span class='hs-varid'>t</span>
<a name="line-152"></a> <span class='hs-varid'>runFetchWithFeeds</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>ns</span> <span class='hs-varid'>fetch</span>
<a name="line-153"></a>
<a name="line-154"></a><a name="runFetchWithFeeds"></a><span class='hs-definition'>runFetchWithFeeds</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Feed</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Set</span> <span class='hs-conid'>NodeName</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Fetch</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>a</span>
<a name="line-155"></a><span class='hs-definition'>runFetchWithFeeds</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>target</span> <span class='hs-layout'>(</span><span class='hs-conid'>Fetch</span> <span class='hs-varid'>fetch</span> <span class='hs-varid'>restore</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-156"></a> <span class='hs-varid'>extend</span>
<a name="line-157"></a> <span class='hs-varid'>feeds'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fixFeeds</span> <span class='hs-varid'>feeds</span>
<a name="line-158"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>fetchNames</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>encodeUtf8</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varid'>fetch</span>
<a name="line-159"></a> <span class='hs-varid'>targetNames</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>toNodeNames</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varid'>target</span>
<a name="line-160"></a> <span class='hs-varid'>session</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Session</span> <span class='hs-layout'>(</span><span class='hs-varid'>asks</span> <span class='hs-varid'>rawSession</span><span class='hs-layout'>)</span>
<a name="line-161"></a> <span class='hs-varid'>runResult</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>run</span> <span class='hs-varid'>session</span>
<a name="line-162"></a> <span class='hs-varid'>feeds'</span>
<a name="line-163"></a> <span class='hs-varid'>fetchNames</span>
<a name="line-164"></a> <span class='hs-varid'>targetNames</span>
<a name="line-165"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>resultTensorsMap</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Map</span><span class='hs-varop'>.</span><span class='hs-varid'>fromList</span> <span class='hs-varop'>$</span> <span class='hs-varid'>zip</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varid'>fetch</span><span class='hs-layout'>)</span> <span class='hs-varid'>runResult</span>
<a name="line-166"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>restore</span> <span class='hs-varid'>resultTensorsMap</span>
<a name="line-167"></a>
<a name="line-168"></a><a name="toNodeNames"></a><span class='hs-definition'>toNodeNames</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>NodeName</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ByteString</span><span class='hs-keyglyph'>]</span>
<a name="line-169"></a><span class='hs-definition'>toNodeNames</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-layout'>(</span><span class='hs-varid'>encodeUtf8</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unNodeName</span><span class='hs-layout'>)</span>
<a name="line-170"></a>
<a name="line-171"></a><a name="run_"></a><span class='hs-comment'>-- | Run a subgraph 't', rendering and extending any dependent nodes that aren't</span>
<a name="line-172"></a><span class='hs-comment'>-- already rendered. This behaves like 'run' except that it doesn't do any</span>
<a name="line-173"></a><span class='hs-comment'>-- fetches.</span>
<a name="line-174"></a><span class='hs-definition'>run_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-conid'>()</span>
<a name="line-175"></a><span class='hs-definition'>run_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runWithFeeds_</span> <span class='hs-conid'>[]</span>
<a name="line-176"></a>
<a name="line-177"></a><a name="runWithFeeds_"></a><span class='hs-comment'>-- | Run a subgraph 't', rendering any dependent nodes that aren't already</span>
<a name="line-178"></a><span class='hs-comment'>-- rendered, feed the given input values, and fetch the corresponding result</span>
<a name="line-179"></a><span class='hs-comment'>-- values for 'a'. This behaves like 'runWithFeeds' except that it doesn't do</span>
<a name="line-180"></a><span class='hs-comment'>-- any fetches.</span>
<a name="line-181"></a><span class='hs-definition'>runWithFeeds_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Feed</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-conid'>()</span>
<a name="line-182"></a><span class='hs-definition'>runWithFeeds_</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-183"></a> <span class='hs-varid'>ns</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-varop'>$</span> <span class='hs-varid'>getNodes</span> <span class='hs-varid'>t</span>
<a name="line-184"></a> <span class='hs-varid'>runFetchWithFeeds</span> <span class='hs-varid'>feeds</span> <span class='hs-varid'>ns</span> <span class='hs-layout'>(</span><span class='hs-varid'>pure</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span>
<a name="line-185"></a>
<a name="line-186"></a><a name="fixFeeds"></a><span class='hs-definition'>fixFeeds</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Feed</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Build</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-conid'>ByteString</span><span class='hs-layout'>,</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span>
<a name="line-187"></a><span class='hs-definition'>fixFeeds</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>mapM</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Feed</span> <span class='hs-varid'>o</span> <span class='hs-varid'>d</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-layout'>,</span><span class='hs-varid'>d</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>encodeUtf8</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>renderOutput</span> <span class='hs-varid'>o</span>
<a name="line-188"></a>
<a name="line-189"></a><a name="asyncProdNodes"></a><span class='hs-comment'>-- | Starts a concurrent thread which evaluates the given Nodes</span>
<a name="line-190"></a><span class='hs-comment'>-- forever until runSession exits or an exception occurs. Graph</span>
<a name="line-191"></a><span class='hs-comment'>-- extension happens synchronously, but the resultant run proceeds as</span>
<a name="line-192"></a><span class='hs-comment'>-- a separate thread.</span>
<a name="line-193"></a><span class='hs-definition'>asyncProdNodes</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Nodes</span> <span class='hs-varid'>t</span>
<a name="line-194"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>t</span> <span class='hs-comment'>-- ^ Node to evaluate concurrently.</span>
<a name="line-195"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-conid'>()</span>
<a name="line-196"></a><span class='hs-definition'>asyncProdNodes</span> <span class='hs-varid'>nodes</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-197"></a> <span class='hs-varid'>target</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>build</span> <span class='hs-layout'>(</span><span class='hs-varid'>getNodes</span> <span class='hs-varid'>nodes</span><span class='hs-layout'>)</span>
<a name="line-198"></a> <span class='hs-varid'>extend</span>
<a name="line-199"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>targetNames</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>toNodeNames</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varid'>target</span>
<a name="line-200"></a> <span class='hs-varid'>state</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>Session</span> <span class='hs-varid'>ask</span>
<a name="line-201"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>loop</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>forever</span> <span class='hs-layout'>(</span><span class='hs-varid'>void</span> <span class='hs-layout'>(</span><span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>run</span> <span class='hs-layout'>(</span><span class='hs-varid'>rawSession</span> <span class='hs-varid'>state</span><span class='hs-layout'>)</span> <span class='hs-conid'>[]</span> <span class='hs-conid'>[]</span> <span class='hs-varid'>targetNames</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-202"></a> <span class='hs-varid'>liftIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>asyncCollector</span> <span class='hs-varid'>state</span> <span class='hs-varid'>loop</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Tensor.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE GADTs #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-19"></a>
<a name="line-20"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>where</span>
<a name="line-21"></a>
<a name="line-22"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span> <span class='hs-layout'>(</span><span class='hs-conid'>IsString</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-23"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Text</span>
<a name="line-24"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-conid'>Lens'</span><span class='hs-layout'>,</span> <span class='hs-conid'>Traversal'</span><span class='hs-layout'>)</span>
<a name="line-25"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span><span class='hs-varop'>.</span><span class='hs-conid'>Unchecked</span> <span class='hs-layout'>(</span><span class='hs-varid'>lens</span><span class='hs-layout'>)</span>
<a name="line-26"></a>
<a name="line-27"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Output</span> <span class='hs-layout'>(</span><span class='hs-conid'>Output</span><span class='hs-layout'>,</span> <span class='hs-varid'>outputOp</span><span class='hs-layout'>,</span> <span class='hs-varid'>opUnrendered</span><span class='hs-layout'>,</span> <span class='hs-varid'>opAttr</span><span class='hs-layout'>)</span>
<a name="line-28"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorData</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-conid'>Attribute</span><span class='hs-layout'>)</span>
<a name="line-29"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>FFI</span>
<a name="line-30"></a>
<a name="line-31"></a><a name="Tensor"></a><span class='hs-comment'>-- | A named output of a TensorFlow operation.</span>
<a name="line-32"></a><a name="Tensor"></a><span class='hs-comment'>--</span>
<a name="line-33"></a><a name="Tensor"></a><span class='hs-comment'>-- The type parameter @a@ is the type of the elements in the 'Tensor'. The</span>
<a name="line-34"></a><a name="Tensor"></a><span class='hs-comment'>-- parameter @v@ is either 'Value' or 'Ref', depending on whether the graph is</span>
<a name="line-35"></a><a name="Tensor"></a><span class='hs-comment'>-- treating this op output as an immutable 'Value' or a stateful 'Ref' (e.g., a</span>
<a name="line-36"></a><a name="Tensor"></a><span class='hs-comment'>-- variable). Note that a @Tensor Ref@ can be casted into a @Tensor Value@ via</span>
<a name="line-37"></a><a name="Tensor"></a><span class='hs-comment'>-- 'value'.</span>
<a name="line-38"></a><a name="Tensor"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Tensor</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorKind</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span> <span class='hs-conid'>Output</span>
<a name="line-39"></a>
<a name="line-40"></a><a name="Value"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Value</span>
<a name="line-41"></a><a name="Ref"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Ref</span>
<a name="line-42"></a>
<a name="line-43"></a><a name="TensorKind"></a><span class='hs-comment'>-- | This class provides a runtime switch on whether a 'Tensor' should be</span>
<a name="line-44"></a><a name="TensorKind"></a><span class='hs-comment'>-- treated as a 'Value' or as a 'Ref'.</span>
<a name="line-45"></a><a name="TensorKind"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>TensorKind</span> <span class='hs-varid'>v</span> <span class='hs-keyword'>where</span>
<a name="line-46"></a> <span class='hs-conid'>ValueKind</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorKind</span> <span class='hs-conid'>Value</span>
<a name="line-47"></a> <span class='hs-conid'>RefKind</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorKind</span> <span class='hs-conid'>Ref</span>
<a name="line-48"></a>
<a name="line-49"></a><a name="tensorKind"></a><span class='hs-definition'>tensorKind</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorKind</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span>
<a name="line-50"></a><span class='hs-definition'>tensorKind</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>v</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span>
<a name="line-51"></a>
<a name="line-52"></a><a name="tensorOutput"></a><span class='hs-definition'>tensorOutput</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-conid'>Output</span>
<a name="line-53"></a><span class='hs-definition'>tensorOutput</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span>
<a name="line-54"></a>
<a name="line-55"></a><a name="tensorAttr"></a><span class='hs-comment'>-- TODO: Come up with a better API for handling attributes.</span>
<a name="line-56"></a><span class='hs-comment'>-- | Lens for the attributes of a tensor.</span>
<a name="line-57"></a><span class='hs-comment'>--</span>
<a name="line-58"></a><span class='hs-comment'>-- Only valid if the tensor has not yet been rendered. If the tensor has been</span>
<a name="line-59"></a><span class='hs-comment'>-- rendered, the traversal will be over nothing (nothing can be read or</span>
<a name="line-60"></a><span class='hs-comment'>-- written).</span>
<a name="line-61"></a><span class='hs-definition'>tensorAttr</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Attribute</span> <span class='hs-varid'>attr</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Traversal'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-varid'>attr</span>
<a name="line-62"></a><span class='hs-definition'>tensorAttr</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorOutput</span> <span class='hs-varop'>.</span> <span class='hs-varid'>outputOp</span> <span class='hs-varop'>.</span> <span class='hs-varid'>opUnrendered</span> <span class='hs-varop'>.</span> <span class='hs-varid'>opAttr</span> <span class='hs-varid'>x</span>
<a name="line-63"></a>
<a name="line-64"></a><a name="value"></a><span class='hs-comment'>-- | Cast a 'Tensor *' into a 'Tensor Value'. Common usage is to cast a</span>
<a name="line-65"></a><span class='hs-comment'>-- Ref into Value. This behaves like a no-op.</span>
<a name="line-66"></a><span class='hs-definition'>value</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-conid'>Value</span> <span class='hs-varid'>a</span>
<a name="line-67"></a><span class='hs-definition'>value</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Tensor</span> <span class='hs-conid'>ValueKind</span> <span class='hs-varid'>o</span>
<a name="line-68"></a>
<a name="line-69"></a><a name="Feed"></a><span class='hs-comment'>-- | A pair of a 'Tensor' and some data that should be fed into that 'Tensor'</span>
<a name="line-70"></a><a name="Feed"></a><span class='hs-comment'>-- when running the graph.</span>
<a name="line-71"></a><a name="Feed"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Feed</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Feed</span> <span class='hs-conid'>Output</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span>
<a name="line-72"></a>
<a name="line-73"></a><a name="feed"></a><span class='hs-comment'>-- | Create a 'Feed' for feeding the given data into a 'Tensor' when running</span>
<a name="line-74"></a><span class='hs-comment'>-- the graph.</span>
<a name="line-75"></a><span class='hs-comment'>--</span>
<a name="line-76"></a><span class='hs-comment'>-- Note that if a 'Tensor' is rendered, its identity may change; so feeding the</span>
<a name="line-77"></a><span class='hs-comment'>-- rendered 'Tensor' may be different than feeding the original 'Tensor'.</span>
<a name="line-78"></a><span class='hs-definition'>feed</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Feed</span>
<a name="line-79"></a><span class='hs-definition'>feed</span> <span class='hs-layout'>(</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>o</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorData</span> <span class='hs-varid'>td</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Feed</span> <span class='hs-varid'>o</span> <span class='hs-varid'>td</span>
<a name="line-80"></a>
<a name="line-81"></a><a name="tensorFromName"></a><span class='hs-comment'>-- | Create a 'Tensor' for a given name. This can be used to reference nodes</span>
<a name="line-82"></a><span class='hs-comment'>-- in a 'GraphDef' that was loaded via 'addGraphDef'.</span>
<a name="line-83"></a><span class='hs-comment'>-- TODO(judahjacobson): add more safety checks here.</span>
<a name="line-84"></a><span class='hs-definition'>tensorFromName</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorKind</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varid'>a</span>
<a name="line-85"></a><span class='hs-definition'>tensorFromName</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'>.</span> <span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-varid'>unpack</span>
</pre></body>
</html>

View file

@ -0,0 +1,393 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/TensorFlow/Types.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- Copyright 2016 TensorFlow authors.</span>
<a name="line-2"></a><span class='hs-comment'>--</span>
<a name="line-3"></a><span class='hs-comment'>-- Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="line-4"></a><span class='hs-comment'>-- you may not use this file except in compliance with the License.</span>
<a name="line-5"></a><span class='hs-comment'>-- You may obtain a copy of the License at</span>
<a name="line-6"></a><span class='hs-comment'>--</span>
<a name="line-7"></a><span class='hs-comment'>-- <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- Unless required by applicable law or agreed to in writing, software</span>
<a name="line-10"></a><span class='hs-comment'>-- distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="line-11"></a><span class='hs-comment'>-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="line-12"></a><span class='hs-comment'>-- See the License for the specific language governing permissions and</span>
<a name="line-13"></a><span class='hs-comment'>-- limitations under the License.</span>
<a name="line-14"></a>
<a name="line-15"></a><span class='hs-comment'>{-# LANGUAGE ConstraintKinds #-}</span>
<a name="line-16"></a><span class='hs-comment'>{-# LANGUAGE DataKinds #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE FlexibleContexts #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-19"></a><span class='hs-comment'>{-# LANGUAGE OverloadedStrings #-}</span>
<a name="line-20"></a><span class='hs-comment'>{-# LANGUAGE RankNTypes #-}</span>
<a name="line-21"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
<a name="line-22"></a><span class='hs-comment'>{-# LANGUAGE TypeFamilies #-}</span>
<a name="line-23"></a><span class='hs-comment'>{-# LANGUAGE TypeOperators #-}</span>
<a name="line-24"></a><span class='hs-comment'>-- We use UndecidableInstances for type families with recursive definitions</span>
<a name="line-25"></a><span class='hs-comment'>-- like "\\". Those instances will terminate since each equation unwraps one</span>
<a name="line-26"></a><span class='hs-comment'>-- cons cell of a type-level list.</span>
<a name="line-27"></a><span class='hs-comment'>{-# LANGUAGE UndecidableInstances #-}</span>
<a name="line-28"></a>
<a name="line-29"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
<a name="line-30"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>TensorType</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-31"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorData</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Shape</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-33"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>protoShape</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Attribute</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-35"></a> <span class='hs-comment'>-- * Type constraints</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OneOf</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-keyword'>type</span> <span class='hs-layout'>(</span><span class='hs-varop'>/=</span><span class='hs-layout'>)</span>
<a name="line-38"></a> <span class='hs-comment'>-- ** Implementation of constraints</span>
<a name="line-39"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TypeError</span>
<a name="line-40"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>ExcludedCase</span>
<a name="line-41"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorTypes</span>
<a name="line-42"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>NoneOf</span>
<a name="line-43"></a> <span class='hs-layout'>,</span> <span class='hs-keyword'>type</span> <span class='hs-layout'>(</span><span class='hs-varop'>\\</span><span class='hs-layout'>)</span>
<a name="line-44"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Delete</span>
<a name="line-45"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>AllTensorTypes</span>
<a name="line-46"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-47"></a>
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Complex</span> <span class='hs-layout'>(</span><span class='hs-conid'>Complex</span><span class='hs-layout'>)</span>
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Default</span> <span class='hs-layout'>(</span><span class='hs-varid'>def</span><span class='hs-layout'>)</span>
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Int</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int8</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int16</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int32</span><span class='hs-layout'>,</span> <span class='hs-conid'>Int64</span><span class='hs-layout'>)</span>
<a name="line-51"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varop'>&lt;&gt;</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span> <span class='hs-layout'>(</span><span class='hs-conid'>Word8</span><span class='hs-layout'>,</span> <span class='hs-conid'>Word16</span><span class='hs-layout'>,</span> <span class='hs-conid'>Word64</span><span class='hs-layout'>)</span>
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Foreign</span><span class='hs-varop'>.</span><span class='hs-conid'>Storable</span> <span class='hs-layout'>(</span><span class='hs-conid'>Storable</span><span class='hs-layout'>)</span>
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>GHC</span><span class='hs-varop'>.</span><span class='hs-conid'>Exts</span> <span class='hs-layout'>(</span><span class='hs-conid'>Constraint</span><span class='hs-layout'>,</span> <span class='hs-conid'>IsList</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span> <span class='hs-layout'>(</span><span class='hs-conid'>Lens'</span><span class='hs-layout'>,</span> <span class='hs-varid'>view</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>&amp;</span><span class='hs-layout'>)</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varop'>.~</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-56"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Family2</span><span class='hs-varop'>.</span><span class='hs-conid'>Unchecked</span> <span class='hs-layout'>(</span><span class='hs-varid'>iso</span><span class='hs-layout'>)</span>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Attoparsec</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Atto</span>
<a name="line-58"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-layout'>(</span><span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
<a name="line-59"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>B</span>
<a name="line-60"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span> <span class='hs-layout'>(</span><span class='hs-conid'>Builder</span><span class='hs-layout'>)</span>
<a name="line-61"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Builder</span>
<a name="line-62"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Lazy</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>L</span>
<a name="line-63"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>V</span>
<a name="line-64"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span><span class='hs-varop'>.</span><span class='hs-conid'>Storable</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>S</span>
<a name="line-65"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>AttrValue</span>
<a name="line-66"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>AttrValue</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-67"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>AttrValue'ListValue</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-68"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>b</span>
<a name="line-69"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>f</span>
<a name="line-70"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>i</span>
<a name="line-71"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>s</span>
<a name="line-72"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>list</span>
<a name="line-73"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>type'</span>
<a name="line-74"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>shape</span>
<a name="line-75"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tensor</span>
<a name="line-76"></a> <span class='hs-layout'>)</span>
<a name="line-77"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensor</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Tensor</span>
<a name="line-78"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>TensorProto</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-79"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>floatVal</span>
<a name="line-80"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>doubleVal</span>
<a name="line-81"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>intVal</span>
<a name="line-82"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>stringVal</span>
<a name="line-83"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>int64Val</span>
<a name="line-84"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>stringVal</span>
<a name="line-85"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>boolVal</span>
<a name="line-86"></a> <span class='hs-layout'>)</span>
<a name="line-87"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorShape</span>
<a name="line-88"></a> <span class='hs-layout'>(</span> <span class='hs-conid'>TensorShapeProto</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-89"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>dim</span>
<a name="line-90"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>size</span>
<a name="line-91"></a> <span class='hs-layout'>)</span>
<a name="line-92"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Proto</span><span class='hs-varop'>.</span><span class='hs-conid'>Tensorflow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span><span class='hs-varop'>.</span><span class='hs-conid'>Framework</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span> <span class='hs-layout'>(</span><span class='hs-conid'>DataType</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-93"></a>
<a name="line-94"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>VarInt</span> <span class='hs-layout'>(</span><span class='hs-varid'>getVarInt</span><span class='hs-layout'>,</span> <span class='hs-varid'>putVarInt</span><span class='hs-layout'>)</span>
<a name="line-95"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>FFI</span>
<a name="line-96"></a>
<a name="line-97"></a><a name="TensorData"></a><span class='hs-comment'>-- | Data about a tensor that is encoded for the TensorFlow APIs.</span>
<a name="line-98"></a><a name="TensorData"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorData</span> <span class='hs-layout'>{</span> <span class='hs-varid'>unTensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span> <span class='hs-layout'>}</span>
<a name="line-99"></a>
<a name="line-100"></a><a name="TensorData"></a><span class='hs-comment'>-- | The class of scalar types supported by tensorflow.</span>
<a name="line-101"></a><a name="TensorData"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>where</span>
<a name="line-102"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>DataType</span>
<a name="line-103"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>DataType</span>
<a name="line-104"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>TensorProto</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span>
<a name="line-105"></a> <span class='hs-comment'>-- | Decode the bytes of a TensorData into a Vector.</span>
<a name="line-106"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a</span>
<a name="line-107"></a> <span class='hs-comment'>-- | Encode a Vector into a TensorData.</span>
<a name="line-108"></a> <span class='hs-comment'>--</span>
<a name="line-109"></a> <span class='hs-comment'>-- The values should be in row major order, e.g.,</span>
<a name="line-110"></a> <span class='hs-comment'>--</span>
<a name="line-111"></a> <span class='hs-comment'>-- element 0: index (0, ..., 0)</span>
<a name="line-112"></a> <span class='hs-comment'>-- element 1: index (0, ..., 1)</span>
<a name="line-113"></a> <span class='hs-comment'>-- ...</span>
<a name="line-114"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Shape</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span>
<a name="line-115"></a>
<a name="line-116"></a><span class='hs-comment'>-- All types, besides ByteString, are encoded as simple arrays and we can use</span>
<a name="line-117"></a><span class='hs-comment'>-- Vector.Storable to encode/decode by type casting pointers.</span>
<a name="line-118"></a>
<a name="line-119"></a><a name="simpleDecode"></a><span class='hs-comment'>-- TODO(fmayle): Assert that the data type matches the return type.</span>
<a name="line-120"></a><span class='hs-definition'>simpleDecode</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Storable</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a</span>
<a name="line-121"></a><span class='hs-definition'>simpleDecode</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>convert</span> <span class='hs-varop'>.</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>unsafeCast</span> <span class='hs-varop'>.</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorDataBytes</span> <span class='hs-varop'>.</span> <span class='hs-varid'>unTensorData</span>
<a name="line-122"></a>
<a name="line-123"></a><a name="simpleEncode"></a><span class='hs-definition'>simpleEncode</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Storable</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-124"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Shape</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>TensorData</span> <span class='hs-varid'>a</span>
<a name="line-125"></a><span class='hs-definition'>simpleEncode</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-126"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorData</span> <span class='hs-varop'>.</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>dt</span> <span class='hs-varop'>.</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>unsafeCast</span> <span class='hs-varop'>.</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>convert</span>
<a name="line-127"></a> <span class='hs-keyword'>where</span>
<a name="line-128"></a> <span class='hs-varid'>dt</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorType</span> <span class='hs-layout'>(</span><span class='hs-varid'>undefined</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-129"></a>
<a name="line-130"></a><a name="instance%20TensorType%20Float"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Float</span> <span class='hs-keyword'>where</span>
<a name="line-131"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_FLOAT</span>
<a name="line-132"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_FLOAT_REF</span>
<a name="line-133"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>floatVal</span>
<a name="line-134"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-135"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-136"></a>
<a name="line-137"></a><a name="instance%20TensorType%20Double"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Double</span> <span class='hs-keyword'>where</span>
<a name="line-138"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_DOUBLE</span>
<a name="line-139"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_DOUBLE_REF</span>
<a name="line-140"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>doubleVal</span>
<a name="line-141"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-142"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-143"></a>
<a name="line-144"></a><a name="instance%20TensorType%20Int32"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Int32</span> <span class='hs-keyword'>where</span>
<a name="line-145"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT32</span>
<a name="line-146"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT32_REF</span>
<a name="line-147"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>intVal</span>
<a name="line-148"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-149"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-150"></a>
<a name="line-151"></a><a name="instance%20TensorType%20Int64"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Int64</span> <span class='hs-keyword'>where</span>
<a name="line-152"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT64</span>
<a name="line-153"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT64_REF</span>
<a name="line-154"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>int64Val</span>
<a name="line-155"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-156"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-157"></a>
<a name="line-158"></a><a name="integral"></a><span class='hs-definition'>integral</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Integral</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Lens'</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int32</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span>
<a name="line-159"></a><span class='hs-definition'>integral</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>iso</span> <span class='hs-layout'>(</span><span class='hs-varid'>fmap</span> <span class='hs-varid'>fromIntegral</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>fmap</span> <span class='hs-varid'>fromIntegral</span><span class='hs-layout'>)</span>
<a name="line-160"></a>
<a name="line-161"></a><a name="instance%20TensorType%20Word8"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Word8</span> <span class='hs-keyword'>where</span>
<a name="line-162"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_UINT8</span>
<a name="line-163"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_UINT8_REF</span>
<a name="line-164"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>intVal</span> <span class='hs-varop'>.</span> <span class='hs-varid'>integral</span>
<a name="line-165"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-166"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-167"></a>
<a name="line-168"></a><a name="instance%20TensorType%20Word16"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Word16</span> <span class='hs-keyword'>where</span>
<a name="line-169"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_UINT16</span>
<a name="line-170"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_UINT16_REF</span>
<a name="line-171"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>intVal</span> <span class='hs-varop'>.</span> <span class='hs-varid'>integral</span>
<a name="line-172"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-173"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-174"></a>
<a name="line-175"></a><a name="instance%20TensorType%20Int16"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Int16</span> <span class='hs-keyword'>where</span>
<a name="line-176"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT16</span>
<a name="line-177"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT16_REF</span>
<a name="line-178"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>intVal</span> <span class='hs-varop'>.</span> <span class='hs-varid'>integral</span>
<a name="line-179"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-180"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-181"></a>
<a name="line-182"></a><a name="instance%20TensorType%20Int8"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Int8</span> <span class='hs-keyword'>where</span>
<a name="line-183"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT8</span>
<a name="line-184"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_INT8_REF</span>
<a name="line-185"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>intVal</span> <span class='hs-varop'>.</span> <span class='hs-varid'>integral</span>
<a name="line-186"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-187"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-188"></a>
<a name="line-189"></a><a name="instance%20TensorType%20ByteString"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>ByteString</span> <span class='hs-keyword'>where</span>
<a name="line-190"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_STRING</span>
<a name="line-191"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_STRING_REF</span>
<a name="line-192"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>stringVal</span>
<a name="line-193"></a> <span class='hs-comment'>-- Encoded data layout (described in third_party/tensorflow/c/c_api.h):</span>
<a name="line-194"></a> <span class='hs-comment'>-- table offsets for each element :: [Word64]</span>
<a name="line-195"></a> <span class='hs-comment'>-- at each element offset:</span>
<a name="line-196"></a> <span class='hs-comment'>-- string length :: VarInt64</span>
<a name="line-197"></a> <span class='hs-comment'>-- string data :: [Word8]</span>
<a name="line-198"></a> <span class='hs-comment'>-- TODO(fmayle): Benchmark these functions.</span>
<a name="line-199"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-varid'>tensorData</span> <span class='hs-keyglyph'>=</span>
<a name="line-200"></a> <span class='hs-varid'>either</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>err</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>error</span> <span class='hs-varop'>$</span> <span class='hs-str'>"Malformed TF_STRING tensor; "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>err</span><span class='hs-layout'>)</span> <span class='hs-varid'>id</span> <span class='hs-varop'>$</span>
<a name="line-201"></a> <span class='hs-keyword'>if</span> <span class='hs-varid'>expected</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>count</span>
<a name="line-202"></a> <span class='hs-keyword'>then</span> <span class='hs-conid'>Left</span> <span class='hs-varop'>$</span> <span class='hs-str'>"decodeTensorData for ByteString count mismatch "</span> <span class='hs-varop'>++</span>
<a name="line-203"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>expected</span><span class='hs-layout'>,</span> <span class='hs-varid'>count</span><span class='hs-layout'>)</span>
<a name="line-204"></a> <span class='hs-keyword'>else</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-varid'>mapM</span> <span class='hs-varid'>decodeString</span> <span class='hs-layout'>(</span><span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>convert</span> <span class='hs-varid'>offsets</span><span class='hs-layout'>)</span>
<a name="line-205"></a> <span class='hs-keyword'>where</span>
<a name="line-206"></a> <span class='hs-varid'>expected</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>length</span> <span class='hs-varid'>offsets</span>
<a name="line-207"></a> <span class='hs-varid'>count</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-varid'>product</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorDataDimensions</span>
<a name="line-208"></a> <span class='hs-varop'>$</span> <span class='hs-varid'>unTensorData</span> <span class='hs-varid'>tensorData</span>
<a name="line-209"></a> <span class='hs-varid'>bytes</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>tensorDataBytes</span> <span class='hs-varop'>$</span> <span class='hs-varid'>unTensorData</span> <span class='hs-varid'>tensorData</span>
<a name="line-210"></a> <span class='hs-varid'>offsets</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>take</span> <span class='hs-varid'>count</span> <span class='hs-varop'>$</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>unsafeCast</span> <span class='hs-varid'>bytes</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-conid'>Vector</span> <span class='hs-conid'>Word64</span>
<a name="line-211"></a> <span class='hs-varid'>dataBytes</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>pack</span> <span class='hs-varop'>$</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>toList</span> <span class='hs-varop'>$</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>drop</span> <span class='hs-layout'>(</span><span class='hs-varid'>count</span> <span class='hs-varop'>*</span> <span class='hs-num'>8</span><span class='hs-layout'>)</span> <span class='hs-varid'>bytes</span>
<a name="line-212"></a> <span class='hs-varid'>decodeString</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Either</span> <span class='hs-conid'>String</span> <span class='hs-conid'>ByteString</span>
<a name="line-213"></a> <span class='hs-varid'>decodeString</span> <span class='hs-varid'>offset</span> <span class='hs-keyglyph'>=</span>
<a name="line-214"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>stringDataStart</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>drop</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>offset</span><span class='hs-layout'>)</span> <span class='hs-varid'>dataBytes</span>
<a name="line-215"></a> <span class='hs-keyword'>in</span> <span class='hs-conid'>Atto</span><span class='hs-varop'>.</span><span class='hs-varid'>eitherResult</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Atto</span><span class='hs-varop'>.</span><span class='hs-varid'>parse</span> <span class='hs-varid'>stringParser</span> <span class='hs-varid'>stringDataStart</span>
<a name="line-216"></a> <span class='hs-varid'>stringParser</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Atto</span><span class='hs-varop'>.</span><span class='hs-conid'>Parser</span> <span class='hs-conid'>ByteString</span>
<a name="line-217"></a> <span class='hs-varid'>stringParser</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getVarInt</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-conid'>Atto</span><span class='hs-varop'>.</span><span class='hs-varid'>take</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromIntegral</span>
<a name="line-218"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varid'>vec</span> <span class='hs-keyglyph'>=</span>
<a name="line-219"></a> <span class='hs-conid'>TensorData</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-conid'>TensorData</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>dt</span> <span class='hs-varid'>byteVector</span>
<a name="line-220"></a> <span class='hs-keyword'>where</span>
<a name="line-221"></a> <span class='hs-varid'>dt</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensorType</span> <span class='hs-layout'>(</span><span class='hs-varid'>undefined</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ByteString</span><span class='hs-layout'>)</span>
<a name="line-222"></a> <span class='hs-comment'>-- Add a string to an offset table and data blob.</span>
<a name="line-223"></a> <span class='hs-varid'>addString</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Builder</span><span class='hs-layout'>,</span> <span class='hs-conid'>Builder</span><span class='hs-layout'>,</span> <span class='hs-conid'>Word64</span><span class='hs-layout'>)</span>
<a name="line-224"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>ByteString</span>
<a name="line-225"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-layout'>(</span><span class='hs-conid'>Builder</span><span class='hs-layout'>,</span> <span class='hs-conid'>Builder</span><span class='hs-layout'>,</span> <span class='hs-conid'>Word64</span><span class='hs-layout'>)</span>
<a name="line-226"></a> <span class='hs-varid'>addString</span> <span class='hs-layout'>(</span><span class='hs-varid'>table</span><span class='hs-layout'>,</span> <span class='hs-varid'>strings</span><span class='hs-layout'>,</span> <span class='hs-varid'>offset</span><span class='hs-layout'>)</span> <span class='hs-varid'>str</span> <span class='hs-keyglyph'>=</span>
<a name="line-227"></a> <span class='hs-layout'>(</span> <span class='hs-varid'>table</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>word64LE</span> <span class='hs-varid'>offset</span>
<a name="line-228"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>strings</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-varid'>lengthBytes</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>byteString</span> <span class='hs-varid'>str</span>
<a name="line-229"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>offset</span> <span class='hs-varop'>+</span> <span class='hs-varid'>lengthBytesLen</span> <span class='hs-varop'>+</span> <span class='hs-varid'>strLen</span>
<a name="line-230"></a> <span class='hs-layout'>)</span>
<a name="line-231"></a> <span class='hs-keyword'>where</span>
<a name="line-232"></a> <span class='hs-varid'>strLen</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>length</span> <span class='hs-varid'>str</span>
<a name="line-233"></a> <span class='hs-varid'>lengthBytes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>putVarInt</span> <span class='hs-varop'>$</span> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>length</span> <span class='hs-varid'>str</span>
<a name="line-234"></a> <span class='hs-varid'>lengthBytesLen</span> <span class='hs-keyglyph'>=</span>
<a name="line-235"></a> <span class='hs-varid'>fromIntegral</span> <span class='hs-varop'>$</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>length</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>toLazyByteString</span> <span class='hs-varid'>lengthBytes</span>
<a name="line-236"></a> <span class='hs-comment'>-- Encode all strings.</span>
<a name="line-237"></a> <span class='hs-layout'>(</span><span class='hs-varid'>table'</span><span class='hs-layout'>,</span> <span class='hs-varid'>strings'</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>V</span><span class='hs-varop'>.</span><span class='hs-varid'>foldl'</span> <span class='hs-varid'>addString</span> <span class='hs-layout'>(</span><span class='hs-varid'>mempty</span><span class='hs-layout'>,</span> <span class='hs-varid'>mempty</span><span class='hs-layout'>,</span> <span class='hs-num'>0</span><span class='hs-layout'>)</span> <span class='hs-varid'>vec</span>
<a name="line-238"></a> <span class='hs-comment'>-- Concat offset table with data.</span>
<a name="line-239"></a> <span class='hs-varid'>bytes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>table'</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-varid'>strings'</span>
<a name="line-240"></a> <span class='hs-comment'>-- Convert to Vector Word8.</span>
<a name="line-241"></a> <span class='hs-varid'>byteVector</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>fromList</span> <span class='hs-varop'>$</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>unpack</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>toLazyByteString</span> <span class='hs-varid'>bytes</span>
<a name="line-242"></a>
<a name="line-243"></a>
<a name="line-244"></a><a name="instance%20TensorType%20Bool"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-conid'>Bool</span> <span class='hs-keyword'>where</span>
<a name="line-245"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_BOOL</span>
<a name="line-246"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_BOOL_REF</span>
<a name="line-247"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>boolVal</span>
<a name="line-248"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleDecode</span>
<a name="line-249"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>simpleEncode</span>
<a name="line-250"></a>
<a name="line-251"></a><a name="instance%20TensorType%20(Complex%20Float)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-layout'>(</span><span class='hs-conid'>Complex</span> <span class='hs-conid'>Float</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-252"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_COMPLEX64</span>
<a name="line-253"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_COMPLEX64</span>
<a name="line-254"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Float)"</span>
<a name="line-255"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Float)"</span>
<a name="line-256"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Float)"</span>
<a name="line-257"></a>
<a name="line-258"></a><a name="instance%20TensorType%20(Complex%20Double)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>TensorType</span> <span class='hs-layout'>(</span><span class='hs-conid'>Complex</span> <span class='hs-conid'>Double</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-259"></a> <span class='hs-varid'>tensorType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_COMPLEX128</span>
<a name="line-260"></a> <span class='hs-varid'>tensorRefType</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>DT_COMPLEX128</span>
<a name="line-261"></a> <span class='hs-varid'>tensorVal</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Double)"</span>
<a name="line-262"></a> <span class='hs-varid'>decodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Double)"</span>
<a name="line-263"></a> <span class='hs-varid'>encodeTensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>error</span> <span class='hs-str'>"TODO (Complex Double)"</span>
<a name="line-264"></a>
<a name="line-265"></a><a name="Shape"></a><span class='hs-comment'>-- | Shape (dimensions) of a tensor.</span>
<a name="line-266"></a><a name="Shape"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>Shape</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Shape</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>deriving</span> <span class='hs-conid'>Show</span>
<a name="line-267"></a>
<a name="line-268"></a><a name="instance%20IsList%20Shape"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>IsList</span> <span class='hs-conid'>Shape</span> <span class='hs-keyword'>where</span>
<a name="line-269"></a> <span class='hs-keyword'>type</span> <span class='hs-conid'>Item</span> <span class='hs-conid'>Shape</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Int64</span>
<a name="line-270"></a> <span class='hs-varid'>fromList</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Shape</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromList</span>
<a name="line-271"></a> <span class='hs-varid'>toList</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span> <span class='hs-varid'>ss</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>toList</span> <span class='hs-varid'>ss</span>
<a name="line-272"></a>
<a name="line-273"></a><a name="protoShape"></a><span class='hs-definition'>protoShape</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>TensorShapeProto</span> <span class='hs-conid'>Shape</span>
<a name="line-274"></a><span class='hs-definition'>protoShape</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>iso</span> <span class='hs-varid'>protoToShape</span> <span class='hs-varid'>shapeToProto</span>
<a name="line-275"></a> <span class='hs-keyword'>where</span>
<a name="line-276"></a> <span class='hs-varid'>protoToShape</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Shape</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-varid'>view</span> <span class='hs-varid'>size</span><span class='hs-layout'>)</span> <span class='hs-varop'>.</span> <span class='hs-varid'>view</span> <span class='hs-varid'>dim</span>
<a name="line-277"></a> <span class='hs-varid'>shapeToProto</span> <span class='hs-layout'>(</span><span class='hs-conid'>Shape</span> <span class='hs-varid'>ds</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>dim</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>fmap</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>d</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>def</span> <span class='hs-varop'>&amp;</span> <span class='hs-varid'>size</span> <span class='hs-varop'>.~</span> <span class='hs-varid'>d</span><span class='hs-layout'>)</span> <span class='hs-varid'>ds</span>
<a name="line-278"></a>
<a name="line-279"></a>
<a name="line-280"></a><a name="Attribute"></a><span class='hs-keyword'>class</span> <span class='hs-conid'>Attribute</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>where</span>
<a name="line-281"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>AttrValue</span> <span class='hs-varid'>a</span>
<a name="line-282"></a>
<a name="line-283"></a><a name="instance%20Attribute%20Float"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>Float</span> <span class='hs-keyword'>where</span>
<a name="line-284"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>f</span>
<a name="line-285"></a>
<a name="line-286"></a><a name="instance%20Attribute%20ByteString"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>ByteString</span> <span class='hs-keyword'>where</span>
<a name="line-287"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>s</span>
<a name="line-288"></a>
<a name="line-289"></a><a name="instance%20Attribute%20Int64"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>Int64</span> <span class='hs-keyword'>where</span>
<a name="line-290"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>i</span>
<a name="line-291"></a>
<a name="line-292"></a><a name="instance%20Attribute%20DataType"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>DataType</span> <span class='hs-keyword'>where</span>
<a name="line-293"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>type'</span>
<a name="line-294"></a>
<a name="line-295"></a><a name="instance%20Attribute%20TensorProto"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>TensorProto</span> <span class='hs-keyword'>where</span>
<a name="line-296"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tensor</span>
<a name="line-297"></a>
<a name="line-298"></a><a name="instance%20Attribute%20Bool"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>Bool</span> <span class='hs-keyword'>where</span>
<a name="line-299"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>b</span>
<a name="line-300"></a>
<a name="line-301"></a><a name="instance%20Attribute%20Shape"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>Shape</span> <span class='hs-keyword'>where</span>
<a name="line-302"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>shape</span> <span class='hs-varop'>.</span> <span class='hs-varid'>protoShape</span>
<a name="line-303"></a>
<a name="line-304"></a><a name="instance%20Attribute%20AttrValue'ListValue"></a><span class='hs-comment'>-- TODO(gnezdo): support generating list(Foo) from [Foo].</span>
<a name="line-305"></a><a name="instance%20Attribute%20AttrValue'ListValue"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-conid'>AttrValue'ListValue</span> <span class='hs-keyword'>where</span>
<a name="line-306"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>list</span>
<a name="line-307"></a>
<a name="line-308"></a><a name="instance%20Attribute%20%5bDataType%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>DataType</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-309"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>list</span> <span class='hs-varop'>.</span> <span class='hs-varid'>type'</span>
<a name="line-310"></a>
<a name="line-311"></a><a name="instance%20Attribute%20%5bInt64%5d"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Attribute</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Int64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyword'>where</span>
<a name="line-312"></a> <span class='hs-varid'>attrLens</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>list</span> <span class='hs-varop'>.</span> <span class='hs-varid'>i</span>
<a name="line-313"></a>
<a name="line-314"></a><a name="OneOf"></a><span class='hs-comment'>-- | A 'Constraint' specifying the possible choices of a 'TensorType'.</span>
<a name="line-315"></a><a name="OneOf"></a><span class='hs-comment'>--</span>
<a name="line-316"></a><a name="OneOf"></a><span class='hs-comment'>-- We implement a 'Constraint' like @OneOf '[Double, Float] a@ by turning the</span>
<a name="line-317"></a><a name="OneOf"></a><span class='hs-comment'>-- natural representation as a conjunction, i.e.,</span>
<a name="line-318"></a><a name="OneOf"></a><span class='hs-comment'>--</span>
<a name="line-319"></a><a name="OneOf"></a><span class='hs-comment'>-- @</span>
<a name="line-320"></a><a name="OneOf"></a><span class='hs-comment'>-- a == Double || a == Float</span>
<a name="line-321"></a><a name="OneOf"></a><span class='hs-comment'>-- @</span>
<a name="line-322"></a><a name="OneOf"></a><span class='hs-comment'>--</span>
<a name="line-323"></a><a name="OneOf"></a><span class='hs-comment'>-- into a disjunction like</span>
<a name="line-324"></a><a name="OneOf"></a><span class='hs-comment'>--</span>
<a name="line-325"></a><a name="OneOf"></a><span class='hs-comment'>-- @</span>
<a name="line-326"></a><a name="OneOf"></a><span class='hs-comment'>-- a \/= Int32 &amp;&amp; a \/= Int64 &amp;&amp; a \/= ByteString &amp;&amp; ...</span>
<a name="line-327"></a><a name="OneOf"></a><span class='hs-comment'>-- @</span>
<a name="line-328"></a><a name="OneOf"></a><span class='hs-comment'>--</span>
<a name="line-329"></a><a name="OneOf"></a><span class='hs-comment'>-- using an enumeration of all the possible 'TensorType's.</span>
<a name="line-330"></a><a name="OneOf"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>OneOf</span> <span class='hs-varid'>ts</span> <span class='hs-varid'>a</span>
<a name="line-331"></a> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorType</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>TensorTypes</span> <span class='hs-varid'>ts</span><span class='hs-layout'>,</span> <span class='hs-conid'>NoneOf</span> <span class='hs-layout'>(</span><span class='hs-conid'>AllTensorTypes</span> <span class='hs-varop'>\\</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-332"></a>
<a name="line-333"></a><a name="TensorTypes"></a><span class='hs-comment'>-- | A 'Constraint' checking that the input is a list of 'TensorType's.</span>
<a name="line-334"></a><a name="TensorTypes"></a><span class='hs-comment'>-- Helps improve error messages when using 'OneOf'.</span>
<a name="line-335"></a><a name="TensorTypes"></a><span class='hs-keyword'>type</span> <span class='hs-keyword'>family</span> <span class='hs-conid'>TensorTypes</span> <span class='hs-varid'>ts</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Constraint</span> <span class='hs-keyword'>where</span>
<a name="line-336"></a> <span class='hs-conid'>TensorTypes</span> <span class='hs-chr'>'</span><span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>()</span>
<a name="line-337"></a> <span class='hs-conid'>TensorTypes</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-conid'>TensorType</span> <span class='hs-varid'>t</span><span class='hs-layout'>,</span> <span class='hs-conid'>TensorTypes</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span>
<a name="line-338"></a>
<a name="line-339"></a><span class='hs-comment'>-- | A constraint checking that two types are different.</span>
<a name="line-340"></a><span class='hs-keyword'>type</span> <span class='hs-keyword'>family</span> <span class='hs-varid'>a</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Constraint</span> <span class='hs-keyword'>where</span>
<a name="line-341"></a> <span class='hs-varid'>a</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TypeError</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>~</span> <span class='hs-conid'>ExcludedCase</span>
<a name="line-342"></a> <span class='hs-varid'>a</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>()</span>
<a name="line-343"></a>
<a name="line-344"></a><a name="TypeError"></a><span class='hs-comment'>-- | Helper types to produce a reasonable type error message when the Constraint</span>
<a name="line-345"></a><a name="TypeError"></a><span class='hs-comment'>-- "a /= a" fails.</span>
<a name="line-346"></a><a name="TypeError"></a><span class='hs-comment'>-- TODO(judahjacobson): Use ghc-8's CustomTypeErrors for this.</span>
<a name="line-347"></a><a name="TypeError"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>TypeError</span> <span class='hs-varid'>a</span>
<a name="line-348"></a><a name="ExcludedCase"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>ExcludedCase</span>
<a name="line-349"></a>
<a name="line-350"></a><a name="AllTensorTypes"></a><span class='hs-comment'>-- | An enumeration of all valid 'TensorType's.</span>
<a name="line-351"></a><a name="AllTensorTypes"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>AllTensorTypes</span> <span class='hs-keyglyph'>=</span>
<a name="line-352"></a> <span class='hs-comment'>-- NOTE: This list should be kept in sync with</span>
<a name="line-353"></a> <span class='hs-comment'>-- TensorFlow.OpGen.dtTypeToHaskell.</span>
<a name="line-354"></a> <span class='hs-comment'>-- TODO: Add support for Complex Float/Double.</span>
<a name="line-355"></a> <span class='hs-chr'>'</span><span class='hs-keyglyph'>[</span> <span class='hs-conid'>Float</span>
<a name="line-356"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Double</span>
<a name="line-357"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Int8</span>
<a name="line-358"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Int16</span>
<a name="line-359"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Int32</span>
<a name="line-360"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Int64</span>
<a name="line-361"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Word8</span>
<a name="line-362"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Word16</span>
<a name="line-363"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>ByteString</span>
<a name="line-364"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Bool</span>
<a name="line-365"></a> <span class='hs-keyglyph'>]</span>
<a name="line-366"></a>
<a name="line-367"></a><a name="Delete"></a><span class='hs-comment'>-- | Removes a type from the given list of types.</span>
<a name="line-368"></a><a name="Delete"></a><span class='hs-keyword'>type</span> <span class='hs-keyword'>family</span> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>as</span> <span class='hs-keyword'>where</span>
<a name="line-369"></a> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-chr'>'</span><span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-chr'>'</span><span class='hs-conid'>[]</span>
<a name="line-370"></a> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-keyword'>as</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>as</span>
<a name="line-371"></a> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-layout'>(</span><span class='hs-varid'>b</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-keyword'>as</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>b</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-conid'>Delete</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>as</span>
<a name="line-372"></a>
<a name="line-373"></a><span class='hs-comment'>-- | Takes the difference of two lists of types.</span>
<a name="line-374"></a><span class='hs-keyword'>type</span> <span class='hs-keyword'>family</span> <span class='hs-keyword'>as</span> <span class='hs-varop'>\\</span> <span class='hs-varid'>bs</span> <span class='hs-keyword'>where</span>
<a name="line-375"></a> <span class='hs-keyword'>as</span> <span class='hs-varop'>\\</span> <span class='hs-chr'>'</span><span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>as</span>
<a name="line-376"></a> <span class='hs-keyword'>as</span> <span class='hs-varop'>\\</span> <span class='hs-varid'>b</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-varid'>bs</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Delete</span> <span class='hs-varid'>b</span> <span class='hs-keyword'>as</span> <span class='hs-varop'>\\</span> <span class='hs-varid'>bs</span>
<a name="line-377"></a>
<a name="line-378"></a><a name="NoneOf"></a><span class='hs-comment'>-- | A constraint that the type @a@ doesn't appear in the type list @ts@.</span>
<a name="line-379"></a><a name="NoneOf"></a><span class='hs-comment'>-- Assumes that @a@ and each of the elements of @ts@ are 'TensorType's.</span>
<a name="line-380"></a><a name="NoneOf"></a><span class='hs-keyword'>type</span> <span class='hs-keyword'>family</span> <span class='hs-conid'>NoneOf</span> <span class='hs-varid'>ts</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Constraint</span> <span class='hs-keyword'>where</span>
<a name="line-381"></a> <span class='hs-conid'>NoneOf</span> <span class='hs-chr'>'</span><span class='hs-conid'>[]</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>()</span>
<a name="line-382"></a> <span class='hs-conid'>NoneOf</span> <span class='hs-layout'>(</span><span class='hs-varid'>t</span> <span class='hs-chr'>'</span><span class='hs-conop'>:</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-varop'>/=</span> <span class='hs-varid'>t</span><span class='hs-layout'>,</span> <span class='hs-conid'>NoneOf</span> <span class='hs-varid'>ts</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
</pre></body>
</html>

View file

@ -0,0 +1,5 @@
.hs-keyglyph, .hs-layout {color: red;}
.hs-keyword {color: blue;}
.hs-comment, .hs-comment a {color: green;}
.hs-str, .hs-chr {color: teal;}
.hs-keyword, .hs-conid, .hs-varid, .hs-conop, .hs-varop, .hs-num, .hs-cpp, .hs-sel, .hs-definition {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,626 @@
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | TensorFlow bindings.
--
-- Please see README.md
@package tensorflow
@version 0.1.0.0
-- | Originally taken from internal proto-lens code.
module TensorFlow.Internal.VarInt
-- | Decode an unsigned varint.
getVarInt :: Parser Word64
-- | Encode a Word64.
putVarInt :: Word64 -> Builder
module TensorFlow.Internal.FFI
data TensorFlowException
TensorFlowException :: Code -> Text -> TensorFlowException
data Session
-- | Runs the given action after creating a session with options populated
-- by the given optionSetter.
withSession :: (SessionOptions -> IO ()) -> ((IO () -> IO ()) -> Session -> IO a) -> IO a
extendGraph :: Session -> GraphDef -> IO ()
run :: Session -> [(ByteString, TensorData)] -> [ByteString] -> [ByteString] -> IO [TensorData]
-- | All of the data needed to represent a tensor.
data TensorData
TensorData :: [Int64] -> !DataType -> !(Vector Word8) -> TensorData
[tensorDataDimensions] :: TensorData -> [Int64]
[tensorDataType] :: TensorData -> !DataType
[tensorDataBytes] :: TensorData -> !(Vector Word8)
setSessionConfig :: ConfigProto -> SessionOptions -> IO ()
setSessionTarget :: ByteString -> SessionOptions -> IO ()
-- | Returns the serialized OpList of all OpDefs defined in this address
-- space.
getAllOpList :: IO ByteString
-- | Serializes the given msg and provides it as (ptr,len) argument to the
-- given action.
useProtoAsVoidPtrLen :: (Message msg, Num c) => msg -> (Ptr b -> c -> IO a) -> IO a
instance GHC.Classes.Eq TensorFlow.Internal.FFI.TensorData
instance GHC.Show.Show TensorFlow.Internal.FFI.TensorData
instance GHC.Classes.Eq TensorFlow.Internal.FFI.TensorFlowException
instance GHC.Show.Show TensorFlow.Internal.FFI.TensorFlowException
instance GHC.Exception.Exception TensorFlow.Internal.FFI.TensorFlowException
module TensorFlow.Types
-- | The class of scalar types supported by tensorflow.
class TensorType a
tensorType :: TensorType a => a -> DataType
tensorRefType :: TensorType a => a -> DataType
tensorVal :: TensorType a => Lens' TensorProto [a]
-- | Decode the bytes of a TensorData into a Vector.
decodeTensorData :: TensorType a => TensorData a -> Vector a
-- | Encode a Vector into a TensorData.
--
-- The values should be in row major order, e.g.,
--
-- element 0: index (0, ..., 0) element 1: index (0, ..., 1) ...
encodeTensorData :: TensorType a => Shape -> Vector a -> TensorData a
-- | Data about a tensor that is encoded for the TensorFlow APIs.
newtype TensorData a
TensorData :: TensorData -> TensorData a
[unTensorData] :: TensorData a -> TensorData
-- | Shape (dimensions) of a tensor.
newtype Shape
Shape :: [Int64] -> Shape
protoShape :: Lens' TensorShapeProto Shape
class Attribute a
attrLens :: Attribute a => Lens' AttrValue a
-- | A <a>Constraint</a> specifying the possible choices of a
-- <a>TensorType</a>.
--
-- We implement a <a>Constraint</a> like <tt>OneOf '[Double, Float]
-- a</tt> by turning the natural representation as a conjunction, i.e.,
--
-- <pre>
-- a == Double || a == Float
-- </pre>
--
-- into a disjunction like
--
-- <pre>
-- a /= Int32 &amp;&amp; a /= Int64 &amp;&amp; a /= ByteString &amp;&amp; ...
-- </pre>
--
-- using an enumeration of all the possible <a>TensorType</a>s.
type OneOf ts a = (TensorType a, TensorTypes ts, NoneOf (AllTensorTypes \\ ts) a)
-- | A constraint checking that two types are different.
-- | Helper types to produce a reasonable type error message when the
-- Constraint "a /= a" fails. TODO(judahjacobson): Use ghc-8's
-- CustomTypeErrors for this.
data TypeError a
data ExcludedCase
-- | A <a>Constraint</a> checking that the input is a list of
-- <a>TensorType</a>s. Helps improve error messages when using
-- <a>OneOf</a>.
-- | A constraint that the type <tt>a</tt> doesn't appear in the type list
-- <tt>ts</tt>. Assumes that <tt>a</tt> and each of the elements of
-- <tt>ts</tt> are <a>TensorType</a>s.
-- | Takes the difference of two lists of types.
-- | Removes a type from the given list of types.
-- | An enumeration of all valid <a>TensorType</a>s.
type AllTensorTypes = '[Float, Double, Int8, Int16, Int32, Int64, Word8, Word16, ByteString, Bool]
instance GHC.Show.Show TensorFlow.Types.Shape
instance TensorFlow.Types.TensorType GHC.Types.Float
instance TensorFlow.Types.TensorType GHC.Types.Double
instance TensorFlow.Types.TensorType GHC.Int.Int32
instance TensorFlow.Types.TensorType GHC.Int.Int64
instance TensorFlow.Types.TensorType GHC.Word.Word8
instance TensorFlow.Types.TensorType GHC.Word.Word16
instance TensorFlow.Types.TensorType GHC.Int.Int16
instance TensorFlow.Types.TensorType GHC.Int.Int8
instance TensorFlow.Types.TensorType Data.ByteString.Internal.ByteString
instance TensorFlow.Types.TensorType GHC.Types.Bool
instance TensorFlow.Types.TensorType (Data.Complex.Complex GHC.Types.Float)
instance TensorFlow.Types.TensorType (Data.Complex.Complex GHC.Types.Double)
instance GHC.Exts.IsList TensorFlow.Types.Shape
instance TensorFlow.Types.Attribute GHC.Types.Float
instance TensorFlow.Types.Attribute Data.ByteString.Internal.ByteString
instance TensorFlow.Types.Attribute GHC.Int.Int64
instance TensorFlow.Types.Attribute Proto.Tensorflow.Core.Framework.Types.DataType
instance TensorFlow.Types.Attribute Proto.Tensorflow.Core.Framework.Tensor.TensorProto
instance TensorFlow.Types.Attribute GHC.Types.Bool
instance TensorFlow.Types.Attribute TensorFlow.Types.Shape
instance TensorFlow.Types.Attribute Proto.Tensorflow.Core.Framework.AttrValue.AttrValue'ListValue
instance TensorFlow.Types.Attribute [Proto.Tensorflow.Core.Framework.Types.DataType]
instance TensorFlow.Types.Attribute [GHC.Int.Int64]
module TensorFlow.Output
-- | A type of graph node which has no outputs. These nodes are valuable
-- for causing side effects when they are run.
newtype ControlNode
ControlNode :: Op -> ControlNode
[unControlNode] :: ControlNode -> Op
-- | A device that a node can be assigned to. There's a naming convention
-- where the device names are constructed from job and replica names.
newtype Device
Device :: Text -> Device
[deviceName] :: Device -> Text
-- | The name of a node in the graph. This corresponds to the proto field
-- NodeDef.name. Includes the scope prefix (if any) and a unique
-- identifier (if the node was implicitly named).
newtype NodeName
NodeName :: Text -> NodeName
[unNodeName] :: NodeName -> Text
-- | The representation of a node in a TensorFlow graph.
data Op
-- | Properties are fixed, including the device, name, and scope.
Rendered :: !NodeDef -> Op
-- | Properties are not fixed, and may change depending on which context
-- this op is rendered in.
Unrendered :: !OpDef -> Op
-- | Traverse on the <a>Unrendered</a> of an <a>Op</a>.
--
-- Same implementation as _Left.
opUnrendered :: Traversal' Op OpDef
-- | Op definition. This corresponds somewhat to the <a>NodeDef</a> proto.
data OpDef
OpDef :: !PendingNodeName -> !OpType -> !(Map Text AttrValue) -> [Output] -> [NodeName] -> OpDef
[_opName] :: OpDef -> !PendingNodeName
[_opType] :: OpDef -> !OpType
[_opAttrs] :: OpDef -> !(Map Text AttrValue)
[_opInputs] :: OpDef -> [Output]
[_opControlInputs] :: OpDef -> [NodeName]
opName :: Lens' OpDef PendingNodeName
opType :: Lens' OpDef OpType
opAttr :: Attribute a => Text -> Lens' OpDef a
opInputs :: Lens' OpDef [Output]
opControlInputs :: Lens' OpDef [NodeName]
-- | The type of op of a node in the graph. This corresponds to the proto
-- field NodeDef.op.
newtype OpType
OpType :: Text -> OpType
[unOpType] :: OpType -> Text
newtype OutputIx
OutputIx :: Int -> OutputIx
[unOutputIx] :: OutputIx -> Int
-- | An output of a TensorFlow node.
data Output
Output :: !OutputIx -> !Op -> Output
output :: OutputIx -> Op -> Output
outputIndex :: Lens' Output OutputIx
outputOp :: Lens' Output Op
-- | The name specified for an unrendered Op. If an Op has an ImplicitName,
-- it will be assigned based on the opType plus a unique identifier. Does
-- not contain the "scope" prefix.
data PendingNodeName
ExplicitName :: !Text -> PendingNodeName
ImplicitName :: PendingNodeName
instance GHC.Classes.Ord TensorFlow.Output.Op
instance GHC.Classes.Eq TensorFlow.Output.Op
instance GHC.Show.Show TensorFlow.Output.Output
instance GHC.Classes.Ord TensorFlow.Output.Output
instance GHC.Classes.Eq TensorFlow.Output.Output
instance GHC.Classes.Ord TensorFlow.Output.OpDef
instance GHC.Classes.Eq TensorFlow.Output.OpDef
instance GHC.Show.Show TensorFlow.Output.NodeName
instance GHC.Classes.Ord TensorFlow.Output.NodeName
instance GHC.Classes.Eq TensorFlow.Output.NodeName
instance GHC.Show.Show TensorFlow.Output.PendingNodeName
instance GHC.Classes.Ord TensorFlow.Output.PendingNodeName
instance GHC.Classes.Eq TensorFlow.Output.PendingNodeName
instance Data.String.IsString TensorFlow.Output.Device
instance GHC.Classes.Ord TensorFlow.Output.Device
instance GHC.Classes.Eq TensorFlow.Output.Device
instance GHC.Show.Show TensorFlow.Output.OutputIx
instance GHC.Enum.Enum TensorFlow.Output.OutputIx
instance GHC.Num.Num TensorFlow.Output.OutputIx
instance GHC.Classes.Ord TensorFlow.Output.OutputIx
instance GHC.Classes.Eq TensorFlow.Output.OutputIx
instance GHC.Show.Show TensorFlow.Output.OpType
instance GHC.Classes.Ord TensorFlow.Output.OpType
instance GHC.Classes.Eq TensorFlow.Output.OpType
instance Data.String.IsString TensorFlow.Output.OpType
instance GHC.Show.Show TensorFlow.Output.Device
instance GHC.Show.Show TensorFlow.Output.Op
instance Data.String.IsString TensorFlow.Output.Output
module TensorFlow.Tensor
-- | A named output of a TensorFlow operation.
--
-- The type parameter <tt>a</tt> is the type of the elements in the
-- <a>Tensor</a>. The parameter <tt>v</tt> is either <a>Value</a> or
-- <a>Ref</a>, depending on whether the graph is treating this op output
-- as an immutable <a>Value</a> or a stateful <a>Ref</a> (e.g., a
-- variable). Note that a <tt>Tensor Ref</tt> can be casted into a
-- <tt>Tensor Value</tt> via <a>value</a>.
data Tensor v a
Tensor :: (TensorKind v) -> Output -> Tensor v a
data Value
data Ref
-- | This class provides a runtime switch on whether a <a>Tensor</a> should
-- be treated as a <a>Value</a> or as a <a>Ref</a>.
data TensorKind v
ValueKind :: TensorKind Value
RefKind :: TensorKind Ref
tensorKind :: Lens' (Tensor v a) (TensorKind v)
tensorOutput :: Lens' (Tensor v a) Output
-- | Lens for the attributes of a tensor.
--
-- Only valid if the tensor has not yet been rendered. If the tensor has
-- been rendered, the traversal will be over nothing (nothing can be read
-- or written).
tensorAttr :: Attribute attr => Text -> Traversal' (Tensor v a) attr
-- | Cast a 'Tensor *' into a 'Tensor Value'. Common usage is to cast a Ref
-- into Value. This behaves like a no-op.
value :: Tensor v a -> Tensor Value a
-- | A pair of a <a>Tensor</a> and some data that should be fed into that
-- <a>Tensor</a> when running the graph.
data Feed
Feed :: Output -> TensorData -> Feed
-- | Create a <a>Feed</a> for feeding the given data into a <a>Tensor</a>
-- when running the graph.
--
-- Note that if a <a>Tensor</a> is rendered, its identity may change; so
-- feeding the rendered <a>Tensor</a> may be different than feeding the
-- original <a>Tensor</a>.
feed :: Tensor v a -> TensorData a -> Feed
-- | Create a <a>Tensor</a> for a given name. This can be used to reference
-- nodes in a <tt>GraphDef</tt> that was loaded via <tt>addGraphDef</tt>.
-- TODO(judahjacobson): add more safety checks here.
tensorFromName :: TensorKind v -> Text -> Tensor v a
module TensorFlow.Build
-- | A type of graph node which has no outputs. These nodes are valuable
-- for causing side effects when they are run.
newtype ControlNode
ControlNode :: Op -> ControlNode
[unControlNode] :: ControlNode -> Op
data Unique
explicitName :: Text -> PendingNodeName
implicitName :: PendingNodeName
opDef :: OpType -> OpDef
opDefWithName :: PendingNodeName -> OpType -> OpDef
opName :: Lens' OpDef PendingNodeName
opType :: Lens' OpDef OpType
opAttr :: Attribute a => Text -> Lens' OpDef a
opInputs :: Lens' OpDef [Output]
opControlInputs :: Lens' OpDef [NodeName]
data GraphState
-- | Render a <a>Tensor</a>, fixing its name, scope, device and control
-- inputs from the <a>Build</a> context. Also renders any dependencies of
-- the <a>Tensor</a> that weren't already rendered.
--
-- This operation is idempotent; <tt>render &gt;=&gt; render ===
-- render</tt>. However, rendering a (previously un-rendered)
-- <a>Tensor</a> in two different contexts may result in two different
-- <a>Tensor</a>s.
render :: Tensor v a -> Build (Tensor v a)
-- | Render a <a>Tensor</a> and get its node's name.
renderNodeName :: Tensor v a -> Build NodeName
renderedNodeDefs :: Lens' GraphState (Map NodeName NodeDef)
-- | An action for building nodes in a TensorFlow graph. Used to manage
-- build state internally as part of the <tt>Session</tt> monad.
data BuildT m a
-- | An action for building nodes in a TensorFlow graph.
type Build = BuildT Identity
-- | Registers the given node to be executed before the next <a>run</a>.
addInitializer :: ControlNode -> Build ()
-- | This is Control.Monad.Morph.hoist sans the dependency.
hoistBuildT :: (forall a. m a -> n a) -> BuildT m b -> BuildT n b
evalBuildT :: Monad m => BuildT m a -> m a
runBuildT :: BuildT m a -> m (a, GraphState)
-- | Produce a GraphDef proto representation of the nodes that are rendered
-- in the given <a>Build</a> action.
asGraphDef :: Build a -> GraphDef
addGraphDef :: GraphDef -> Build ()
-- | Get all the initializers that have accumulated so far, and clear that
-- buffer.
flushInitializers :: Monad m => BuildT m [NodeName]
-- | Get all the NodeDefs that have accumulated so far, and clear that
-- buffer.
flushNodeBuffer :: Monad m => BuildT m [NodeDef]
-- | Render the given op if it hasn't been rendered already, and return its
-- name.
getOrAddOp :: Op -> Build NodeName
-- | Add a new node for a given <a>OpDef</a>. This is used for making
-- "stateful" ops which are not safe to dedup (e.g, "variable" and
-- "assign").
addNewOp :: OpDef -> Build NodeDef
-- | Render an <a>Output</a> and return a string representation for the
-- TensorFlow foreign APIs.
renderOutput :: Output -> Build Text
-- | Places all nodes rendered in the given <a>Build</a> action on the same
-- device as the given Tensor (see also <a>withDevice</a>). Make sure
-- that the action has side effects of rendering the desired tensors. A
-- pure return would not have the desired effect.
colocateWith :: Tensor v b -> Build a -> Build a
-- | Modify some part of the state, run an action, and restore the state
-- after that action is done.
withStateLens :: MonadState s m => Lens' s a -> (a -> a) -> m b -> m b
-- | Set a device for all nodes rendered in the given <a>Build</a> action
-- (unless further overridden by another use of withDevice).
withDevice :: Maybe Device -> Build a -> Build a
-- | Prepend a scope to all nodes rendered in the given <a>Build</a>
-- action.
withNameScope :: Text -> Build a -> Build a
-- | Add control inputs to all nodes rendered in the given <a>Build</a>
-- action.
withNodeDependencies :: Set NodeName -> Build a -> Build a
-- | Records the given summary action in Build for retrieval with
-- <a>collectAllSummaries</a>. The summary op is required to produce a
-- Summary protocol buffer in string form. For safety, use the
-- pre-composed functions: Logging.scalarSummary and
-- Logging.histogramSummary.
addSummary :: SummaryTensor -> Build ()
-- | Synonym for the tensors that return serialized Summary proto.
type SummaryTensor = Tensor Value ByteString
-- | Retrieves the summary ops collected thus far. Typically this only
-- happens once, but if <a>buildWithSummary</a> is used repeatedly, the
-- values accumulate.
collectAllSummaries :: Monad m => BuildT m [SummaryTensor]
instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState TensorFlow.Build.GraphState (TensorFlow.Build.BuildT m)
instance Control.Monad.Trans.Class.MonadTrans TensorFlow.Build.BuildT
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (TensorFlow.Build.BuildT m)
instance GHC.Base.Monad m => GHC.Base.Monad (TensorFlow.Build.BuildT m)
instance GHC.Base.Monad m => GHC.Base.Applicative (TensorFlow.Build.BuildT m)
instance GHC.Base.Functor m => GHC.Base.Functor (TensorFlow.Build.BuildT m)
instance GHC.Classes.Ord TensorFlow.Build.PendingNode
instance GHC.Classes.Eq TensorFlow.Build.PendingNode
instance Data.String.IsString TensorFlow.Build.Scope
instance GHC.Classes.Ord TensorFlow.Build.Scope
instance GHC.Classes.Eq TensorFlow.Build.Scope
instance GHC.Enum.Enum TensorFlow.Build.Unique
instance GHC.Classes.Ord TensorFlow.Build.Unique
instance GHC.Classes.Eq TensorFlow.Build.Unique
instance GHC.Show.Show TensorFlow.Build.Scope
module TensorFlow.BuildOp
-- | Class of types that can be used as op outputs.
class OpResult a
-- | Class of types that can be used as op functions.
class BuildOp f
-- | Starts an operation that returns a structured set of tensors
-- (singletons or tuples).
buildOp :: BuildOp f => OpDef -> f
-- | Starts an operation that returns a list of tensors.
buildListOp :: BuildOp f => [Int64] -> OpDef -> f
-- | Returns true if all the integers in each tuple are identical. Throws
-- an error with a descriptive message if not.
eqLengthGuard :: [(String, [(String, Int)])] -> Bool
instance GHC.Show.Show TensorFlow.BuildOp.ResultState
instance (TensorFlow.BuildOp.OpResult a1, TensorFlow.BuildOp.OpResult a2) => TensorFlow.BuildOp.OpResult (a1, a2)
instance (TensorFlow.BuildOp.OpResult a1, TensorFlow.BuildOp.OpResult a2, TensorFlow.BuildOp.OpResult a3) => TensorFlow.BuildOp.OpResult (a1, a2, a3)
instance (TensorFlow.BuildOp.OpResult a1, TensorFlow.BuildOp.OpResult a2, TensorFlow.BuildOp.OpResult a3, TensorFlow.BuildOp.OpResult a4) => TensorFlow.BuildOp.OpResult (a1, a2, a3, a4)
instance (TensorFlow.BuildOp.OpResult a1, TensorFlow.BuildOp.OpResult a2, TensorFlow.BuildOp.OpResult a3, TensorFlow.BuildOp.OpResult a4, TensorFlow.BuildOp.OpResult a5) => TensorFlow.BuildOp.OpResult (a1, a2, a3, a4, a5)
instance (TensorFlow.BuildOp.OpResult a1, TensorFlow.BuildOp.OpResult a2, TensorFlow.BuildOp.OpResult a3, TensorFlow.BuildOp.OpResult a4, TensorFlow.BuildOp.OpResult a5, TensorFlow.BuildOp.OpResult a6) => TensorFlow.BuildOp.OpResult (a1, a2, a3, a4, a5, a6)
instance TensorFlow.BuildOp.OpResult (TensorFlow.Tensor.Tensor TensorFlow.Tensor.Value a)
instance TensorFlow.BuildOp.OpResult (TensorFlow.Tensor.Tensor TensorFlow.Tensor.Ref a)
instance TensorFlow.BuildOp.OpResult TensorFlow.Output.ControlNode
instance TensorFlow.BuildOp.OpResult a => TensorFlow.BuildOp.OpResult [a]
instance TensorFlow.BuildOp.BuildOp TensorFlow.Output.ControlNode
instance TensorFlow.BuildOp.BuildOp (TensorFlow.Tensor.Tensor TensorFlow.Tensor.Value a)
instance TensorFlow.BuildOp.BuildOp (TensorFlow.Tensor.Tensor TensorFlow.Tensor.Ref a)
instance TensorFlow.BuildOp.BuildOp [TensorFlow.Tensor.Tensor TensorFlow.Tensor.Value a]
instance (TensorFlow.BuildOp.OpResult t1, TensorFlow.BuildOp.OpResult t2) => TensorFlow.BuildOp.BuildOp (t1, t2)
instance (TensorFlow.BuildOp.OpResult t1, TensorFlow.BuildOp.OpResult t2, TensorFlow.BuildOp.OpResult t3) => TensorFlow.BuildOp.BuildOp (t1, t2, t3)
instance (TensorFlow.BuildOp.OpResult t1, TensorFlow.BuildOp.OpResult t2, TensorFlow.BuildOp.OpResult t3, TensorFlow.BuildOp.OpResult t4) => TensorFlow.BuildOp.BuildOp (t1, t2, t3, t4)
instance (TensorFlow.BuildOp.OpResult t1, TensorFlow.BuildOp.OpResult t2, TensorFlow.BuildOp.OpResult t3, TensorFlow.BuildOp.OpResult t4, TensorFlow.BuildOp.OpResult t5) => TensorFlow.BuildOp.BuildOp (t1, t2, t3, t4, t5)
instance (TensorFlow.BuildOp.OpResult t1, TensorFlow.BuildOp.OpResult t2, TensorFlow.BuildOp.OpResult t3, TensorFlow.BuildOp.OpResult t4, TensorFlow.BuildOp.OpResult t5, TensorFlow.BuildOp.OpResult t6) => TensorFlow.BuildOp.BuildOp (t1, t2, t3, t4, t5, t6)
instance TensorFlow.BuildOp.OpResult a => TensorFlow.BuildOp.BuildOp (TensorFlow.Build.Build a)
instance TensorFlow.BuildOp.BuildOp f => TensorFlow.BuildOp.BuildOp (TensorFlow.Tensor.Tensor v a -> f)
instance TensorFlow.BuildOp.BuildOp f => TensorFlow.BuildOp.BuildOp ([TensorFlow.Tensor.Tensor v a] -> f)
module TensorFlow.Nodes
-- | Types that contain ops which can be run.
class Nodes t
getNodes :: Nodes t => t -> Build (Set NodeName)
-- | Types that tensor representations (e.g. <a>Tensor</a>,
-- <a>ControlNode</a>) can be fetched into.
--
-- Includes collections of tensors (e.g. tuples).
class Nodes t => Fetchable t a
getFetch :: Fetchable t a => t -> Build (Fetch a)
-- | Fetch action. Keeps track of what needs to be fetched and how to
-- decode the fetched data.
data Fetch a
Fetch :: Set Text -> (Map Text TensorData -> a) -> Fetch a
-- | Nodes to fetch
[fetches] :: Fetch a -> Set Text
-- | Function to create an <tt>a</tt> from the fetched data.
[fetchRestore] :: Fetch a -> Map Text TensorData -> a
nodesUnion :: (Monoid b, Traversable t, Applicative f) => t (f b) -> f b
fetchTensorList :: TensorType a => Tensor v a -> Build (Fetch (Shape, [a]))
fetchTensorVector :: TensorType a => Tensor v a -> Build (Fetch (Shape, Vector a))
newtype Scalar a
Scalar :: a -> Scalar a
[unScalar] :: Scalar a -> a
instance Data.String.IsString a => Data.String.IsString (TensorFlow.Nodes.Scalar a)
instance GHC.Real.RealFrac a => GHC.Real.RealFrac (TensorFlow.Nodes.Scalar a)
instance GHC.Float.RealFloat a => GHC.Float.RealFloat (TensorFlow.Nodes.Scalar a)
instance GHC.Real.Real a => GHC.Real.Real (TensorFlow.Nodes.Scalar a)
instance GHC.Float.Floating a => GHC.Float.Floating (TensorFlow.Nodes.Scalar a)
instance GHC.Real.Fractional a => GHC.Real.Fractional (TensorFlow.Nodes.Scalar a)
instance GHC.Num.Num a => GHC.Num.Num (TensorFlow.Nodes.Scalar a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (TensorFlow.Nodes.Scalar a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (TensorFlow.Nodes.Scalar a)
instance GHC.Show.Show a => GHC.Show.Show (TensorFlow.Nodes.Scalar a)
instance GHC.Base.Functor TensorFlow.Nodes.Fetch
instance GHC.Base.Applicative TensorFlow.Nodes.Fetch
instance (TensorFlow.Nodes.Nodes t1, TensorFlow.Nodes.Nodes t2) => TensorFlow.Nodes.Nodes (t1, t2)
instance (TensorFlow.Nodes.Nodes t1, TensorFlow.Nodes.Nodes t2, TensorFlow.Nodes.Nodes t3) => TensorFlow.Nodes.Nodes (t1, t2, t3)
instance (TensorFlow.Nodes.Fetchable t1 a1, TensorFlow.Nodes.Fetchable t2 a2) => TensorFlow.Nodes.Fetchable (t1, t2) (a1, a2)
instance (TensorFlow.Nodes.Fetchable t1 a1, TensorFlow.Nodes.Fetchable t2 a2, TensorFlow.Nodes.Fetchable t3 a3) => TensorFlow.Nodes.Fetchable (t1, t2, t3) (a1, a2, a3)
instance TensorFlow.Nodes.Nodes t => TensorFlow.Nodes.Nodes [t]
instance TensorFlow.Nodes.Fetchable t a => TensorFlow.Nodes.Fetchable [t] [a]
instance TensorFlow.Nodes.Nodes TensorFlow.Output.ControlNode
instance (a ~ ()) => TensorFlow.Nodes.Fetchable TensorFlow.Output.ControlNode a
instance TensorFlow.Nodes.Nodes (TensorFlow.Tensor.Tensor v a)
instance (TensorFlow.Types.TensorType a, a ~ a') => TensorFlow.Nodes.Fetchable (TensorFlow.Tensor.Tensor v a) (Data.Vector.Vector a')
instance (TensorFlow.Types.TensorType a, a ~ a') => TensorFlow.Nodes.Fetchable (TensorFlow.Tensor.Tensor v a) (TensorFlow.Nodes.Scalar a')
module TensorFlow.ControlFlow
-- | Modify a <a>Build</a> action, such that all new ops rendered in it
-- will depend on the nodes in the first argument.
withControlDependencies :: Nodes t => t -> Build a -> Build a
-- | Create an op that groups multiple operations.
--
-- When this op finishes, all ops in the input <tt>n</tt> have finished.
-- This op has no output.
group :: Nodes t => t -> Build ControlNode
-- | Returns a <a>Tensor</a> with the same shape and contents as the input.
identity :: TensorType a => Tensor v a -> Tensor v a
-- | Does nothing. Only useful as a placeholder for control edges.
noOp :: ControlNode
-- | Returns a <a>Tensor</a> with a given name and the same shape and
-- contents as the input.
--
-- TODO(judahjacobson): This breaks when used with uninitialize
-- <tt>Tensor Ref</tt>s, since <tt>RefIdentity</tt> doesn't have
-- SetAllowsUninitializedInput(). Look into whether we can change that
-- op.
named :: TensorType a => Text -> Tensor v a -> Tensor v a
module TensorFlow.Session
data Session a
-- | Setting of an option for the session (see
-- <a>runSessionWithOptions</a>).
data SessionOption
-- | Uses the specified config for the created session.
sessionConfig :: ConfigProto -> SessionOption
-- | Target can be: "local", ip:port, host:port. The set of supported
-- factories depends on the linked in libraries. REQUIRES
-- "/<i>learning</i>brain/public:tensorflow_remote" dependency for the
-- binary.
sessionTarget :: ByteString -> SessionOption
-- | Run <a>Session</a> actions in a new TensorFlow session.
runSession :: Session a -> IO a
-- | Run <a>Session</a> actions in a new TensorFlow session created with
-- the given option setter actions (<a>sessionTarget</a>,
-- <a>sessionConfig</a>).
runSessionWithOptions :: [SessionOption] -> Session a -> IO a
-- | Lift a <a>Build</a> action into a <a>Session</a>, including any
-- explicit op renderings.
build :: Build a -> Session a
-- | Helper combinator for doing something with the result of a
-- <a>Build</a> action. Example usage:
--
-- <pre>
-- buildAnd run :: Fetchable t a =&gt; Build t -&gt; Session a
-- </pre>
buildAnd :: (a -> Session b) -> Build a -> Session b
-- | Lift a <a>Build</a> action into a <a>Session</a>, including any
-- explicit op renderings. Returns the merged summary ops which can be
-- used for logging, see <a>build</a> for a convenient wrapper.
buildWithSummary :: Build a -> Session (a, [SummaryTensor])
-- | Add all pending rendered nodes to the TensorFlow graph and runs any
-- pending initializers.
--
-- Note that run, runWithFeeds, etc. will all call this function
-- implicitly.
extend :: Session ()
addGraphDef :: GraphDef -> Build ()
-- | Run a subgraph <tt>t</tt>, rendering any dependent nodes that aren't
-- already rendered, and fetch the corresponding values for <tt>a</tt>.
run :: Fetchable t a => t -> Session a
-- | Run a subgraph <tt>t</tt>, rendering any dependent nodes that aren't
-- already rendered, feed the given input values, and fetch the
-- corresponding result values for <tt>a</tt>.
runWithFeeds :: Fetchable t a => [Feed] -> t -> Session a
-- | Run a subgraph <tt>t</tt>, rendering and extending any dependent nodes
-- that aren't already rendered. This behaves like <a>run</a> except that
-- it doesn't do any fetches.
run_ :: Nodes t => t -> Session ()
-- | Run a subgraph <tt>t</tt>, rendering any dependent nodes that aren't
-- already rendered, feed the given input values, and fetch the
-- corresponding result values for <tt>a</tt>. This behaves like
-- <a>runWithFeeds</a> except that it doesn't do any fetches.
runWithFeeds_ :: Nodes t => [Feed] -> t -> Session ()
-- | Starts a concurrent thread which evaluates the given Nodes forever
-- until runSession exits or an exception occurs. Graph extension happens
-- synchronously, but the resultant run proceeds as a separate thread.
asyncProdNodes :: Nodes t => t -> Session ()
instance Control.Monad.IO.Class.MonadIO TensorFlow.Session.Session
instance GHC.Base.Monad TensorFlow.Session.Session
instance GHC.Base.Applicative TensorFlow.Session.Session
instance GHC.Base.Functor TensorFlow.Session.Session

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - _)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - _</p><table><tr><td class="src">_Arg</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Arg">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_HostCast</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostCast">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_HostRecv</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostRecv">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_HostSend</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostSend">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_Recv</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Recv">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_Retval</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Retval">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_Send</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Send">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - E)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - E</p><table><tr><td class="src">editDistance</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:editDistance">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">elu</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:elu">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">eluGrad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:eluGrad">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">encodeBase64</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:encodeBase64">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">encodeJpeg</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:encodeJpeg">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">encodePng</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:encodePng">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">enter</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:enter">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">equal</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:equal">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">erf</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:erf">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">erfc</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:erfc">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">exit</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:exit">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">exp</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:exp">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">expandDims</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:expandDims">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">extractGlimpse</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:extractGlimpse">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">extractImagePatches</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:extractImagePatches">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - F)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - F</p><table><tr><td class="src">fact</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fact">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fFT</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fFT">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fFT2D</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fFT2D">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fFT3D</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fFT3D">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fIFOQueue</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fIFOQueue">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fill</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fill">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fixedLengthRecordReader</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fixedLengthRecordReader">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fixedUnigramCandidateSampler</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fixedUnigramCandidateSampler">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">floor</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:floor">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fractionalAvgPool</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fractionalAvgPool">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fractionalAvgPoolGrad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fractionalAvgPoolGrad">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fractionalMaxPool</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fractionalMaxPool">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fractionalMaxPoolGrad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fractionalMaxPoolGrad">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">fusedResizeAndPadConv2D</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:fusedResizeAndPadConv2D">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - G)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - G</p><table><tr><td class="src">gather</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:gather">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">gatherNd</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:gatherNd">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">getSessionHandle</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:getSessionHandle">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">getSessionTensor</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:getSessionTensor">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">greater</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:greater">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">greaterEqual</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:greaterEqual">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - H)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - H</p><table><tr><td class="src">histogramSummary</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:histogramSummary">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">hSVToRGB</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:hSVToRGB">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - I)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - I</p><table><tr><td class="src">identity</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:identity">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">identityReader</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:identityReader">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">iFFT</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:iFFT">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">iFFT2D</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:iFFT2D">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">iFFT3D</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:iFFT3D">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">igamma</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:igamma">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">igammac</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:igammac">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">imag</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:imag">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">imageSummary</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:imageSummary">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">immutableConst</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:immutableConst">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">initializeTable</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:initializeTable">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">initializeTableFromTextFile</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:initializeTableFromTextFile">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">inTopK</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:inTopK">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">inv</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:inv">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">invertPermutation</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:invertPermutation">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">invGrad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:invGrad">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">isFinite</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:isFinite">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">isInf</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:isInf">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">isNan</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:isNan">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">isVariableInitialized</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:isVariableInitialized">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - L)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - L</p><table><tr><td class="src">l2Loss</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:l2Loss">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">learnedUnigramCandidateSampler</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:learnedUnigramCandidateSampler">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">less</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:less">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lessEqual</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lessEqual">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lgamma</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lgamma">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">linSpace</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:linSpace">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">listDiff</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:listDiff">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">log</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:log">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">logicalAnd</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:logicalAnd">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">logicalNot</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:logicalNot">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">logicalOr</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:logicalOr">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">logSoftmax</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:logSoftmax">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">logUniformCandidateSampler</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:logUniformCandidateSampler">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lookupTableExport</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lookupTableExport">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lookupTableFind</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lookupTableFind">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lookupTableImport</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lookupTableImport">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lookupTableInsert</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lookupTableInsert">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lookupTableSize</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lookupTableSize">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">loopCond</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:loopCond">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lRN</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lRN">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">lRNGrad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:lRNGrad">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - N)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - N</p><table><tr><td class="src">neg</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:neg">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">negTrain</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:negTrain">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">nextIteration</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:nextIteration">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">nonMaxSuppression</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:nonMaxSuppression">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">noOp</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:noOp">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">notEqual</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:notEqual">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - O)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - O</p><table><tr><td class="src">oneHot</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:oneHot">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - P)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - P</p><table><tr><td class="src">pack</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:pack">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">pad</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:pad">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">paddingFIFOQueue</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:paddingFIFOQueue">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">parameterizedTruncatedNormal</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:parameterizedTruncatedNormal">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">parseTensor</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:parseTensor">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">placeholder</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:placeholder">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">placeholderWithDefault</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:placeholderWithDefault">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">polygamma</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:polygamma">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">pow</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:pow">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">priorityQueue</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:priorityQueue">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">prod</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:prod">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

View file

@ -0,0 +1,4 @@
<!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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops. (Index - Q)</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">tensorflow-core-ops-0.1.0.0: Haskell wrappers for Core Tensorflow Ops.</p></div><div id="content"><div id="alphabet"><ul><li><a href="doc-index-A.html">A</a></li><li><a href="doc-index-B.html">B</a></li><li><a href="doc-index-C.html">C</a></li><li><a href="doc-index-D.html">D</a></li><li><a href="doc-index-E.html">E</a></li><li><a href="doc-index-F.html">F</a></li><li><a href="doc-index-G.html">G</a></li><li><a href="doc-index-H.html">H</a></li><li><a href="doc-index-I.html">I</a></li><li><a href="doc-index-L.html">L</a></li><li><a href="doc-index-M.html">M</a></li><li><a href="doc-index-N.html">N</a></li><li><a href="doc-index-O.html">O</a></li><li><a href="doc-index-P.html">P</a></li><li><a href="doc-index-Q.html">Q</a></li><li><a href="doc-index-R.html">R</a></li><li><a href="doc-index-S.html">S</a></li><li><a href="doc-index-T.html">T</a></li><li><a href="doc-index-U.html">U</a></li><li><a href="doc-index-V.html">V</a></li><li><a href="doc-index-W.html">W</a></li><li><a href="doc-index-Z.html">Z</a></li><li><a href="doc-index-95.html">_</a></li><li><a href="doc-index-All.html">All</a></li></ul></div><div id="index"><p class="caption">Index - Q</p><table><tr><td class="src">quantizeAndDequantize</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:quantizeAndDequantize">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">queueClose</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:queueClose">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">queueSize</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:queueSize">TensorFlow.GenOps.Core</a></td></tr></table></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more