1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-23 03:19:44 +01:00

Regenerate the Haddock docs. (#95)

This commit is contained in:
Judah Jacobson 2017-04-08 07:14:47 -07:00 committed by fkm3
parent 16d660c3bc
commit 55ca545915
261 changed files with 14302 additions and 48521 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-58.html">:</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-124.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#v:-124-:-124-">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

@ -1,4 +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>, <a href="./tensorflow-0.1.0.0/TensorFlow-Core.html#t:-47--61-">TensorFlow.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>
</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-58.html">:</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#v:-47-:-47-">TensorFlow.Types</a></td></tr><tr><td class="src">/=</td><td class="module"><a href="./tensorflow-0.1.0.0/TensorFlow-Types.html#t:-47--61-">TensorFlow.Types</a>, <a href="./tensorflow-0.1.0.0/TensorFlow-Core.html#t:-47--61-">TensorFlow.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-58.html">:</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#v::-47-">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

@ -1,4 +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>
</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-58.html">:</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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +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>
</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-58.html">:</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

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

@ -1,4 +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>
</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-58.html">:</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">zeroInitializedVariable'</td><td class="module"><a href="./tensorflow-ops-0.1.0.0/TensorFlow-Ops.html#v:zeroInitializedVariable-39-">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">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-39-">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-39-">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><tr><td class="src">zeta'</td><td class="module"><a href="./tensorflow-core-ops-0.1.0.0/TensorFlow-GenOps-Core.html#v:zeta-39-">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

@ -1,4 +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>
</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-58.html">:</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>

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

@ -1,9 +1,6 @@
<!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>
</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="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-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t) =&gt; t -&gt; m a -&gt; m a</li><li class="src short"><a href="#v:group">group</a> :: (<a href="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t) =&gt; t -&gt; m <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:noOp">noOp</a> :: <a href="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m =&gt; m <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</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-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t) =&gt; t -&gt; m a -&gt; m 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-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="TensorFlow-Nodes.html#t:Nodes">Nodes</a> t) =&gt; t -&gt; m <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</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:noOp" class="def">noOp</a> :: <a href="TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m =&gt; m <a href="TensorFlow-Output.html#t:ControlNode">ControlNode</a></p><div class="doc"><p>Does nothing. Only useful as a placeholder for control edges.</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

View file

@ -1,4 +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>
</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="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> :: Parser <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> :: Parser <a href="../base-4.8.2.0/Data-Word.html#t:Word64">Word64</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></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

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. (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-0.1.0.0: TensorFlow bindings.</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-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-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-58.html">:</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-124.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-Types.html#v:-124-:-124-">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>tensorflow-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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-Types.html#v:-47-:-47-">TensorFlow.Types</a></td></tr><tr><td class="src">/=</td><td class="module"><a href="TensorFlow-Types.html#t:-47--61-">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#t:-47--61-">TensorFlow.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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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-Types.html#v::-47-">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>tensorflow-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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-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>

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. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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">_opAttrs</td><td class="module"><a href="TensorFlow-Output.html#v:_opAttrs">TensorFlow.Output</a></td></tr><tr><td class="src">_opControlInputs</td><td class="module"><a href="TensorFlow-Output.html#v:_opControlInputs">TensorFlow.Output</a></td></tr><tr><td class="src">_opInputs</td><td class="module"><a href="TensorFlow-Output.html#v:_opInputs">TensorFlow.Output</a></td></tr><tr><td class="src">_opName</td><td class="module"><a href="TensorFlow-Output.html#v:_opName">TensorFlow.Output</a></td></tr><tr><td class="src">_opType</td><td class="module"><a href="TensorFlow-Output.html#v:_opType">TensorFlow.Output</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-0.1.0.0: TensorFlow bindings. (Index - A)</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="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-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-58.html">:</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 - A</p><table><tr><td class="src">addGraphDef</td><td class="module"><a href="TensorFlow-Build.html#v:addGraphDef">TensorFlow.Build</a>, <a href="TensorFlow-Session.html#v:addGraphDef">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:addGraphDef">TensorFlow.Core</a></td></tr><tr><td class="src">addInitializer</td><td class="module"><a href="TensorFlow-Build.html#v:addInitializer">TensorFlow.Build</a></td></tr><tr><td class="src">addNewOp</td><td class="module"><a href="TensorFlow-Build.html#v:addNewOp">TensorFlow.Build</a></td></tr><tr><td class="src">addSummary</td><td class="module"><a href="TensorFlow-Tensor.html#v:addSummary">TensorFlow.Tensor</a></td></tr><tr><td class="src">AllTensorTypes</td><td class="module"><a href="TensorFlow-Types.html#t:AllTensorTypes">TensorFlow.Types</a></td></tr><tr><td class="src">asGraphDef</td><td class="module"><a href="TensorFlow-Build.html#v:asGraphDef">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#v:asGraphDef">TensorFlow.Core</a></td></tr><tr><td class="src">asyncProdNodes</td><td class="module"><a href="TensorFlow-Session.html#v:asyncProdNodes">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:asyncProdNodes">TensorFlow.Core</a></td></tr><tr><td class="src">Attribute</td><td class="module"><a href="TensorFlow-Types.html#t:Attribute">TensorFlow.Types</a></td></tr><tr><td class="src">attrLens</td><td class="module"><a href="TensorFlow-Types.html#v:attrLens">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

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. (Index - B)</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="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-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-58.html">:</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 - B</p><table><tr><td class="src">Build</td><td class="module"><a href="TensorFlow-Build.html#t:Build">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#t:Build">TensorFlow.Core</a></td></tr><tr><td class="src">build</td><td class="module"><a href="TensorFlow-Build.html#v:build">TensorFlow.Build</a>, <a href="TensorFlow-Session.html#v:build">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:build">TensorFlow.Core</a></td></tr><tr><td class="src">BuildInputs</td><td class="module"><a href="TensorFlow-BuildOp.html#t:BuildInputs">TensorFlow.BuildOp</a></td></tr><tr><td class="src">buildInputs</td><td class="module"><a href="TensorFlow-BuildOp.html#v:buildInputs">TensorFlow.BuildOp</a></td></tr><tr><td class="src">buildOp</td><td class="module"><a href="TensorFlow-BuildOp.html#v:buildOp">TensorFlow.BuildOp</a></td></tr><tr><td class="src">BuildResult</td><td class="module"><a href="TensorFlow-BuildOp.html#t:BuildResult">TensorFlow.BuildOp</a></td></tr><tr><td class="src">buildResult</td><td class="module"><a href="TensorFlow-BuildOp.html#v:buildResult">TensorFlow.BuildOp</a></td></tr><tr><td class="src">BuildT</td><td class="module"><a href="TensorFlow-Build.html#t:BuildT">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#t:BuildT">TensorFlow.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-0.1.0.0: TensorFlow bindings. (Index - C)</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="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-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-58.html">:</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 - C</p><table><tr><td class="src">collectAllSummaries</td><td class="module"><a href="TensorFlow-Tensor.html#v:collectAllSummaries">TensorFlow.Tensor</a></td></tr><tr><td class="src">colocateWith</td><td class="module"><a href="TensorFlow-Tensor.html#v:colocateWith">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#v:colocateWith">TensorFlow.Core</a></td></tr><tr><td class="src">ControlNode</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Output.html#t:ControlNode">TensorFlow.Output</a>, <a href="TensorFlow-Build.html#t:ControlNode">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#t:ControlNode">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Output.html#v:ControlNode">TensorFlow.Output</a>, <a href="TensorFlow-Build.html#v:ControlNode">TensorFlow.Build</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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - E</p><table><tr><td class="src">encodeOutput</td><td class="module"><a href="TensorFlow-Build.html#v:encodeOutput">TensorFlow.Build</a></td></tr><tr><td class="src">encodeTensorData</td><td class="module"><a href="TensorFlow-Types.html#v:encodeTensorData">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#v:encodeTensorData">TensorFlow.Core</a></td></tr><tr><td class="src">eqLengthGuard</td><td class="module"><a href="TensorFlow-BuildOp.html#v:eqLengthGuard">TensorFlow.BuildOp</a></td></tr><tr><td class="src">evalBuildT</td><td class="module"><a href="TensorFlow-Build.html#v:evalBuildT">TensorFlow.Build</a></td></tr><tr><td class="src">ExcludedCase</td><td class="module"><a href="TensorFlow-Types.html#t:ExcludedCase">TensorFlow.Types</a></td></tr><tr><td class="src">ExplicitName</td><td class="module"><a href="TensorFlow-Output.html#v:ExplicitName">TensorFlow.Output</a></td></tr><tr><td class="src">explicitName</td><td class="module"><a href="TensorFlow-Build.html#v:explicitName">TensorFlow.Build</a></td></tr><tr><td class="src">expr</td><td class="module"><a href="TensorFlow-Tensor.html#v:expr">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#v:expr">TensorFlow.Core</a></td></tr><tr><td class="src">extend</td><td class="module"><a href="TensorFlow-Session.html#v:extend">TensorFlow.Session</a></td></tr><tr><td class="src">extendGraph</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:extendGraph">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>tensorflow-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - F</p><table><tr><td class="src">Feed</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Tensor.html#t:Feed">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#t:Feed">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Tensor.html#v:Feed">TensorFlow.Tensor</a></td></tr><tr><td class="src">feed</td><td class="module"><a href="TensorFlow-Tensor.html#v:feed">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#v:feed">TensorFlow.Core</a></td></tr><tr><td class="src">Fetch</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Nodes.html#t:Fetch">TensorFlow.Nodes</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Nodes.html#v:Fetch">TensorFlow.Nodes</a></td></tr><tr><td class="src">Fetchable</td><td class="module"><a href="TensorFlow-Nodes.html#t:Fetchable">TensorFlow.Nodes</a>, <a href="TensorFlow-Core.html#t:Fetchable">TensorFlow.Core</a></td></tr><tr><td class="src">fetches</td><td class="module"><a href="TensorFlow-Nodes.html#v:fetches">TensorFlow.Nodes</a></td></tr><tr><td class="src">fetchRestore</td><td class="module"><a href="TensorFlow-Nodes.html#v:fetchRestore">TensorFlow.Nodes</a></td></tr><tr><td class="src">fetchTensorVector</td><td class="module"><a href="TensorFlow-Nodes.html#v:fetchTensorVector">TensorFlow.Nodes</a></td></tr><tr><td class="src">flushInitializers</td><td class="module"><a href="TensorFlow-Build.html#v:flushInitializers">TensorFlow.Build</a></td></tr><tr><td class="src">flushNodeBuffer</td><td class="module"><a href="TensorFlow-Build.html#v:flushNodeBuffer">TensorFlow.Build</a></td></tr><tr><td class="src">fromTensorTypeList</td><td class="module"><a href="TensorFlow-Types.html#v:fromTensorTypeList">TensorFlow.Types</a></td></tr><tr><td class="src">fromTensorTypes</td><td class="module"><a href="TensorFlow-Types.html#v:fromTensorTypes">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>tensorflow-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - G</p><table><tr><td class="src">getAllOpList</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:getAllOpList">TensorFlow.Internal.FFI</a></td></tr><tr><td class="src">getFetch</td><td class="module"><a href="TensorFlow-Nodes.html#v:getFetch">TensorFlow.Nodes</a></td></tr><tr><td class="src">getNodes</td><td class="module"><a href="TensorFlow-Nodes.html#v:getNodes">TensorFlow.Nodes</a></td></tr><tr><td class="src">getOrAddOp</td><td class="module"><a href="TensorFlow-Build.html#v:getOrAddOp">TensorFlow.Build</a></td></tr><tr><td class="src">getVarInt</td><td class="module"><a href="TensorFlow-Internal-VarInt.html#v:getVarInt">TensorFlow.Internal.VarInt</a></td></tr><tr><td class="src">GraphState</td><td class="module"><a href="TensorFlow-Build.html#t:GraphState">TensorFlow.Build</a></td></tr><tr><td class="src">group</td><td class="module"><a href="TensorFlow-ControlFlow.html#v:group">TensorFlow.ControlFlow</a>, <a href="TensorFlow-Core.html#v:group">TensorFlow.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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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">hoistBuildT</td><td class="module"><a href="TensorFlow-Build.html#v:hoistBuildT">TensorFlow.Build</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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - I</p><table><tr><td class="src">ImplicitName</td><td class="module"><a href="TensorFlow-Output.html#v:ImplicitName">TensorFlow.Output</a></td></tr><tr><td class="src">implicitName</td><td class="module"><a href="TensorFlow-Build.html#v:implicitName">TensorFlow.Build</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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - L</p><table><tr><td class="src">List</td><td class="module"><a href="TensorFlow-Types.html#t:List">TensorFlow.Types</a></td></tr><tr><td class="src">ListOf</td><td class="module"><a href="TensorFlow-Types.html#t:ListOf">TensorFlow.Types</a></td></tr><tr><td class="src">lookupNode</td><td class="module"><a href="TensorFlow-Build.html#v:lookupNode">TensorFlow.Build</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-0.1.0.0: TensorFlow bindings. (Index - M)</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="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-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-58.html">:</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 - M</p><table><tr><td class="src">MonadBuild</td><td class="module"><a href="TensorFlow-Build.html#t:MonadBuild">TensorFlow.Build</a>, <a href="TensorFlow-Session.html#t:MonadBuild">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#t:MonadBuild">TensorFlow.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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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 - N</p><table><tr><td class="src">Nil</td><td class="module"><a href="TensorFlow-Types.html#v:Nil">TensorFlow.Types</a></td></tr><tr><td class="src">NodeName</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Output.html#t:NodeName">TensorFlow.Output</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Output.html#v:NodeName">TensorFlow.Output</a></td></tr><tr><td class="src">Nodes</td><td class="module"><a href="TensorFlow-Nodes.html#t:Nodes">TensorFlow.Nodes</a>, <a href="TensorFlow-Core.html#t:Nodes">TensorFlow.Core</a></td></tr><tr><td class="src">nodesUnion</td><td class="module"><a href="TensorFlow-Nodes.html#v:nodesUnion">TensorFlow.Nodes</a></td></tr><tr><td class="src">NoneOf</td><td class="module"><a href="TensorFlow-Types.html#t:NoneOf">TensorFlow.Types</a></td></tr><tr><td class="src">noOp</td><td class="module"><a href="TensorFlow-ControlFlow.html#v:noOp">TensorFlow.ControlFlow</a>, <a href="TensorFlow-Core.html#v:noOp">TensorFlow.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-0.1.0.0: TensorFlow bindings. (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-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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</p><table><tr><td class="src">PendingNodeName</td><td class="module"><a href="TensorFlow-Output.html#t:PendingNodeName">TensorFlow.Output</a></td></tr><tr><td class="src">protoShape</td><td class="module"><a href="TensorFlow-Types.html#v:protoShape">TensorFlow.Types</a></td></tr><tr><td class="src">pureOp</td><td class="module"><a href="TensorFlow-BuildOp.html#v:pureOp">TensorFlow.BuildOp</a></td></tr><tr><td class="src">PureResult</td><td class="module"><a href="TensorFlow-BuildOp.html#t:PureResult">TensorFlow.BuildOp</a></td></tr><tr><td class="src">pureResult</td><td class="module"><a href="TensorFlow-BuildOp.html#v:pureResult">TensorFlow.BuildOp</a></td></tr><tr><td class="src">putVarInt</td><td class="module"><a href="TensorFlow-Internal-VarInt.html#v:putVarInt">TensorFlow.Internal.VarInt</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-0.1.0.0: TensorFlow bindings. (Index - R)</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="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-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-58.html">:</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 - R</p><table><tr><td class="src">Ref</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Tensor.html#t:Ref">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#t:Ref">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Tensor.html#v:Ref">TensorFlow.Tensor</a></td></tr><tr><td class="src">render</td><td class="module"><a href="TensorFlow-Tensor.html#v:render">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#v:render">TensorFlow.Core</a></td></tr><tr><td class="src">Rendered</td><td class="module"><a href="TensorFlow-Tensor.html#t:Rendered">TensorFlow.Tensor</a></td></tr><tr><td class="src">rendered</td><td class="module"><a href="TensorFlow-Tensor.html#v:rendered">TensorFlow.Tensor</a></td></tr><tr><td class="src">renderedNodeDefs</td><td class="module"><a href="TensorFlow-Build.html#v:renderedNodeDefs">TensorFlow.Build</a></td></tr><tr><td class="src">renderedOutput</td><td class="module"><a href="TensorFlow-Tensor.html#v:renderedOutput">TensorFlow.Tensor</a></td></tr><tr><td class="src">renderValue</td><td class="module"><a href="TensorFlow-Tensor.html#v:renderValue">TensorFlow.Tensor</a></td></tr><tr><td class="src">ResourceHandle</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Output.html#t:ResourceHandle">TensorFlow.Output</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Output.html#v:ResourceHandle">TensorFlow.Output</a></td></tr><tr><td class="src">run</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Function)</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:run">TensorFlow.Internal.FFI</a></td></tr><tr><td class="alt">2 (Function)</td><td class="module"><a href="TensorFlow-Session.html#v:run">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:run">TensorFlow.Core</a></td></tr><tr><td class="src">runBuildT</td><td class="module"><a href="TensorFlow-Build.html#v:runBuildT">TensorFlow.Build</a></td></tr><tr><td class="src">runRef</td><td class="module"><a href="TensorFlow-Tensor.html#v:runRef">TensorFlow.Tensor</a></td></tr><tr><td class="src">runSession</td><td class="module"><a href="TensorFlow-Session.html#v:runSession">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:runSession">TensorFlow.Core</a></td></tr><tr><td class="src">runSessionWithOptions</td><td class="module"><a href="TensorFlow-Session.html#v:runSessionWithOptions">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:runSessionWithOptions">TensorFlow.Core</a></td></tr><tr><td class="src">runValue</td><td class="module"><a href="TensorFlow-Tensor.html#v:runValue">TensorFlow.Tensor</a></td></tr><tr><td class="src">runWithFeeds</td><td class="module"><a href="TensorFlow-Session.html#v:runWithFeeds">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:runWithFeeds">TensorFlow.Core</a></td></tr><tr><td class="src">runWithFeeds_</td><td class="module"><a href="TensorFlow-Session.html#v:runWithFeeds_">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:runWithFeeds_">TensorFlow.Core</a></td></tr><tr><td class="src">run_</td><td class="module"><a href="TensorFlow-Session.html#v:run_">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:run_">TensorFlow.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-0.1.0.0: TensorFlow bindings. (Index - S)</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="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-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-58.html">:</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 - S</p><table><tr><td class="src">Scalar</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Types.html#t:Scalar">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#t:Scalar">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Types.html#v:Scalar">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#v:Scalar">TensorFlow.Core</a></td></tr><tr><td class="src">Session</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Internal-FFI.html#t:Session">TensorFlow.Internal.FFI</a></td></tr><tr><td class="alt">2 (Type/Class)</td><td class="module"><a href="TensorFlow-Session.html#t:Session">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#t:Session">TensorFlow.Core</a></td></tr><tr><td class="src">sessionConfig</td><td class="module"><a href="TensorFlow-Session.html#v:sessionConfig">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:sessionConfig">TensorFlow.Core</a></td></tr><tr><td class="src">sessionTarget</td><td class="module"><a href="TensorFlow-Session.html#v:sessionTarget">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:sessionTarget">TensorFlow.Core</a></td></tr><tr><td class="src">sessionTracer</td><td class="module"><a href="TensorFlow-Session.html#v:sessionTracer">TensorFlow.Session</a>, <a href="TensorFlow-Core.html#v:sessionTracer">TensorFlow.Core</a></td></tr><tr><td class="src">setSessionConfig</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:setSessionConfig">TensorFlow.Internal.FFI</a></td></tr><tr><td class="src">setSessionTarget</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:setSessionTarget">TensorFlow.Internal.FFI</a></td></tr><tr><td class="src">Shape</td><td>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Types.html#t:Shape">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#t:Shape">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Types.html#v:Shape">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#v:Shape">TensorFlow.Core</a></td></tr><tr><td class="src">summaries</td><td class="module"><a href="TensorFlow-Build.html#v:summaries">TensorFlow.Build</a></td></tr><tr><td class="src">SummaryTensor</td><td class="module"><a href="TensorFlow-Tensor.html#t:SummaryTensor">TensorFlow.Tensor</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-0.1.0.0: TensorFlow bindings. (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">tensorflow-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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-Output.html#v:unControlNode">TensorFlow.Output</a>, <a href="TensorFlow-Build.html#v:unControlNode">TensorFlow.Build</a></td></tr><tr><td class="src">Unique</td><td class="module"><a href="TensorFlow-Build.html#t:Unique">TensorFlow.Build</a></td></tr><tr><td class="src">unNodeName</td><td class="module"><a href="TensorFlow-Output.html#v:unNodeName">TensorFlow.Output</a></td></tr><tr><td class="src">unOpType</td><td class="module"><a href="TensorFlow-Output.html#v:unOpType">TensorFlow.Output</a></td></tr><tr><td class="src">unOutputIx</td><td class="module"><a href="TensorFlow-Output.html#v:unOutputIx">TensorFlow.Output</a></td></tr><tr><td class="src">unScalar</td><td class="module"><a href="TensorFlow-Types.html#v:unScalar">TensorFlow.Types</a>, <a href="TensorFlow-Core.html#v:unScalar">TensorFlow.Core</a></td></tr><tr><td class="src">unTensorData</td><td class="module"><a href="TensorFlow-Types.html#v:unTensorData">TensorFlow.Types</a></td></tr><tr><td class="src">useProtoAsVoidPtrLen</td><td class="module"><a href="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>tensorflow-0.1.0.0: TensorFlow bindings. (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">tensorflow-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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>&nbsp;</td></tr><tr><td class="alt">1 (Type/Class)</td><td class="module"><a href="TensorFlow-Tensor.html#t:Value">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#t:Value">TensorFlow.Core</a></td></tr><tr><td class="alt">2 (Data Constructor)</td><td class="module"><a href="TensorFlow-Tensor.html#v:Value">TensorFlow.Tensor</a></td></tr><tr><td class="src">value</td><td class="module"><a href="TensorFlow-Tensor.html#v:value">TensorFlow.Tensor</a>, <a href="TensorFlow-Core.html#v:value">TensorFlow.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-0.1.0.0: TensorFlow bindings. (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">tensorflow-0.1.0.0: TensorFlow bindings.</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-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-58.html">:</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">withControlDependencies</td><td class="module"><a href="TensorFlow-ControlFlow.html#v:withControlDependencies">TensorFlow.ControlFlow</a>, <a href="TensorFlow-Core.html#v:withControlDependencies">TensorFlow.Core</a></td></tr><tr><td class="src">withDevice</td><td class="module"><a href="TensorFlow-Build.html#v:withDevice">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#v:withDevice">TensorFlow.Core</a></td></tr><tr><td class="src">withNameScope</td><td class="module"><a href="TensorFlow-Build.html#v:withNameScope">TensorFlow.Build</a>, <a href="TensorFlow-Core.html#v:withNameScope">TensorFlow.Core</a></td></tr><tr><td class="src">withNodeDependencies</td><td class="module"><a href="TensorFlow-Build.html#v:withNodeDependencies">TensorFlow.Build</a></td></tr><tr><td class="src">withSession</td><td class="module"><a href="TensorFlow-Internal-FFI.html#v:withSession">TensorFlow.Internal.FFI</a></td></tr><tr><td class="src">withStateLens</td><td class="module"><a href="TensorFlow-Build.html#v:withStateLens">TensorFlow.Build</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

@ -1,4 +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>
</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: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"><span class="keyword">class</span> <a href="TensorFlow-Build.html#t:MonadBuild" target="main">MonadBuild</a> m</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><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:summaries" target="main">summaries</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:encodeOutput" target="main">encodeOutput</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Build.html#v:lookupNode" target="main">lookupNode</a></p></div><h1>Modifying all nodes in a Build action</h1><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></div></body></html>

View file

@ -1,4 +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>
</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:BuildResult" target="main">BuildResult</a> a</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"><span class="keyword">class</span> <a href="TensorFlow-BuildOp.html#t:PureResult" target="main">PureResult</a> a</p></div><div class="top"><p class="src"><a href="TensorFlow-BuildOp.html#v:pureOp" target="main">pureOp</a></p></div><div class="top"><p class="src"><a href="TensorFlow-BuildOp.html#v:eqLengthGuard" target="main">eqLengthGuard</a></p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-BuildOp.html#t:BuildInputs" target="main">BuildInputs</a> a</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-BuildOp.html#t:OpParams" target="main">OpParams</a></p></div></div></body></html>

View file

@ -1,4 +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>
</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:noOp" target="main">noOp</a></p></div></div></body></html>

File diff suppressed because one or more lines are too long

View file

@ -1,4 +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>
</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:fetchTensorVector" target="main">fetchTensorVector</a></p></div></div></body></html>

View file

@ -1,4 +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 class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:ResourceHandle" target="main">ResourceHandle</a> a</p></div></div></body></html>
</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: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"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:PendingNodeName" target="main">PendingNodeName</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Output.html#t:ResourceHandle" target="main">ResourceHandle</a></p></div></div></body></html>

View file

@ -1,4 +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><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Session.html#t:Options" target="main">Options</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:sessionTracer" target="main">sessionTracer</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>
</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><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Session.html#t:Options" target="main">Options</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:sessionTracer" target="main">sessionTracer</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"><span class="keyword">class</span> <a href="TensorFlow-Session.html#t:MonadBuild" target="main">MonadBuild</a> m</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

@ -1,4 +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>
</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> 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> 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"><a href="TensorFlow-Tensor.html#v:renderValue" target="main">renderValue</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"><span class="keyword">class</span> <a href="TensorFlow-Tensor.html#t:Rendered" target="main">Rendered</a> v</p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:renderedOutput" target="main">renderedOutput</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorNodeName" target="main">tensorNodeName</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 class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorValueFromName" target="main">tensorValueFromName</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorRefFromName" target="main">tensorRefFromName</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Tensor.html#t:TensorList" target="main">TensorList</a> v</p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:tensorListOutputs" target="main">tensorListOutputs</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:colocateWith" target="main">colocateWith</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:render" target="main">render</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:expr" target="main">expr</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:addSummary" target="main">addSummary</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Tensor.html#v:collectAllSummaries" target="main">collectAllSummaries</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Tensor.html#t:SummaryTensor" target="main">SummaryTensor</a></p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Tensor.html#t:TensorKind" target="main">TensorKind</a> v</p></div></div></body></html>

View file

@ -1,4 +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>
</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">class</span> <a href="TensorFlow-Types.html#t:TensorDataType" target="main">TensorDataType</a> s a</p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:Scalar" target="main">Scalar</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><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:DataType" target="main">DataType</a></p></div><h1>Lists</h1><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:ListOf" target="main">ListOf</a> f as</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Types.html#t:List" target="main">List</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Types.html#v:-47-:-47-" target="main">(/:/)</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a href="TensorFlow-Types.html#t:TensorTypeProxy" target="main">TensorTypeProxy</a> a</p></div><div class="top"><p class="src"><span class="keyword">class</span> <a href="TensorFlow-Types.html#t:TensorTypes" target="main">TensorTypes</a> ts</p></div><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Types.html#t:TensorTypeList" target="main">TensorTypeList</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Types.html#v:fromTensorTypeList" target="main">fromTensorTypeList</a></p></div><div class="top"><p class="src"><a href="TensorFlow-Types.html#v:fromTensorTypes" target="main">fromTensorTypes</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><div class="top"><p class="src"><span class="keyword">type</span> <a href="TensorFlow-Types.html#t:OneOfs" target="main">OneOfs</a> ts as</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: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>

View file

@ -1,387 +0,0 @@
<?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

@ -1,222 +0,0 @@
<?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-conid'>Tensor</span> <span class='hs-varid'>v</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>recordResult</span>
<a name="line-81"></a>
<a name="line-82"></a><a name="recordResult"></a><span class='hs-definition'>recordResult</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Result</span> <span class='hs-conid'>Output</span>
<a name="line-83"></a><span class='hs-definition'>recordResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-84"></a> <span class='hs-varid'>o</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>ask</span>
<a name="line-85"></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-86"></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-87"></a> <span class='hs-varid'>return</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-88"></a>
<a name="line-89"></a><a name="instance%20OpResult%20(ResourceHandle%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>OpResult</span> <span class='hs-layout'>(</span><span class='hs-conid'>ResourceHandle</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-conid'>ResourceHandle</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>recordResult</span>
<a name="line-91"></a>
<a name="line-92"></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-93"></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-94"></a>
<a name="line-95"></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-96"></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-97"></a>
<a name="line-98"></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-99"></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-100"></a>
<a name="line-101"></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-102"></a> <span class='hs-varid'>toResult</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-103"></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-104"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>ns</span> <span class='hs-keyword'>of</span>
<a name="line-105"></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-106"></a> <span class='hs-str'>"Likely misuse of buildListOp."</span>
<a name="line-107"></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-108"></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-109"></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-110"></a>
<a name="line-111"></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-112"></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-113"></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-114"></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-115"></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-116"></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-117"></a>
<a name="line-118"></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-119"></a><span class='hs-comment'>-- the same scope.</span>
<a name="line-120"></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-121"></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-122"></a>
<a name="line-123"></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-124"></a><span class='hs-comment'>-- identical ops.</span>
<a name="line-125"></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-126"></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-127"></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-128"></a>
<a name="line-129"></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-130"></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-131"></a>
<a name="line-132"></a><a name="OpDef"></a><span class='hs-comment'>-- | Class of types that can be used as op functions.</span>
<a name="line-133"></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-134"></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-135"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>OpDef</span>
<a name="line-136"></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-137"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>f</span>
<a name="line-138"></a>
<a name="line-139"></a><a name="buildOp"></a><span class='hs-comment'>-- | Starts an operation that returns a structured set of tensors</span>
<a name="line-140"></a><span class='hs-comment'>-- (singletons or tuples).</span>
<a name="line-141"></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-142"></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-143"></a>
<a name="line-144"></a><a name="buildListOp"></a><span class='hs-comment'>-- | Starts an operation that returns a list of tensors.</span>
<a name="line-145"></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-146"></a> <span class='hs-comment'>-- ^ Cardinality of the corresponding list of tensors output.</span>
<a name="line-147"></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-148"></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-149"></a>
<a name="line-150"></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-151"></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-152"></a>
<a name="line-153"></a><a name="instance%20BuildOp%20(ResourceHandle%20a)"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>BuildOp</span> <span class='hs-layout'>(</span><span class='hs-conid'>ResourceHandle</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</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(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-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(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-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%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-163"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-164"></a>
<a name="line-165"></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-166"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-167"></a>
<a name="line-168"></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-169"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-170"></a>
<a name="line-171"></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-172"></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-173"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-174"></a>
<a name="line-175"></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-176"></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-177"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-178"></a>
<a name="line-179"></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-180"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t2</span>
<a name="line-181"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t3</span>
<a name="line-182"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t4</span>
<a name="line-183"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t5</span>
<a name="line-184"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OpResult</span> <span class='hs-varid'>t6</span>
<a name="line-185"></a> <span class='hs-layout'>)</span>
<a name="line-186"></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-187"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>pureResult</span>
<a name="line-188"></a>
<a name="line-189"></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-190"></a> <span class='hs-varid'>buildOp'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>buildResult</span>
<a name="line-191"></a>
<a name="line-192"></a><a name="instance%20BuildOp%20(ResourceHandle%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'>ResourceHandle</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-193"></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-layout'>(</span><span class='hs-conid'>ResourceHandle</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</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-conop'>:</span> <span class='hs-varid'>ts</span><span class='hs-layout'>)</span>
<a name="line-194"></a>
<a name="line-195"></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-196"></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-197"></a>
<a name="line-198"></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-199"></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-200"></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-201"></a>
<a name="line-202"></a><a name="eqLengthGuard"></a><span class='hs-comment'>-- | Returns true if all the integers in each tuple are identical.</span>
<a name="line-203"></a><span class='hs-comment'>-- Throws an error with a descriptive message if not.</span>
<a name="line-204"></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-205"></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-206"></a> <span class='hs-keyword'>where</span>
<a name="line-207"></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-208"></a> <span class='hs-comment'>-- The next line has (== 1) . length . nub in disguise</span>
<a name="line-209"></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-210"></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-211"></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

@ -1,98 +0,0 @@
<?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

@ -1,104 +0,0 @@
<?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/Core.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 ExplicitNamespaces #-}</span>
<a name="line-16"></a>
<a name="line-17"></a><span class='hs-comment'>-- | The core functionality of TensorFlow.</span>
<a name="line-18"></a><span class='hs-comment'>--</span>
<a name="line-19"></a><span class='hs-comment'>-- Unless you are defining ops, you do not need to import other modules from</span>
<a name="line-20"></a><span class='hs-comment'>-- this package.</span>
<a name="line-21"></a><span class='hs-comment'>--</span>
<a name="line-22"></a><span class='hs-comment'>-- Basic ops are provided in the tensorflow-ops and tensorflow-core-ops</span>
<a name="line-23"></a><span class='hs-comment'>-- packages.</span>
<a name="line-24"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Core</span>
<a name="line-25"></a> <span class='hs-layout'>(</span> <span class='hs-comment'>-- * Session</span>
<a name="line-26"></a> <span class='hs-conid'>Session</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Options</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>sessionConfig</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>sessionTarget</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>sessionTracer</span>
<a name="line-31"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>runSession</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>runSessionWithOptions</span>
<a name="line-33"></a> <span class='hs-comment'>-- ** Building graphs</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>build</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>buildAnd</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>buildWithSummary</span>
<a name="line-37"></a> <span class='hs-comment'>-- ** Running graphs</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Fetchable</span>
<a name="line-39"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Scalar</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-40"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Nodes</span>
<a name="line-41"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>run</span>
<a name="line-42"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>run_</span>
<a name="line-43"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Feed</span>
<a name="line-44"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>feed</span>
<a name="line-45"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>runWithFeeds</span>
<a name="line-46"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>runWithFeeds_</span>
<a name="line-47"></a> <span class='hs-comment'>-- ** Async</span>
<a name="line-48"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>asyncProdNodes</span>
<a name="line-49"></a>
<a name="line-50"></a> <span class='hs-comment'>-- * Build</span>
<a name="line-51"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Build</span>
<a name="line-52"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>BuildT</span>
<a name="line-53"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>render</span>
<a name="line-54"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>asGraphDef</span>
<a name="line-55"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>addGraphDef</span>
<a name="line-56"></a>
<a name="line-57"></a> <span class='hs-comment'>-- * Tensor</span>
<a name="line-58"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>ControlNode</span>
<a name="line-59"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Tensor</span>
<a name="line-60"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Value</span>
<a name="line-61"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Ref</span>
<a name="line-62"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorKind</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-63"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tensorAttr</span>
<a name="line-64"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>value</span>
<a name="line-65"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tensorFromName</span>
<a name="line-66"></a> <span class='hs-comment'>-- ** Element types</span>
<a name="line-67"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorData</span>
<a name="line-68"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>TensorType</span><span class='hs-layout'>(</span><span class='hs-varid'>decodeTensorData</span><span class='hs-layout'>,</span> <span class='hs-varid'>encodeTensorData</span><span class='hs-layout'>)</span>
<a name="line-69"></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-70"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>OneOf</span>
<a name="line-71"></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-72"></a>
<a name="line-73"></a> <span class='hs-comment'>-- * Op combinators</span>
<a name="line-74"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>colocateWith</span>
<a name="line-75"></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-76"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withDevice</span>
<a name="line-77"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withNameScope</span>
<a name="line-78"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>named</span>
<a name="line-79"></a> <span class='hs-comment'>-- ** Dependencies</span>
<a name="line-80"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withControlDependencies</span>
<a name="line-81"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>group</span>
<a name="line-82"></a> <span class='hs-comment'>-- ** Misc</span>
<a name="line-83"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>identity</span>
<a name="line-84"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>noOp</span>
<a name="line-85"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-86"></a>
<a name="line-87"></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-88"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>ControlFlow</span>
<a name="line-89"></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-90"></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-91"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Session</span>
<a name="line-92"></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-93"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>TensorFlow</span><span class='hs-varop'>.</span><span class='hs-conid'>Types</span>
</pre></body>
</html>

View file

@ -1,268 +0,0 @@
<?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><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</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'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>FFI</span>
<a name="line-20"></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-21"></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-22"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withSession</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>extendGraph</span>
<a name="line-24"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>run</span>
<a name="line-25"></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-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>setSessionConfig</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>setSessionTarget</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>getAllOpList</span>
<a name="line-29"></a> <span class='hs-comment'>-- * Internal helper.</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>useProtoAsVoidPtrLen</span>
<a name="line-31"></a> <span class='hs-layout'>)</span>
<a name="line-32"></a> <span class='hs-keyword'>where</span>
<a name="line-33"></a>
<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'>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-35"></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-36"></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-37"></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-38"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Bits</span> <span class='hs-layout'>(</span><span class='hs-conid'>Bits</span><span class='hs-layout'>,</span> <span class='hs-varid'>toIntegralSized</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'>Int</span> <span class='hs-layout'>(</span><span class='hs-conid'>Int64</span><span class='hs-layout'>)</span>
<a name="line-40"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromMaybe</span><span class='hs-layout'>)</span>
<a name="line-41"></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-42"></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-43"></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-44"></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-45"></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-46"></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-47"></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-48"></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-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'>ByteString</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>B</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'>Text</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>T</span>
<a name="line-51"></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-52"></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-53"></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-54"></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'>Concurrent</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>ForeignC</span>
<a name="line-55"></a>
<a name="line-56"></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-57"></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-58"></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-59"></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-60"></a>
<a name="line-61"></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-62"></a>
<a name="line-63"></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-64"></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-65"></a>
<a name="line-66"></a><a name="instance%20Exception%20TensorFlowException%20--%20%7c%20All%20of%20the%20data%20needed%20to%20represent%20a%20tensor.%20data%20TensorData%20=%20TensorData%20%7b%20tensorDataDimensions%20::%20%5bInt64%5d%20,%20tensorDataType%20::%20!DataType%20,%20tensorDataBytes%20::%20!(S.Vector%20Word8)%20%7d%20deriving%20(Show,%20Eq)%20--%20%7c%20Runs%20the%20given%20action%20after%20creating%20a%20session%20with%20options%20--%20populated%20by%20the%20given%20optionSetter.%20withSession%20::%20(Raw.SessionOptions%20-%3e%20IO%20())%20-%3e%20((IO%20()%20-%3e%20IO%20())%20-%3e%20Raw.Session%20-%3e%20IO%20a)%20--%20%5e%20The%20action%20can%20spawn%20concurrent%20tasks%20which%20will%20--%20be%20canceled%20before%20withSession%20returns.%20-%3e%20IO%20a%20withSession%20optionSetter%20action%20=%20do%20drain%20%3c-%20newMVar%20%5b%5d%20let%20cleanup%20s%20=%20--%20Closes%20the%20session%20to%20nudge%20the%20pending%20run%20calls%20to%20fail%20and%20exit.%20finally%20(checkStatus%20(Raw.closeSession%20s))%20$%20do%20runners%20%3c-%20takeMVar%20drain%20--%20Collects%20all%20runners%20before%20deleting%20the%20session.%20mapM_%20shutDownRunner%20runners%20checkStatus%20(Raw.deleteSession%20s)%20bracket%20Raw.newSessionOptions%20Raw.deleteSessionOptions%20$%20%5coptions%20-%3e%20do%20optionSetter%20options%20bracket%20(checkStatus%20(Raw.newSession%20options))%20cleanup%20(action%20(asyncCollector%20drain))%20asyncCollector%20::%20MVar%20%5bAsync%20()%5d%20-%3e%20IO%20()%20-%3e%20IO%20()%20asyncCollector%20drain%20runner%20=%20modifyMVarMasked_%20drain%20launchAndRecord"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Exception</span> <span class='hs-conid'>TensorFlowException</span>
<a name="line-67"></a>
<a name="line-68"></a><a name="TensorData"></a><span class='hs-comment'>-- | All of the data needed to represent a tensor.</span>
<a name="line-69"></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-70"></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-71"></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-72"></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-73"></a> <span class='hs-layout'>}</span>
<a name="line-74"></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-75"></a>
<a name="line-76"></a><a name="withSession"></a><span class='hs-comment'>-- | Runs the given action after creating a session with options</span>
<a name="line-77"></a><span class='hs-comment'>-- populated by the given optionSetter.</span>
<a name="line-78"></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-79"></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-80"></a> <span class='hs-comment'>-- ^ The action can spawn concurrent tasks which will</span>
<a name="line-81"></a> <span class='hs-comment'>-- be canceled before withSession returns.</span>
<a name="line-82"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-varid'>a</span>
<a name="line-83"></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-84"></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-85"></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-86"></a> <span class='hs-comment'>-- Closes the session to nudge the pending run calls to fail and exit.</span>
<a name="line-87"></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-88"></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-89"></a> <span class='hs-comment'>-- Collects all runners before deleting the session.</span>
<a name="line-90"></a> <span class='hs-varid'>mapM_</span> <span class='hs-varid'>shutDownRunner</span> <span class='hs-varid'>runners</span>
<a name="line-91"></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-92"></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-93"></a> <span class='hs-varid'>optionSetter</span> <span class='hs-varid'>options</span>
<a name="line-94"></a> <span class='hs-varid'>bracket</span>
<a name="line-95"></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-96"></a> <span class='hs-varid'>cleanup</span>
<a name="line-97"></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-98"></a>
<a name="line-99"></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-100"></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-101"></a> <span class='hs-keyword'>where</span>
<a name="line-102"></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-103"></a>
<a name="line-104"></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-105"></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-106"></a> <span class='hs-varid'>cancel</span> <span class='hs-varid'>r</span>
<a name="line-107"></a> <span class='hs-comment'>-- TODO(gnezdo): manage exceptions better than print.</span>
<a name="line-108"></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-109"></a>
<a name="line-110"></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-111"></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-112"></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-113"></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-114"></a>
<a name="line-115"></a>
<a name="line-116"></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-117"></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-118"></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-119"></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-120"></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-121"></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-122"></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-123"></a> <span class='hs-comment'>-- Use mask to avoid leaking input tensors before they are passed to 'run'</span>
<a name="line-124"></a> <span class='hs-comment'>-- and output tensors before they are passed to 'createTensorData'.</span>
<a name="line-125"></a> <span class='hs-varid'>mask_</span> <span class='hs-varop'>$</span>
<a name="line-126"></a> <span class='hs-comment'>-- Feeds</span>
<a name="line-127"></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-128"></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-129"></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-130"></a> <span class='hs-comment'>-- Fetches.</span>
<a name="line-131"></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-132"></a> <span class='hs-comment'>-- tensorOuts is an array of null Tensor pointers that will be filled</span>
<a name="line-133"></a> <span class='hs-comment'>-- by the call to Raw.run.</span>
<a name="line-134"></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-135"></a> <span class='hs-comment'>-- Targets.</span>
<a name="line-136"></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-137"></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-138"></a> <span class='hs-varid'>session</span>
<a name="line-139"></a> <span class='hs-varid'>nullPtr</span>
<a name="line-140"></a> <span class='hs-varid'>feedNames</span> <span class='hs-varid'>cFeedTensors</span> <span class='hs-layout'>(</span><span class='hs-varid'>safeConvert</span> <span class='hs-varid'>feedsLen</span><span class='hs-layout'>)</span>
<a name="line-141"></a> <span class='hs-varid'>fetchNames</span> <span class='hs-varid'>tensorOuts</span> <span class='hs-layout'>(</span><span class='hs-varid'>safeConvert</span> <span class='hs-varid'>fetchesLen</span><span class='hs-layout'>)</span>
<a name="line-142"></a> <span class='hs-varid'>ctargets</span> <span class='hs-layout'>(</span><span class='hs-varid'>safeConvert</span> <span class='hs-varid'>targetsLen</span><span class='hs-layout'>)</span>
<a name="line-143"></a> <span class='hs-varid'>nullPtr</span>
<a name="line-144"></a> <span class='hs-varid'>mapM_</span> <span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteTensor</span> <span class='hs-varid'>feedTensors</span>
<a name="line-145"></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-146"></a> <span class='hs-varid'>mapM</span> <span class='hs-varid'>createTensorData</span> <span class='hs-varid'>outTensors</span>
<a name="line-147"></a>
<a name="line-148"></a>
<a name="line-149"></a><span class='hs-comment'>-- Internal.</span>
<a name="line-150"></a>
<a name="line-151"></a>
<a name="line-152"></a><a name="safeConvert"></a><span class='hs-comment'>-- | Same as 'fromIntegral', but throws an error if conversion is "lossy".</span>
<a name="line-153"></a><span class='hs-definition'>safeConvert</span> <span class='hs-keyglyph'>::</span>
<a name="line-154"></a> <span class='hs-keyword'>forall</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span><span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-conid'>Show</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-varid'>b</span><span class='hs-layout'>,</span> <span class='hs-conid'>Bits</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Bits</span> <span class='hs-varid'>b</span><span class='hs-layout'>,</span> <span class='hs-conid'>Integral</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Integral</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span>
<a name="line-155"></a> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>b</span>
<a name="line-156"></a><span class='hs-definition'>safeConvert</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span>
<a name="line-157"></a> <span class='hs-varid'>fromMaybe</span>
<a name="line-158"></a> <span class='hs-layout'>(</span><span class='hs-varid'>error</span> <span class='hs-layout'>(</span><span class='hs-str'>"Failed to convert "</span> <span class='hs-varop'>++</span> <span class='hs-varid'>show</span> <span class='hs-varid'>x</span> <span class='hs-varop'>++</span> <span class='hs-str'>", got "</span> <span class='hs-varop'>++</span>
<a name="line-159"></a> <span class='hs-varid'>show</span> <span class='hs-layout'>(</span><span class='hs-varid'>fromIntegral</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-160"></a> <span class='hs-layout'>(</span><span class='hs-varid'>toIntegralSized</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-161"></a>
<a name="line-162"></a>
<a name="line-163"></a><a name="withStringList"></a><span class='hs-comment'>-- | Use a list of ByteString as a list of CString.</span>
<a name="line-164"></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-165"></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-166"></a> <span class='hs-keyword'>where</span>
<a name="line-167"></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-168"></a> <span class='hs-comment'>-- TODO(fmayle): Is it worth using unsafeAsCString here?</span>
<a name="line-169"></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-170"></a>
<a name="line-171"></a>
<a name="line-172"></a><a name="withStringArrayLen"></a><span class='hs-comment'>-- | Use a list of ByteString as an array of CString.</span>
<a name="line-173"></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-174"></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-175"></a>
<a name="line-176"></a>
<a name="line-177"></a><a name="createRawTensor"></a><span class='hs-comment'>-- | Create a Raw.Tensor from a TensorData.</span>
<a name="line-178"></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-179"></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-180"></a> <span class='hs-varid'>withArrayLen</span> <span class='hs-layout'>(</span><span class='hs-varid'>map</span> <span class='hs-varid'>safeConvert</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-181"></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-182"></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-183"></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-184"></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-185"></a> <span class='hs-varid'>cdims</span> <span class='hs-layout'>(</span><span class='hs-varid'>safeConvert</span> <span class='hs-varid'>cdimsLen</span><span class='hs-layout'>)</span>
<a name="line-186"></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'>safeConvert</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-187"></a> <span class='hs-varid'>tensorDeallocFunPtr</span> <span class='hs-varid'>nullPtr</span>
<a name="line-188"></a>
<a name="line-189"></a><a name="tensorDeallocFunPtr"></a><span class='hs-comment'>{-# NOINLINE tensorDeallocFunPtr #-}</span>
<a name="line-190"></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-191"></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-192"></a>
<a name="line-193"></a><a name="createTensorData"></a><span class='hs-comment'>-- | Create a TensorData from a Raw.Tensor.</span>
<a name="line-194"></a><span class='hs-comment'>--</span>
<a name="line-195"></a><span class='hs-comment'>-- Takes ownership of the Raw.Tensor.</span>
<a name="line-196"></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-197"></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-198"></a> <span class='hs-comment'>-- Read dimensions.</span>
<a name="line-199"></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-200"></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-201"></a> <span class='hs-comment'>-- Read type.</span>
<a name="line-202"></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-203"></a> <span class='hs-comment'>-- Read data.</span>
<a name="line-204"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>safeConvert</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-205"></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-206"></a> <span class='hs-varid'>fp</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-conid'>ForeignC</span><span class='hs-varop'>.</span><span class='hs-varid'>newForeignPtr</span> <span class='hs-varid'>bytes</span> <span class='hs-layout'>(</span><span class='hs-conid'>Raw</span><span class='hs-varop'>.</span><span class='hs-varid'>deleteTensor</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
<a name="line-207"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>v</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>S</span><span class='hs-varop'>.</span><span class='hs-varid'>unsafeFromForeignPtr0</span> <span class='hs-varid'>fp</span> <span class='hs-varid'>len</span>
<a name="line-208"></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'>safeConvert</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-209"></a>
<a name="line-210"></a><a name="checkStatus"></a><span class='hs-comment'>-- | Runs the given action which does FFI calls updating a provided</span>
<a name="line-211"></a><span class='hs-comment'>-- status object. If the status is not OK it is thrown as</span>
<a name="line-212"></a><span class='hs-comment'>-- TensorFlowException.</span>
<a name="line-213"></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-214"></a><span class='hs-definition'>checkStatus</span> <span class='hs-varid'>fn</span> <span class='hs-keyglyph'>=</span>
<a name="line-215"></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-216"></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-217"></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-218"></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-219"></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-220"></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-221"></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-222"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>result</span>
<a name="line-223"></a>
<a name="line-224"></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-225"></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-226"></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-227"></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-228"></a>
<a name="line-229"></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-230"></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-231"></a>
<a name="line-232"></a><a name="useProtoAsVoidPtrLen"></a><span class='hs-comment'>-- | Serializes the given msg and provides it as (ptr,len) argument</span>
<a name="line-233"></a><span class='hs-comment'>-- to the given action.</span>
<a name="line-234"></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'>Integral</span> <span class='hs-varid'>c</span><span class='hs-layout'>,</span> <span class='hs-conid'>Show</span> <span class='hs-varid'>c</span><span class='hs-layout'>,</span> <span class='hs-conid'>Bits</span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span>
<a name="line-235"></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-236"></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-237"></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'>safeConvert</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-238"></a>
<a name="line-239"></a><a name="getAllOpList"></a><span class='hs-comment'>-- | Returns the serialized OpList of all OpDefs defined in this</span>
<a name="line-240"></a><span class='hs-comment'>-- address space.</span>
<a name="line-241"></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-242"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-243"></a> <span class='hs-varid'>foreignPtr</span> <span class='hs-keyglyph'>&lt;-</span>
<a name="line-244"></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-245"></a> <span class='hs-comment'>-- Makes a copy because it is more reliable than eviscerating</span>
<a name="line-246"></a> <span class='hs-comment'>-- Buffer to steal its memory (including custom deallocator).</span>
<a name="line-247"></a> <span class='hs-varid'>withForeignPtr</span> <span class='hs-varid'>foreignPtr</span> <span class='hs-varop'>$</span>
<a name="line-248"></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-249"></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-250"></a> <span class='hs-varop'>&lt;*&gt;</span> <span class='hs-layout'>(</span><span class='hs-varid'>safeConvert</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-251"></a> <span class='hs-keyword'>where</span>
<a name="line-252"></a> <span class='hs-varid'>checkCall</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-253"></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-254"></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-255"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>p</span>
<a name="line-256"></a> <span class='hs-varid'>exception</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>TensorFlowException</span>
<a name="line-257"></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

@ -1,522 +0,0 @@
<?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-osx/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="CInt64"></a><span class='hs-comment'>-- A synonym for the int64_t type, which is used in the TensorFlow API.</span>
<a name="line-318"></a><a name="CInt64"></a><span class='hs-comment'>-- On some platforms it's `long`; on others (e.g., Mac OS X) it's `long long`;</span>
<a name="line-319"></a><a name="CInt64"></a><span class='hs-comment'>-- and as far as Haskell is concerned, those are distinct types (`CLong` vs</span>
<a name="line-320"></a><a name="CInt64"></a><span class='hs-comment'>-- `CLLong`).</span>
<a name="line-321"></a><a name="CInt64"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>CInt64</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'>CLLong</span><span class='hs-layout'>)</span>
<a name="line-322"></a><span class='hs-comment'>{-# LINE 70 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-323"></a>
<a name="line-324"></a>
<a name="line-325"></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-326"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Ptr</span> <span class='hs-conid'>CInt64</span> <span class='hs-comment'>-- dimensions array</span>
<a name="line-327"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CInt</span> <span class='hs-comment'>-- num dimensions</span>
<a name="line-328"></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-329"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>CULong</span> <span class='hs-comment'>-- data len</span>
<a name="line-330"></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-331"></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-332"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Tensor</span>
<a name="line-333"></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-334"></a>
<a name="line-335"></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-336"></a><span class='hs-definition'>deleteTensor</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteTensor</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="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-341"></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-342"></a>
<a name="line-343"></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-344"></a><span class='hs-definition'>numDims</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNumDims</span>
<a name="line-345"></a><span class='hs-comment'>{-# LINE 89 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-346"></a>
<a name="line-347"></a>
<a name="line-348"></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'>CInt64</span>
<a name="line-349"></a><span class='hs-definition'>dim</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDim</span>
<a name="line-350"></a><span class='hs-comment'>{-# LINE 92 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-351"></a>
<a name="line-352"></a>
<a name="line-353"></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-354"></a><span class='hs-definition'>tensorByteSize</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFTensorByteSize</span>
<a name="line-355"></a><span class='hs-comment'>{-# LINE 95 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-356"></a>
<a name="line-357"></a>
<a name="line-358"></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-359"></a><span class='hs-definition'>tensorData</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFTensorData</span>
<a name="line-360"></a><span class='hs-comment'>{-# LINE 98 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-361"></a>
<a name="line-362"></a>
<a name="line-363"></a>
<a name="line-364"></a><a name="SessionOptions"></a><span class='hs-comment'>-- Session Options.</span>
<a name="line-365"></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-366"></a><span class='hs-comment'>{-# LINE 102 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-367"></a>
<a name="line-368"></a>
<a name="line-369"></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-370"></a><span class='hs-definition'>newSessionOptions</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewSessionOptions</span>
<a name="line-371"></a><span class='hs-comment'>{-# LINE 105 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-372"></a>
<a name="line-373"></a>
<a name="line-374"></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-375"></a><span class='hs-definition'>setTarget</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFSetTarget</span>
<a name="line-376"></a><span class='hs-comment'>{-# LINE 108 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-377"></a>
<a name="line-378"></a>
<a name="line-379"></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-380"></a><span class='hs-definition'>setConfig</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFSetConfig</span>
<a name="line-381"></a><span class='hs-comment'>{-# LINE 111 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-382"></a>
<a name="line-383"></a>
<a name="line-384"></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-385"></a><span class='hs-definition'>deleteSessionOptions</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteSessionOptions</span>
<a name="line-386"></a><span class='hs-comment'>{-# LINE 114 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-387"></a>
<a name="line-388"></a>
<a name="line-389"></a>
<a name="line-390"></a><a name="Session"></a><span class='hs-comment'>-- Session.</span>
<a name="line-391"></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-392"></a><span class='hs-comment'>{-# LINE 118 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-393"></a>
<a name="line-394"></a>
<a name="line-395"></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-396"></a><span class='hs-definition'>newSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFNewDeprecatedSession</span>
<a name="line-397"></a><span class='hs-comment'>{-# LINE 121 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-398"></a>
<a name="line-399"></a>
<a name="line-400"></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-401"></a><span class='hs-definition'>closeSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFCloseDeprecatedSession</span>
<a name="line-402"></a><span class='hs-comment'>{-# LINE 124 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-403"></a>
<a name="line-404"></a>
<a name="line-405"></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-406"></a><span class='hs-definition'>deleteSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFDeleteDeprecatedSession</span>
<a name="line-407"></a><span class='hs-comment'>{-# LINE 127 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-408"></a>
<a name="line-409"></a>
<a name="line-410"></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-411"></a><span class='hs-definition'>extendGraph</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFExtendGraph</span>
<a name="line-412"></a><span class='hs-comment'>{-# LINE 130 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-413"></a>
<a name="line-414"></a>
<a name="line-415"></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-416"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-comment'>-- RunOptions proto.</span>
<a name="line-417"></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-418"></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-419"></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-420"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>BufferPtr</span> <span class='hs-comment'>-- RunMetadata proto.</span>
<a name="line-421"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Status</span>
<a name="line-422"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-423"></a><span class='hs-definition'>run</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFRun</span>
<a name="line-424"></a><span class='hs-comment'>{-# LINE 140 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-425"></a>
<a name="line-426"></a>
<a name="line-427"></a><a name="TensorDeallocFn"></a><span class='hs-comment'>-- FFI helpers.</span>
<a name="line-428"></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-429"></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-430"></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-431"></a>
<a name="line-432"></a>
<a name="line-433"></a><a name="getAllOpList"></a><span class='hs-comment'>-- | Get the OpList of all OpDefs defined in this address space.</span>
<a name="line-434"></a><span class='hs-comment'>-- Returns a BufferPtr, ownership of which is transferred to the caller</span>
<a name="line-435"></a><span class='hs-comment'>-- (and can be freed using deleteBuffer).</span>
<a name="line-436"></a><span class='hs-comment'>--</span>
<a name="line-437"></a><span class='hs-comment'>-- The data in the buffer will be the serialized OpList proto for ops registered</span>
<a name="line-438"></a><span class='hs-comment'>-- in this address space.</span>
<a name="line-439"></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-440"></a><span class='hs-definition'>getAllOpList</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tFGetAllOpList</span>
<a name="line-441"></a><span class='hs-comment'>{-# LINE 155 "src/TensorFlow/Internal/Raw.chs" #-}</span>
<a name="line-442"></a>
<a name="line-443"></a>
<a name="line-444"></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-445"></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-446"></a>
<a name="line-447"></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-448"></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-449"></a>
<a name="line-450"></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-451"></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-452"></a>
<a name="line-453"></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-454"></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-455"></a>
<a name="line-456"></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-457"></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-458"></a>
<a name="line-459"></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-460"></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-461"></a>
<a name="line-462"></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-463"></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'>CLLong</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-464"></a>
<a name="line-465"></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-466"></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-467"></a>
<a name="line-468"></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-469"></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-470"></a>
<a name="line-471"></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-472"></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-473"></a>
<a name="line-474"></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-475"></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'>CLLong</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-476"></a>
<a name="line-477"></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-478"></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-479"></a>
<a name="line-480"></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-481"></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-482"></a>
<a name="line-483"></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-484"></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-485"></a>
<a name="line-486"></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-487"></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-488"></a>
<a name="line-489"></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-490"></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-491"></a>
<a name="line-492"></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-493"></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-494"></a>
<a name="line-495"></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_NewDeprecatedSession"</span>
<a name="line-496"></a> <span class='hs-varid'>tFNewDeprecatedSession</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-497"></a>
<a name="line-498"></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_CloseDeprecatedSession"</span>
<a name="line-499"></a> <span class='hs-varid'>tFCloseDeprecatedSession</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-500"></a>
<a name="line-501"></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_DeleteDeprecatedSession"</span>
<a name="line-502"></a> <span class='hs-varid'>tFDeleteDeprecatedSession</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-503"></a>
<a name="line-504"></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-505"></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-506"></a>
<a name="line-507"></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-508"></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-509"></a>
<a name="line-510"></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-511"></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

@ -1,61 +0,0 @@
<?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

@ -1,152 +0,0 @@
<?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

@ -1,57 +0,0 @@
<?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

@ -1,174 +0,0 @@
<?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 OverloadedStrings #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</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'>Output</span>
<a name="line-21"></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-22"></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-23"></a> <span class='hs-comment'>-- * Ops</span>
<a name="line-24"></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-25"></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-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>opUnrendered</span>
<a name="line-27"></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-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-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-34"></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-35"></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-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>output</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>outputIndex</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>outputOp</span>
<a name="line-39"></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-40"></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>
<a name="line-41"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-42"></a>
<a name="line-43"></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-44"></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-45"></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-46"></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-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'>Text</span>
<a name="line-48"></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-49"></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-50"></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-51"></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-52"></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-53"></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-54"></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-55"></a>
<a name="line-56"></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-57"></a><a name="ControlNode"></a><span class='hs-comment'>-- valuable for causing side effects when they are run.</span>
<a name="line-58"></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-59"></a>
<a name="line-60"></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-61"></a><a name="OpType"></a><span class='hs-comment'>-- NodeDef.op.</span>
<a name="line-62"></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-63"></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-64"></a>
<a name="line-65"></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-66"></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-67"></a>
<a name="line-68"></a><a name="Output"></a><span class='hs-comment'>-- | An output of a TensorFlow node.</span>
<a name="line-69"></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-70"></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-71"></a>
<a name="line-72"></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-73"></a><span class='hs-definition'>output</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Output</span>
<a name="line-74"></a>
<a name="line-75"></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-76"></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-77"></a>
<a name="line-78"></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-79"></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-80"></a>
<a name="line-81"></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-82"></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-83"></a>
<a name="line-84"></a><a name="Device"></a><span class='hs-comment'>-- | A device that a node can be assigned to.</span>
<a name="line-85"></a><a name="Device"></a><span class='hs-comment'>-- There's a naming convention where the device names</span>
<a name="line-86"></a><a name="Device"></a><span class='hs-comment'>-- are constructed from job and replica names.</span>
<a name="line-87"></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-88"></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-89"></a>
<a name="line-90"></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-91"></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-92"></a>
<a name="line-93"></a><a name="Op"></a><span class='hs-comment'>-- | The representation of a node in a TensorFlow graph.</span>
<a name="line-94"></a><a name="Op"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Op</span>
<a name="line-95"></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-96"></a> <span class='hs-comment'>-- device, name, and scope.</span>
<a name="line-97"></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-98"></a> <span class='hs-comment'>-- on which context this op is rendered in.</span>
<a name="line-99"></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-100"></a>
<a name="line-101"></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-102"></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-103"></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-104"></a>
<a name="line-105"></a><a name="opUnrendered"></a><span class='hs-comment'>-- | Traverse on the 'Unrendered' of an 'Op'.</span>
<a name="line-106"></a><span class='hs-comment'>--</span>
<a name="line-107"></a><span class='hs-comment'>-- Same implementation as _Left.</span>
<a name="line-108"></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-109"></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-110"></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-111"></a>
<a name="line-112"></a><a name="OpDef"></a><span class='hs-comment'>-- | Op definition. This corresponds somewhat to the 'NodeDef' proto.</span>
<a name="line-113"></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-114"></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-115"></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-116"></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-117"></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-118"></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-119"></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-120"></a>
<a name="line-121"></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-122"></a><a name="PendingNodeName"></a><span class='hs-comment'>-- ImplicitName, it will be assigned based on the opType plus a</span>
<a name="line-123"></a><a name="PendingNodeName"></a><span class='hs-comment'>-- unique identifier. Does not contain the "scope" prefix.</span>
<a name="line-124"></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-125"></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-126"></a>
<a name="line-127"></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-128"></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-129"></a><a name="NodeName"></a><span class='hs-comment'>-- (if the node was implicitly named).</span>
<a name="line-130"></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-131"></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-132"></a>
<a name="line-133"></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-134"></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-135"></a>
<a name="line-136"></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-137"></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-138"></a>
<a name="line-139"></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-140"></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-141"></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-142"></a> <span class='hs-varop'>.</span> <span class='hs-varid'>attrLens</span>
<a name="line-143"></a>
<a name="line-144"></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-145"></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-146"></a>
<a name="line-147"></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-148"></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-149"></a>
<a name="line-150"></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-151"></a><a name="instance%20IsString%20Output"></a><span class='hs-comment'>-- code into a Build function</span>
<a name="line-152"></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-153"></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-154"></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> <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-keyglyph'>::</span> <span class='hs-conid'>String</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>
<a name="line-155"></a> <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-156"></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-157"></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-158"></a>
<a name="line-159"></a>
<a name="line-160"></a><a name="ResourceHandle"></a><span class='hs-comment'>-- | Opaque handle to a mutable resource in the graph. Typical such</span>
<a name="line-161"></a><a name="ResourceHandle"></a><span class='hs-comment'>-- resources are variables. The type parameter corresponds to the</span>
<a name="line-162"></a><a name="ResourceHandle"></a><span class='hs-comment'>-- dtype of the tensor held in the variable.</span>
<a name="line-163"></a><a name="ResourceHandle"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>ResourceHandle</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>ResourceHandle</span> <span class='hs-conid'>Output</span>
</pre></body>
</html>

View file

@ -1,240 +0,0 @@
<?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 OverloadedStrings #-}</span>
<a name="line-17"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-18"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
<a name="line-19"></a><span class='hs-comment'>{-# LANGUAGE TupleSections #-}</span>
<a name="line-20"></a>
<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'>Session</span> <span class='hs-layout'>(</span>
<a name="line-22"></a> <span class='hs-conid'>Session</span><span class='hs-layout'>,</span>
<a name="line-23"></a> <span class='hs-conid'>Options</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'>sessionTracer</span><span class='hs-layout'>,</span>
<a name="line-27"></a> <span class='hs-varid'>runSession</span><span class='hs-layout'>,</span>
<a name="line-28"></a> <span class='hs-varid'>runSessionWithOptions</span><span class='hs-layout'>,</span>
<a name="line-29"></a> <span class='hs-varid'>build</span><span class='hs-layout'>,</span>
<a name="line-30"></a> <span class='hs-varid'>buildAnd</span><span class='hs-layout'>,</span>
<a name="line-31"></a> <span class='hs-varid'>buildWithSummary</span><span class='hs-layout'>,</span>
<a name="line-32"></a> <span class='hs-varid'>extend</span><span class='hs-layout'>,</span>
<a name="line-33"></a> <span class='hs-varid'>addGraphDef</span><span class='hs-layout'>,</span>
<a name="line-34"></a> <span class='hs-varid'>run</span><span class='hs-layout'>,</span>
<a name="line-35"></a> <span class='hs-varid'>runWithFeeds</span><span class='hs-layout'>,</span>
<a name="line-36"></a> <span class='hs-varid'>run_</span><span class='hs-layout'>,</span>
<a name="line-37"></a> <span class='hs-varid'>runWithFeeds_</span><span class='hs-layout'>,</span>
<a name="line-38"></a> <span class='hs-varid'>asyncProdNodes</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-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-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'>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-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'>Class</span> <span class='hs-layout'>(</span><span class='hs-varid'>lift</span><span class='hs-layout'>)</span>
<a name="line-44"></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-45"></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-46"></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-conid'>Default</span><span class='hs-layout'>,</span> <span class='hs-varid'>def</span><span class='hs-layout'>)</span>
<a name="line-47"></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-48"></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-49"></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'>showMessage</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'>Set</span> <span class='hs-layout'>(</span><span class='hs-conid'>Set</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'>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-52"></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'>&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-53"></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-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'>Graph</span> <span class='hs-layout'>(</span><span class='hs-varid'>node</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><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-57"></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-58"></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-59"></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-60"></a>
<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'>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-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'>Set</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>Set</span>
<a name="line-64"></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-65"></a>
<a name="line-66"></a><a name="Tracer"></a><span class='hs-comment'>-- | An action for logging.</span>
<a name="line-67"></a><a name="Tracer"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>Tracer</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-68"></a>
<a name="line-69"></a><a name="SessionState"></a><span class='hs-comment'>-- Common state threaded through the session.</span>
<a name="line-70"></a><a name="SessionState"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>SessionState</span>
<a name="line-71"></a> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>SessionState</span> <span class='hs-layout'>{</span>
<a name="line-72"></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-73"></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-74"></a> <span class='hs-comment'>-- ^ Starts the given action concurrently.</span>
<a name="line-75"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tracer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tracer</span>
<a name="line-76"></a> <span class='hs-layout'>}</span>
<a name="line-77"></a>
<a name="line-78"></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-79"></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-80"></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-81"></a>
<a name="line-82"></a><a name="runSession"></a><span class='hs-comment'>-- | Run 'Session' actions in a new TensorFlow session.</span>
<a name="line-83"></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-84"></a><span class='hs-definition'>runSession</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runSessionWithOptions</span> <span class='hs-varid'>def</span>
<a name="line-85"></a>
<a name="line-86"></a><a name="Options"></a><span class='hs-comment'>-- | Customization for session. Use the lenses to update:</span>
<a name="line-87"></a><a name="Options"></a><span class='hs-comment'>-- 'sessionTarget', 'sessionTracer', 'sessionConfig'.</span>
<a name="line-88"></a><a name="Options"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Options</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Options</span>
<a name="line-89"></a> <span class='hs-layout'>{</span> <span class='hs-sel'>_sessionTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ByteString</span>
<a name="line-90"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_sessionConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ConfigProto</span>
<a name="line-91"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_sessionTracer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Tracer</span>
<a name="line-92"></a> <span class='hs-layout'>}</span>
<a name="line-93"></a>
<a name="line-94"></a><a name="instance%20Default%20Options"></a><span class='hs-keyword'>instance</span> <span class='hs-conid'>Default</span> <span class='hs-conid'>Options</span> <span class='hs-keyword'>where</span>
<a name="line-95"></a> <span class='hs-varid'>def</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Options</span>
<a name="line-96"></a> <span class='hs-layout'>{</span> <span class='hs-sel'>_sessionTarget</span> <span class='hs-keyglyph'>=</span> <span class='hs-str'>""</span>
<a name="line-97"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_sessionConfig</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>def</span>
<a name="line-98"></a> <span class='hs-layout'>,</span> <span class='hs-sel'>_sessionTracer</span> <span class='hs-keyglyph'>=</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>
<a name="line-99"></a> <span class='hs-layout'>}</span>
<a name="line-100"></a>
<a name="line-101"></a><a name="sessionTarget"></a><span class='hs-comment'>-- | Target can be: "local", ip:port, host:port.</span>
<a name="line-102"></a><span class='hs-comment'>-- The set of supported factories depends on the linked in libraries.</span>
<a name="line-103"></a><span class='hs-definition'>sessionTarget</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>Options</span> <span class='hs-conid'>ByteString</span>
<a name="line-104"></a><span class='hs-definition'>sessionTarget</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_sessionTarget</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'>_sessionTarget</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-105"></a>
<a name="line-106"></a><a name="sessionConfig"></a><span class='hs-comment'>-- | Uses the specified config for the created session.</span>
<a name="line-107"></a><span class='hs-definition'>sessionConfig</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>Options</span> <span class='hs-conid'>ConfigProto</span>
<a name="line-108"></a><span class='hs-definition'>sessionConfig</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_sessionConfig</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'>_sessionConfig</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-109"></a>
<a name="line-110"></a><a name="sessionTracer"></a><span class='hs-comment'>-- | Uses the given logger to monitor session progress.</span>
<a name="line-111"></a><span class='hs-definition'>sessionTracer</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Lens'</span> <span class='hs-conid'>Options</span> <span class='hs-conid'>Tracer</span>
<a name="line-112"></a><span class='hs-definition'>sessionTracer</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>lens</span> <span class='hs-sel'>_sessionTracer</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'>_sessionTracer</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-113"></a>
<a name="line-114"></a><a name="runSessionWithOptions"></a><span class='hs-comment'>-- | Run 'Session' actions in a new TensorFlow session created with</span>
<a name="line-115"></a><span class='hs-comment'>-- the given option setter actions ('sessionTarget', 'sessionConfig').</span>
<a name="line-116"></a><span class='hs-definition'>runSessionWithOptions</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Options</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-117"></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-118"></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-119"></a> <span class='hs-keyglyph'>\</span><span class='hs-keyword'>as</span> <span class='hs-varid'>rs</span> <span class='hs-keyglyph'>-&gt;</span>
<a name="line-120"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>initState</span> <span class='hs-keyglyph'>=</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-varid'>options</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>sessionTracer</span><span class='hs-layout'>)</span>
<a name="line-121"></a> <span class='hs-keyword'>in</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-varid'>initState</span><span class='hs-layout'>)</span>
<a name="line-122"></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-keyword'>do</span>
<a name="line-123"></a> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>setSessionTarget</span> <span class='hs-layout'>(</span><span class='hs-varid'>options</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>sessionTarget</span><span class='hs-layout'>)</span> <span class='hs-varid'>opt</span>
<a name="line-124"></a> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>setSessionConfig</span> <span class='hs-layout'>(</span><span class='hs-varid'>options</span> <span class='hs-varop'>^.</span> <span class='hs-varid'>sessionConfig</span><span class='hs-layout'>)</span> <span class='hs-varid'>opt</span>
<a name="line-125"></a>
<a name="line-126"></a><a name="build"></a><span class='hs-comment'>-- | Lift a 'Build' action into a 'Session', including any explicit op</span>
<a name="line-127"></a><span class='hs-comment'>-- renderings.</span>
<a name="line-128"></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-129"></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-130"></a>
<a name="line-131"></a><a name="buildWithSummary"></a><span class='hs-comment'>-- | Lift a 'Build' action into a 'Session', including any explicit op</span>
<a name="line-132"></a><span class='hs-comment'>-- renderings. Returns the merged summary ops which can be used for</span>
<a name="line-133"></a><span class='hs-comment'>-- logging, see 'TensorFlow.Logging.build' for a convenient wrapper.</span>
<a name="line-134"></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-135"></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-136"></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-137"></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-138"></a>
<a name="line-139"></a><a name="extend"></a><span class='hs-comment'>-- | Add all pending rendered nodes to the TensorFlow graph and runs</span>
<a name="line-140"></a><span class='hs-comment'>-- any pending initializers.</span>
<a name="line-141"></a><span class='hs-comment'>--</span>
<a name="line-142"></a><span class='hs-comment'>-- Note that run, runWithFeeds, etc. will all call this function implicitly.</span>
<a name="line-143"></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-144"></a><span class='hs-definition'>extend</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-145"></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-146"></a> <span class='hs-varid'>trace</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'>tracer</span><span class='hs-layout'>)</span>
<a name="line-147"></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-148"></a> <span class='hs-varid'>unless</span> <span class='hs-layout'>(</span><span class='hs-varid'>null</span> <span class='hs-varid'>nodesToExtend</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-varid'>liftIO</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
<a name="line-149"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>graphDef</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'>nodesToExtend</span>
<a name="line-150"></a> <span class='hs-varid'>trace</span> <span class='hs-layout'>(</span><span class='hs-str'>"Session.extend "</span> <span class='hs-varop'>&lt;&gt;</span> <span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-varid'>string8</span> <span class='hs-layout'>(</span><span class='hs-varid'>showMessage</span> <span class='hs-varid'>graphDef</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-151"></a> <span class='hs-conid'>FFI</span><span class='hs-varop'>.</span><span class='hs-varid'>extendGraph</span> <span class='hs-varid'>session</span> <span class='hs-varid'>graphDef</span>
<a name="line-152"></a> <span class='hs-comment'>-- Now that all the nodes are created, run the initializers.</span>
<a name="line-153"></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-154"></a> <span class='hs-varid'>unless</span> <span class='hs-layout'>(</span><span class='hs-varid'>null</span> <span class='hs-varid'>initializers</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span>
<a name="line-155"></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-156"></a>
<a name="line-157"></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-158"></a><span class='hs-comment'>-- Example usage:</span>
<a name="line-159"></a><span class='hs-comment'>--</span>
<a name="line-160"></a><span class='hs-comment'>-- &gt; buildAnd run :: Fetchable t a =&gt; Build t -&gt; Session a</span>
<a name="line-161"></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-162"></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-163"></a>
<a name="line-164"></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-165"></a><span class='hs-comment'>-- rendered, and fetch the corresponding values for 'a'.</span>
<a name="line-166"></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-167"></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-168"></a>
<a name="line-169"></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-170"></a><span class='hs-comment'>-- rendered, feed the given input values, and fetch the corresponding result</span>
<a name="line-171"></a><span class='hs-comment'>-- values for 'a'.</span>
<a name="line-172"></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-173"></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-174"></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-175"></a> <span class='hs-comment'>-- Note that this call to "fetch" shouldn't affect the following "extend"</span>
<a name="line-176"></a> <span class='hs-comment'>-- call, since all nodes in t and its inputs/deps will be rendered by the</span>
<a name="line-177"></a> <span class='hs-comment'>-- above call to getNodes.</span>
<a name="line-178"></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-179"></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-180"></a>
<a name="line-181"></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-182"></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-183"></a> <span class='hs-varid'>extend</span>
<a name="line-184"></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-185"></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-186"></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-187"></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-188"></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-189"></a> <span class='hs-varid'>feeds'</span>
<a name="line-190"></a> <span class='hs-varid'>fetchNames</span>
<a name="line-191"></a> <span class='hs-varid'>targetNames</span>
<a name="line-192"></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-193"></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-194"></a>
<a name="line-195"></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-196"></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-197"></a>
<a name="line-198"></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-199"></a><span class='hs-comment'>-- already rendered. This behaves like 'run' except that it doesn't do any</span>
<a name="line-200"></a><span class='hs-comment'>-- fetches.</span>
<a name="line-201"></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-202"></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-203"></a>
<a name="line-204"></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-205"></a><span class='hs-comment'>-- rendered, feed the given input values, and fetch the corresponding result</span>
<a name="line-206"></a><span class='hs-comment'>-- values for 'a'. This behaves like 'runWithFeeds' except that it doesn't do</span>
<a name="line-207"></a><span class='hs-comment'>-- any fetches.</span>
<a name="line-208"></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-209"></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-210"></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-211"></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-212"></a>
<a name="line-213"></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-214"></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-215"></a>
<a name="line-216"></a><a name="asyncProdNodes"></a><span class='hs-comment'>-- | Starts a concurrent thread which evaluates the given Nodes</span>
<a name="line-217"></a><span class='hs-comment'>-- forever until runSession exits or an exception occurs. Graph</span>
<a name="line-218"></a><span class='hs-comment'>-- extension happens synchronously, but the resultant run proceeds as</span>
<a name="line-219"></a><span class='hs-comment'>-- a separate thread.</span>
<a name="line-220"></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-221"></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-222"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Session</span> <span class='hs-conid'>()</span>
<a name="line-223"></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-224"></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-225"></a> <span class='hs-varid'>extend</span>
<a name="line-226"></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-227"></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-228"></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-229"></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

@ -1,96 +0,0 @@
<?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

@ -1,393 +0,0 @@
<?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><span class='hs-comment'>-- | A 'Constraint' checking that the input is a list of 'TensorType's.</span>
<a name="line-334"></a><span class='hs-comment'>-- Helps improve error messages when using 'OneOf'.</span>
<a name="line-335"></a><span class='hs-keyword'>type</span> <span class='hs-varid'>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-varid'>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><span class='hs-comment'>-- | Removes a type from the given list of types.</span>
<a name="line-368"></a><span class='hs-keyword'>type</span> <span class='hs-varid'>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-varid'>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-layout'>(</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-layout'>)</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><span class='hs-comment'>-- | A constraint that the type @a@ doesn't appear in the type list @ts@.</span>
<a name="line-379"></a><span class='hs-comment'>-- Assumes that @a@ and each of the elements of @ts@ are 'TensorType's.</span>
<a name="line-380"></a><span class='hs-keyword'>type</span> <span class='hs-varid'>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

@ -1,5 +0,0 @@
.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 {}

View file

@ -59,20 +59,29 @@ 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
-- | Tensor data with the correct memory layout for tensorflow.
newtype TensorData a
TensorData :: TensorData -> TensorData a
[unTensorData] :: TensorData a -> TensorData
-- | Encode a Vector into a TensorData.
-- | Types that can be converted to and from <a>TensorData</a>.
--
-- <a>Vector</a> is the most efficient to encode/decode for most element
-- types.
class TensorType a => TensorDataType s a
-- | Decode the bytes of a <a>TensorData</a> into an <a>s</a>.
decodeTensorData :: TensorDataType s a => TensorData a -> s a
-- | Encode an <a>s</a> into a <a>TensorData</a>.
--
-- 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
encodeTensorData :: TensorDataType s a => Shape -> s a -> TensorData a
newtype Scalar a
Scalar :: a -> Scalar a
[unScalar] :: Scalar a -> a
-- | Shape (dimensions) of a tensor.
newtype Shape
@ -80,6 +89,64 @@ Shape :: [Int64] -> Shape
protoShape :: Lens' TensorShapeProto Shape
class Attribute a
attrLens :: Attribute a => Lens' AttrValue a
data DataType :: *
DT_INVALID :: DataType
DT_FLOAT :: DataType
DT_DOUBLE :: DataType
DT_INT32 :: DataType
DT_UINT8 :: DataType
DT_INT16 :: DataType
DT_INT8 :: DataType
DT_STRING :: DataType
DT_COMPLEX64 :: DataType
DT_INT64 :: DataType
DT_BOOL :: DataType
DT_QINT8 :: DataType
DT_QUINT8 :: DataType
DT_QINT32 :: DataType
DT_BFLOAT16 :: DataType
DT_QINT16 :: DataType
DT_QUINT16 :: DataType
DT_UINT16 :: DataType
DT_COMPLEX128 :: DataType
DT_HALF :: DataType
DT_RESOURCE :: DataType
DT_FLOAT_REF :: DataType
DT_DOUBLE_REF :: DataType
DT_INT32_REF :: DataType
DT_UINT8_REF :: DataType
DT_INT16_REF :: DataType
DT_INT8_REF :: DataType
DT_STRING_REF :: DataType
DT_COMPLEX64_REF :: DataType
DT_INT64_REF :: DataType
DT_BOOL_REF :: DataType
DT_QINT8_REF :: DataType
DT_QUINT8_REF :: DataType
DT_QINT32_REF :: DataType
DT_BFLOAT16_REF :: DataType
DT_QINT16_REF :: DataType
DT_QUINT16_REF :: DataType
DT_UINT16_REF :: DataType
DT_COMPLEX128_REF :: DataType
DT_HALF_REF :: DataType
DT_RESOURCE_REF :: DataType
-- | A heterogeneous list type.
data ListOf f as
Nil :: ListOf f '[]
(:/) :: f a -> ListOf f as -> ListOf f (a : as)
type List = ListOf Identity
-- | Equivalent of <a>:/</a> for lists.
(/:/) :: a -> List as -> List (a : as)
data TensorTypeProxy a
TensorTypeProxy :: TensorTypeProxy a
class TensorTypes (ts :: [*])
tensorTypes :: TensorTypes ts => TensorTypeList ts
type TensorTypeList = ListOf TensorTypeProxy
fromTensorTypeList :: TensorTypeList ts -> [DataType]
fromTensorTypes :: TensorTypes as => Proxy as -> [DataType]
-- | A <a>Constraint</a> specifying the possible choices of a
-- <a>TensorType</a>.
@ -101,6 +168,7 @@ attrLens :: Attribute a => Lens' AttrValue a
type OneOf ts a = (TensorType a, TensorTypes ts, NoneOf (AllTensorTypes \\ ts) a)
-- | A constraint checking that two types are different.
type OneOfs ts as = (TensorTypes as, TensorTypes ts, NoneOfs (AllTensorTypes \\ ts) as)
-- | Helper types to produce a reasonable type error message when the
-- Constraint "a /= a" fails. TODO(judahjacobson): Use ghc-8's
@ -108,10 +176,6 @@ type OneOf ts a = (TensorType a, TensorTypes ts, NoneOf (AllTensorTypes \\ ts) a
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.
@ -123,6 +187,16 @@ data ExcludedCase
-- | 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 Data.String.IsString a => Data.String.IsString (TensorFlow.Types.Scalar a)
instance GHC.Real.RealFrac a => GHC.Real.RealFrac (TensorFlow.Types.Scalar a)
instance GHC.Float.RealFloat a => GHC.Float.RealFloat (TensorFlow.Types.Scalar a)
instance GHC.Real.Real a => GHC.Real.Real (TensorFlow.Types.Scalar a)
instance GHC.Float.Floating a => GHC.Float.Floating (TensorFlow.Types.Scalar a)
instance GHC.Real.Fractional a => GHC.Real.Fractional (TensorFlow.Types.Scalar a)
instance GHC.Num.Num a => GHC.Num.Num (TensorFlow.Types.Scalar a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (TensorFlow.Types.Scalar a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (TensorFlow.Types.Scalar a)
instance GHC.Show.Show a => GHC.Show.Show (TensorFlow.Types.Scalar a)
instance TensorFlow.Types.TensorType GHC.Types.Float
instance TensorFlow.Types.TensorType GHC.Types.Double
instance TensorFlow.Types.TensorType GHC.Int.Int32
@ -135,6 +209,20 @@ 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 TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Types.Float
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Types.Double
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Int.Int8
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Int.Int16
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Int.Int32
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Int.Int64
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Word.Word8
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Word.Word16
instance TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector GHC.Types.Bool
instance (Foreign.Storable.Storable a, TensorFlow.Types.TensorDataType Data.Vector.Storable.Vector a) => TensorFlow.Types.TensorDataType Data.Vector.Vector a
instance TensorFlow.Types.TensorDataType Data.Vector.Vector (Data.Complex.Complex GHC.Types.Float)
instance TensorFlow.Types.TensorDataType Data.Vector.Vector (Data.Complex.Complex GHC.Types.Double)
instance TensorFlow.Types.TensorDataType Data.Vector.Vector Data.ByteString.Internal.ByteString
instance TensorFlow.Types.TensorDataType Data.Vector.Vector a => TensorFlow.Types.TensorDataType TensorFlow.Types.Scalar a
instance GHC.Exts.IsList TensorFlow.Types.Shape
instance TensorFlow.Types.Attribute GHC.Types.Float
instance TensorFlow.Types.Attribute Data.ByteString.Internal.ByteString
@ -146,14 +234,18 @@ 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]
instance TensorFlow.Types.All GHC.Classes.Eq (TensorFlow.Types.Map f as) => GHC.Classes.Eq (TensorFlow.Types.ListOf f as)
instance TensorFlow.Types.All GHC.Show.Show (TensorFlow.Types.Map f as) => GHC.Show.Show (TensorFlow.Types.ListOf f as)
instance TensorFlow.Types.TensorTypes '[]
instance (TensorFlow.Types.TensorType t, TensorFlow.Types.TensorTypes ts) => TensorFlow.Types.TensorTypes (t : ts)
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
ControlNode :: NodeName -> ControlNode
[unControlNode] :: ControlNode -> NodeName
-- | 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.
@ -168,22 +260,8 @@ 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.
-- | Op definition. This corresponds somewhat to the <tt>NodeDef</tt>
-- proto.
data OpDef
OpDef :: !PendingNodeName -> !OpType -> !(Map Text AttrValue) -> [Output] -> [NodeName] -> OpDef
[_opName] :: OpDef -> !PendingNodeName
@ -208,10 +286,10 @@ OutputIx :: Int -> OutputIx
-- | An output of a TensorFlow node.
data Output
Output :: !OutputIx -> !Op -> Output
output :: OutputIx -> Op -> Output
outputIndex :: Lens' Output OutputIx
outputOp :: Lens' Output Op
Output :: !OutputIx -> !NodeName -> Output
[outputIndex] :: Output -> !OutputIx
[outputNodeName] :: Output -> !NodeName
output :: OutputIx -> NodeName -> Output
-- | 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
@ -221,17 +299,14 @@ ExplicitName :: !Text -> PendingNodeName
ImplicitName :: PendingNodeName
-- | Opaque handle to a mutable resource in the graph. Typical such
-- resources are variables. The type parameter corresponds to the dtype
-- of the tensor held in the variable.
newtype ResourceHandle a
ResourceHandle :: Output -> ResourceHandle a
instance GHC.Classes.Ord TensorFlow.Output.Op
instance GHC.Classes.Eq TensorFlow.Output.Op
-- resources are variables.
newtype ResourceHandle
ResourceHandle :: Output -> ResourceHandle
instance GHC.Classes.Ord TensorFlow.Output.OpDef
instance GHC.Classes.Eq TensorFlow.Output.OpDef
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
@ -251,68 +326,16 @@ 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.PendingNodeName
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
ControlNode :: NodeName -> ControlNode
[unControlNode] :: ControlNode -> NodeName
data Unique
explicitName :: Text -> PendingNodeName
implicitName :: PendingNodeName
@ -324,19 +347,6 @@ 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
@ -346,8 +356,13 @@ data BuildT m a
-- | An action for building nodes in a TensorFlow graph.
type Build = BuildT Identity
-- | Lift a <a>Build</a> action into a monad, including any explicit op
-- renderings.
class Monad m => MonadBuild m
build :: MonadBuild m => Build a -> m a
-- | Registers the given node to be executed before the next <a>run</a>.
addInitializer :: ControlNode -> Build ()
addInitializer :: MonadBuild m => ControlNode -> m ()
-- | This is Control.Monad.Morph.hoist sans the dependency.
hoistBuildT :: (forall a. m a -> n a) -> BuildT m b -> BuildT n b
@ -357,7 +372,7 @@ 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 ()
addGraphDef :: MonadBuild m => GraphDef -> m ()
-- | Get all the initializers that have accumulated so far, and clear that
-- buffer.
@ -365,57 +380,41 @@ 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]
flushNodeBuffer :: MonadBuild m => m [NodeDef]
summaries :: Lens' GraphState [Output]
-- | Render the given op if it hasn't been rendered already, and return its
-- name.
getOrAddOp :: Op -> Build NodeName
getOrAddOp :: OpDef -> 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
addNewOp :: OpDef -> Build NodeName
-- | 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
-- | Turn an <a>Output</a> into a string representation for the TensorFlow
-- foreign APIs.
encodeOutput :: Output -> Text
lookupNode :: NodeName -> Build NodeDef
-- | 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
withStateLens :: MonadBuild m => Lens' GraphState 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
withDevice :: MonadBuild m => Maybe Device -> m a -> m a
-- | Prepend a scope to all nodes rendered in the given <a>Build</a>
-- action.
withNameScope :: Text -> Build a -> Build a
withNameScope :: MonadBuild m => Text -> m a -> m 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]
withNodeDependencies :: MonadBuild m => Set NodeName -> m a -> m a
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (TensorFlow.Build.BuildT m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (TensorFlow.Build.BuildT m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (TensorFlow.Build.BuildT m)
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)
@ -431,50 +430,164 @@ 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
instance GHC.Base.Monad m => TensorFlow.Build.MonadBuild (TensorFlow.Build.BuildT m)
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:
--
-- <ul>
-- <li><a>Build</a>: An unrendered, immutable value.</li>
-- <li><a>Value</a>: A rendered, immutable value.</li>
-- <li><a>Ref</a>: A rendered stateful handle (e.g., a variable).</li>
-- </ul>
--
-- Note that <a>expr</a>, <a>value</a>, <a>render</a> and
-- <a>renderValue</a> can help convert between the different types of
-- <a>Tensor</a>.
data Tensor v a
Tensor :: v Output -> Tensor v a
[tensorOutput] :: Tensor v a -> v Output
newtype Value a
Value :: a -> Value a
[runValue] :: Value a -> a
newtype Ref a
Ref :: a -> Ref a
[runRef] :: Ref a -> a
-- | Cast a 'Tensor Ref' into a 'Tensor Value'. This behaves like a no-op.
value :: Tensor Ref a -> Tensor Value a
renderValue :: MonadBuild m => Tensor v a -> m (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
-- | A class ensuring that a given tensor is rendered, i.e., has a fixed
-- name, device, etc.
class TensorKind v => Rendered v
rendered :: Rendered v => v a -> a
renderedOutput :: Rendered v => Tensor v a -> Output
tensorNodeName :: Rendered v => Tensor v a -> NodeName
-- | 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 :: Rendered v => 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 <a>addGraphDef</a>.
-- TODO(judahjacobson): add more safety checks here.
tensorFromName :: TensorKind v => Text -> Tensor v a
-- | Like <a>tensorFromName</a>, but type-restricted to <a>Value</a>.
tensorValueFromName :: Text -> Tensor Value a
-- | Like <a>tensorFromName</a>, but type-restricted to <a>Ref</a>.
tensorRefFromName :: Text -> Tensor Ref a
type TensorList v = ListOf (Tensor v)
tensorListOutputs :: Rendered v => TensorList v as -> [Output]
-- | 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 :: (MonadBuild m, Rendered v) => Tensor v b -> m a -> m a
-- | Render a <a>Tensor</a>, fixing its name, scope, device and control
-- inputs from the <a>MonadBuild</a> context. Also renders any
-- dependencies of the <a>Tensor</a> that weren't already rendered.
--
-- This operation is idempotent; calling <a>render</a> on the same input
-- in the same context will produce the same result. However, rendering
-- the same <tt>Tensor Build</tt> in two different contexts may result in
-- two different <tt>Tensor Value</tt>s.
render :: MonadBuild m => Tensor Build a -> m (Tensor Value a)
expr :: TensorKind v => Tensor v a -> Tensor Build a
-- | Records the given summary action in Build for retrieval with Summary
-- protocol buffer in string form. For safety, use the pre-composed
-- functions: Logging.scalarSummary and Logging.histogramSummary.
addSummary :: (MonadBuild m, TensorKind v) => Tensor v ByteString -> m ()
-- | Retrieves the summary ops collected thus far. Typically this only
-- happens once, but if <a>buildWithSummary</a> is used repeatedly, the
-- values accumulate.
collectAllSummaries :: MonadBuild m => m [SummaryTensor]
-- | Synonym for the tensors that return serialized Summary proto.
type SummaryTensor = Tensor Value ByteString
-- | An internal class for kinds of Tensors.
class Monad v => TensorKind v
toBuild :: TensorKind v => v a -> Build a
instance GHC.Base.Functor TensorFlow.Tensor.Ref
instance GHC.Base.Functor TensorFlow.Tensor.Value
instance GHC.Base.Applicative TensorFlow.Tensor.Value
instance GHC.Base.Monad TensorFlow.Tensor.Value
instance GHC.Base.Applicative TensorFlow.Tensor.Ref
instance GHC.Base.Monad TensorFlow.Tensor.Ref
instance TensorFlow.Tensor.Rendered TensorFlow.Tensor.Value
instance TensorFlow.Tensor.Rendered TensorFlow.Tensor.Ref
instance TensorFlow.Tensor.TensorKind TensorFlow.Tensor.Value
instance TensorFlow.Tensor.TensorKind TensorFlow.Tensor.Ref
instance TensorFlow.Tensor.TensorKind TensorFlow.Build.Build
module TensorFlow.BuildOp
-- | Class of types that can be used as op outputs.
class OpResult a
class BuildResult a
buildResult :: BuildResult a => Result a
buildOp :: BuildResult a => [Int64] -> OpDef -> Build 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
-- | Class of types that can be used as op outputs.
class PureResult a
pureResult :: PureResult a => ReaderT (Build OpDef) (State ResultState) a
pureOp :: PureResult a => [Int64] -> Build OpDef -> a
-- | 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
class BuildInputs a
buildInputs :: BuildInputs a => a -> Build [Output]
-- | Parameters to build an op (for example, the node name or optional
-- attributes). TODO: be more type safe.
type OpParams = OpDef -> OpDef
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.Output.ResourceHandle a)
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.Output.ResourceHandle a)
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.Output.ResourceHandle a -> f)
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)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2) => TensorFlow.BuildOp.BuildResult (a1, a2)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3) => TensorFlow.BuildOp.BuildResult (a1, a2, a3)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3, TensorFlow.BuildOp.BuildResult a4) => TensorFlow.BuildOp.BuildResult (a1, a2, a3, a4)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3, TensorFlow.BuildOp.BuildResult a4, TensorFlow.BuildOp.BuildResult a5) => TensorFlow.BuildOp.BuildResult (a1, a2, a3, a4, a5)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3, TensorFlow.BuildOp.BuildResult a4, TensorFlow.BuildOp.BuildResult a5, TensorFlow.BuildOp.BuildResult a6) => TensorFlow.BuildOp.BuildResult (a1, a2, a3, a4, a5, a6)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3, TensorFlow.BuildOp.BuildResult a4, TensorFlow.BuildOp.BuildResult a5, TensorFlow.BuildOp.BuildResult a6, TensorFlow.BuildOp.BuildResult a7) => TensorFlow.BuildOp.BuildResult (a1, a2, a3, a4, a5, a6, a7)
instance (TensorFlow.BuildOp.BuildResult a1, TensorFlow.BuildOp.BuildResult a2, TensorFlow.BuildOp.BuildResult a3, TensorFlow.BuildOp.BuildResult a4, TensorFlow.BuildOp.BuildResult a5, TensorFlow.BuildOp.BuildResult a6, TensorFlow.BuildOp.BuildResult a7, TensorFlow.BuildOp.BuildResult a8) => TensorFlow.BuildOp.BuildResult (a1, a2, a3, a4, a5, a6, a7, a8)
instance TensorFlow.BuildOp.BuildResult TensorFlow.Output.ResourceHandle
instance TensorFlow.Tensor.Rendered v => TensorFlow.BuildOp.BuildResult (TensorFlow.Tensor.Tensor v a)
instance TensorFlow.BuildOp.BuildResult TensorFlow.Output.ControlNode
instance (TensorFlow.Tensor.Rendered v, TensorFlow.Types.TensorTypes as) => TensorFlow.BuildOp.BuildResult (TensorFlow.Tensor.TensorList v as)
instance TensorFlow.BuildOp.BuildResult a => TensorFlow.BuildOp.BuildResult [a]
instance TensorFlow.BuildOp.PureResult (TensorFlow.Tensor.Tensor TensorFlow.Build.Build a)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2) => TensorFlow.BuildOp.PureResult (a1, a2)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3) => TensorFlow.BuildOp.PureResult (a1, a2, a3)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3, TensorFlow.BuildOp.PureResult a4) => TensorFlow.BuildOp.PureResult (a1, a2, a3, a4)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3, TensorFlow.BuildOp.PureResult a4, TensorFlow.BuildOp.PureResult a5) => TensorFlow.BuildOp.PureResult (a1, a2, a3, a4, a5)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3, TensorFlow.BuildOp.PureResult a4, TensorFlow.BuildOp.PureResult a5, TensorFlow.BuildOp.PureResult a6) => TensorFlow.BuildOp.PureResult (a1, a2, a3, a4, a5, a6)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3, TensorFlow.BuildOp.PureResult a4, TensorFlow.BuildOp.PureResult a5, TensorFlow.BuildOp.PureResult a6, TensorFlow.BuildOp.PureResult a7) => TensorFlow.BuildOp.PureResult (a1, a2, a3, a4, a5, a6, a7)
instance (TensorFlow.BuildOp.PureResult a1, TensorFlow.BuildOp.PureResult a2, TensorFlow.BuildOp.PureResult a3, TensorFlow.BuildOp.PureResult a4, TensorFlow.BuildOp.PureResult a5, TensorFlow.BuildOp.PureResult a6, TensorFlow.BuildOp.PureResult a7, TensorFlow.BuildOp.PureResult a8) => TensorFlow.BuildOp.PureResult (a1, a2, a3, a4, a5, a6, a7, a8)
instance TensorFlow.BuildOp.PureResult a => TensorFlow.BuildOp.PureResult [a]
instance TensorFlow.Types.TensorTypes as => TensorFlow.BuildOp.PureResult (TensorFlow.Tensor.TensorList TensorFlow.Build.Build as)
instance TensorFlow.BuildOp.BuildInputs a => TensorFlow.BuildOp.BuildInputs [a]
instance TensorFlow.BuildOp.BuildInputs (TensorFlow.Tensor.Tensor v a)
instance TensorFlow.BuildOp.BuildInputs (TensorFlow.Types.ListOf (TensorFlow.Tensor.Tensor v) as)
instance TensorFlow.BuildOp.BuildInputs TensorFlow.Output.ResourceHandle
module TensorFlow.Nodes
@ -500,21 +613,7 @@ Fetch :: Set Text -> (Map Text TensorData -> a) -> Fetch a
-- | 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)
fetchTensorVector :: (TensorType a) => Tensor v a -> Build (Fetch (TensorData 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)
@ -525,36 +624,28 @@ 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.Types.ListOf f '[])
instance (TensorFlow.Nodes.Nodes (f a), TensorFlow.Nodes.Nodes (TensorFlow.Types.ListOf f as)) => TensorFlow.Nodes.Nodes (TensorFlow.Types.ListOf f (a : as))
instance (l ~ TensorFlow.Types.List '[]) => TensorFlow.Nodes.Fetchable (TensorFlow.Types.ListOf f '[]) l
instance (TensorFlow.Nodes.Fetchable (f t) a, TensorFlow.Nodes.Fetchable (TensorFlow.Types.ListOf f ts) (TensorFlow.Types.List as), i ~ Data.Functor.Identity.Identity) => TensorFlow.Nodes.Fetchable (TensorFlow.Types.ListOf f (t : ts)) (TensorFlow.Types.ListOf i (a : as))
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')
instance (TensorFlow.Types.TensorType a, a ~ a') => TensorFlow.Nodes.Fetchable (TensorFlow.Tensor.Tensor v a) (TensorFlow.Types.TensorData a')
instance (TensorFlow.Types.TensorType a, TensorFlow.Types.TensorDataType s a, a ~ a') => TensorFlow.Nodes.Fetchable (TensorFlow.Tensor.Tensor v a) (s 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
withControlDependencies :: (MonadBuild m, Nodes t) => t -> m a -> m 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
group :: (MonadBuild m, Nodes t) => t -> m ControlNode
-- | 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
noOp :: MonadBuild m => m ControlNode
module TensorFlow.Session
data Session a
@ -581,22 +672,10 @@ runSession :: Session a -> IO a
-- <a>sessionConfig</a>).
runSessionWithOptions :: Options -> 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])
-- | Lift a <a>Build</a> action into a monad, including any explicit op
-- renderings.
class Monad m => MonadBuild m
build :: MonadBuild m => Build a -> m a
-- | Add all pending rendered nodes to the TensorFlow graph and runs any
-- pending initializers.
@ -604,7 +683,7 @@ buildWithSummary :: Build a -> Session (a, [SummaryTensor])
-- Note that run, runWithFeeds, etc. will all call this function
-- implicitly.
extend :: Session ()
addGraphDef :: GraphDef -> Build ()
addGraphDef :: MonadBuild m => GraphDef -> m ()
-- | Run a subgraph <tt>t</tt>, rendering any dependent nodes that aren't
-- already rendered, and fetch the corresponding values for <tt>a</tt>.
@ -630,11 +709,15 @@ runWithFeeds_ :: Nodes t => [Feed] -> t -> Session ()
-- 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.Catch.MonadMask TensorFlow.Session.Session
instance Control.Monad.Catch.MonadCatch TensorFlow.Session.Session
instance Control.Monad.Catch.MonadThrow TensorFlow.Session.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
instance Data.Default.Class.Default TensorFlow.Session.Options
instance TensorFlow.Build.MonadBuild TensorFlow.Session.Session
-- | The core functionality of TensorFlow.
@ -669,31 +752,16 @@ runSession :: Session a -> IO a
-- <a>sessionConfig</a>).
runSessionWithOptions :: Options -> 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])
-- | Lift a <a>Build</a> action into a monad, including any explicit op
-- renderings.
class Monad m => MonadBuild m
build :: MonadBuild m => Build a -> m a
-- | 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
newtype Scalar a
Scalar :: a -> Scalar a
[unScalar] :: Scalar a -> a
-- | Types that contain ops which can be run.
class Nodes t
@ -717,7 +785,7 @@ data Feed
-- 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
feed :: Rendered v => Tensor v a -> TensorData a -> Feed
-- | Run a subgraph <tt>t</tt>, rendering any dependent nodes that aren't
-- already rendered, feed the given input values, and fetch the
@ -743,19 +811,21 @@ type Build = BuildT Identity
data BuildT m a
-- | 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.
-- inputs from the <a>MonadBuild</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)
-- This operation is idempotent; calling <a>render</a> on the same input
-- in the same context will produce the same result. However, rendering
-- the same <tt>Tensor Build</tt> in two different contexts may result in
-- two different <tt>Tensor Value</tt>s.
render :: MonadBuild m => Tensor Build a -> m (Tensor Value a)
-- | 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 ()
addGraphDef :: MonadBuild m => GraphDef -> m ()
opName :: Lens' OpDef PendingNodeName
opAttr :: Attribute a => Text -> Lens' OpDef a
-- | A type of graph node which has no outputs. These nodes are valuable
-- for causing side effects when they are run.
@ -764,52 +834,54 @@ data ControlNode
-- | 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
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
-- | Lens for the attributes of a tensor.
-- <a>Tensor</a>. The parameter <tt>v</tt> is either:
--
-- 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
-- <ul>
-- <li><a>Build</a>: An unrendered, immutable value.</li>
-- <li><a>Value</a>: A rendered, immutable value.</li>
-- <li><a>Ref</a>: A rendered stateful handle (e.g., a variable).</li>
-- </ul>
--
-- Note that <a>expr</a>, <a>value</a>, <a>render</a> and
-- <a>renderValue</a> can help convert between the different types of
-- <a>Tensor</a>.
data Tensor v a
data Value a
data Ref a
-- | 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
-- | Cast a 'Tensor Ref' into a 'Tensor Value'. This behaves like a no-op.
value :: Tensor Ref a -> Tensor Value a
-- | 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>.
-- nodes in a <tt>GraphDef</tt> that was loaded via <a>addGraphDef</a>.
-- TODO(judahjacobson): add more safety checks here.
tensorFromName :: TensorKind v -> Text -> Tensor v a
-- | Data about a tensor that is encoded for the TensorFlow APIs.
data TensorData a
tensorFromName :: TensorKind v => Text -> Tensor v a
expr :: TensorKind v => Tensor v a -> Tensor Build a
-- | The class of scalar types supported by tensorflow.
class TensorType a
-- | Decode the bytes of a TensorData into a Vector.
decodeTensorData :: TensorType a => TensorData a -> Vector a
-- | Tensor data with the correct memory layout for tensorflow.
data TensorData a
-- | Encode a Vector into a TensorData.
-- | Types that can be converted to and from <a>TensorData</a>.
--
-- <a>Vector</a> is the most efficient to encode/decode for most element
-- types.
class TensorType a => TensorDataType s a
-- | Decode the bytes of a <a>TensorData</a> into an <a>s</a>.
decodeTensorData :: TensorDataType s a => TensorData a -> s a
-- | Encode an <a>s</a> into a <a>TensorData</a>.
--
-- 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
encodeTensorData :: TensorDataType s a => Shape -> s a -> TensorData a
newtype Scalar a
Scalar :: a -> Scalar a
[unScalar] :: Scalar a -> a
-- | Shape (dimensions) of a tensor.
newtype Shape
@ -840,7 +912,7 @@ type OneOf ts a = (TensorType a, TensorTypes ts, NoneOf (AllTensorTypes \\ ts) a
-- 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
colocateWith :: (MonadBuild m, Rendered v) => Tensor v b -> m a -> m a
-- | 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.
@ -850,33 +922,21 @@ Device :: Text -> Device
-- | 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
withDevice :: MonadBuild m => Maybe Device -> m a -> m a
-- | Prepend a scope to all nodes rendered in the given <a>Build</a>
-- action.
withNameScope :: Text -> Build a -> Build a
-- | 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
withNameScope :: MonadBuild m => Text -> m a -> m a
-- | 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
withControlDependencies :: (MonadBuild m, Nodes t) => t -> m a -> m 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
group :: (MonadBuild m, Nodes t) => t -> m ControlNode
-- | Does nothing. Only useful as a placeholder for control edges.
noOp :: ControlNode
noOp :: MonadBuild m => m ControlNode

File diff suppressed because one or more lines are too long

View file

@ -1,4 +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>
</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">_Arg'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Arg-39-">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ArrayToList</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ArrayToList">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ArrayToList'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ArrayToList-39-">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">_HostCast'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostCast-39-">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">_HostRecv'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostRecv-39-">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">_HostSend'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_HostSend-39-">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ListToArray</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ListToArray">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ListToArray'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ListToArray-39-">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ParallelConcatStart</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ParallelConcatStart">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ParallelConcatStart'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ParallelConcatStart-39-">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ParallelConcatUpdate</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ParallelConcatUpdate">TensorFlow.GenOps.Core</a></td></tr><tr><td class="src">_ParallelConcatUpdate'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_ParallelConcatUpdate-39-">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">_Recv'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Recv-39-">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">_Retval'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Retval-39-">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><tr><td class="src">_Send'</td><td class="module"><a href="TensorFlow-GenOps-Core.html#v:_Send-39-">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

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