tensorflow-haskell/docs/haddock/tensorflow-ops-0.3.0.0/TensorFlow-Variable.html

16 lines
36 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>TensorFlow.Variable</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">tensorflow-ops-0.3.0.0: Friendly layer around TensorFlow bindings.</span><ul class="links" id="page-menu"><li><a href="src/TensorFlow.Variable.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></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.Variable</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>An implementation of ResourceHandle-based variables.</p><p>The main difference between this and <code><a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Ref" title="TensorFlow.Tensor">Ref</a></code>-based variables is
that reads are explicit, via the <code><a href="TensorFlow-Variable.html#v:readValue" title="TensorFlow.Variable">readValue</a></code> op.</p><p>TODO: given that distinction, figure out a good story around
gradients and save/restore. Then, merge this module into
TensorFlow.Ops.</p></div></div><div id="synopsis"><details id="syn"><summary>Synopsis</summary><ul class="details-toggle" data-details-id="syn"><li class="src short"><span class="keyword">data</span> <a href="#t:Variable">Variable</a> a</li><li class="src short"><a href="#v:variable">variable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:variable-39-">variable'</a> :: <span class="keyword">forall</span> m a. (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:readValue">readValue</a> :: <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> <a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:Build" title="TensorFlow.Build">Build</a> a</li><li class="src short"><a href="#v:initializedValue">initializedValue</a> :: <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../base-4.13.0.0/Data-Maybe.html#t:Maybe" title="Data.Maybe">Maybe</a> (<a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Value" title="TensorFlow.Tensor">Value</a> a)</li><li class="src short"><a href="#v:initializedVariable">initializedVariable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:initializedVariable-39-">initializedVariable'</a> :: <span class="keyword">forall</span> a m v. (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:zeroInitializedVariable">zeroInitializedVariable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a, <a href="../base-4.13.0.0/Prelude.html#t:Num" title="Prelude">Num</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:zeroInitializedVariable-39-">zeroInitializedVariable'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a, <a href="../base-4.13.0.0/Prelude.html#t:Num" title="Prelude">Num</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a)</li><li class="src short"><a href="#v:assign">assign</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li><li class="src short"><a href="#v:assign-39-">assign'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li><li class="src short"><a href="#v:assignAdd">assignAdd</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li><li class="src short"><a href="#v:assignAdd-39-">assignAdd'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li><li class="src short"><a href="#v:resourceApplyAdam">resourceApplyAdam</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:OneOf" title="TensorFlow.Types">OneOf</a> '[<a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int16" title="Data.Int">Int16</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int32" title="Data.Int">Int32</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int64" title="Data.Int">Int64</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int8" title="Data.Int">Int8</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word16" title="Data.Word">Word16</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word8" title="Data.Word">Word8</a>, <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>] t) =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v1 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v2 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v3 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v4 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v5 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v6 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v7 t -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li><li class="src short"><a href="#v:resourceApplyAdam-39-">resourceApplyAdam'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:OneOf" title="TensorFlow.Types">OneOf</a> '[<a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int16" title="Data.Int">Int16</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int32" title="Data.Int">Int32</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int64" title="Data.Int">Int64</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int8" title="Data.Int">Int8</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word16" title="Data.Word">Word16</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word8" title="Data.Word">Word8</a>, <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>] t) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v1 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v2 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v3 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v4 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v5 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v6 t -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v7 t -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></li></ul></details></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Variable" class="def">Variable</a> a <a href="src/TensorFlow.Variable.html#Variable" class="link">Source</a> <a href="#t:Variable" class="selflink">#</a></p><div class="subs instances"><h4 class="instances details-toggle-control details-toggle" data-details-id="i:Variable">Instances</h4><details id="i:Variable" open="open"><summary class="hide-when-js-enabled">Instances details</summary><table><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Variable:Rendered:1"></span> <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Rendered" title="TensorFlow.Tensor">Rendered</a> <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a></span> <a href="src/TensorFlow.Variable.html#line-52" class="link">Source</a> <a href="#t:Variable" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Variable:Rendered:1"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="TensorFlow-Variable.html">TensorFlow.Variable</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:renderedOutput">renderedOutput</a> :: <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:Output" title="TensorFlow.Output">Output</a> <a href="#v:renderedOutput" class="selflink">#</a></p></div></details></td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Variable:ToTensor:2"></span> <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:ToTensor" title="TensorFlow.Tensor">ToTensor</a> <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a></span> <a href="src/TensorFlow.Variable.html#line-55" class="link">Source</a> <a href="#t:Variable" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><details id="i:id:Variable:ToTensor:2"><summary class="hide-when-js-enabled">Instance details</summary><p>Defined in <a href="TensorFlow-Variable.html">TensorFlow.Variable</a></p> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toTensor">toTensor</a> :: <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> <a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:Build" title="TensorFlow.Build">Build</a> a <a href="#v:toTensor" class="selflink">#</a></p></div></details></td></tr></table></details></div></div><div class="top"><p class="src"><a id="v:variable" class="def">variable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#variable" class="link">Source</a> <a href="#v:variable" class="selflink">#</a></p><div class="doc"><p>Creates a new, uninitialized variable.</p></div></div><div class="top"><p class="src"><a id="v:variable-39-" class="def">variable'</a> :: <span class="keyword">forall</span> m a. (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#variable%27" class="link">Source</a> <a href="#v:variable-39-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:readValue" class="def">readValue</a> :: <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> <a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:Build" title="TensorFlow.Build">Build</a> a <a href="src/TensorFlow.Variable.html#readValue" class="link">Source</a> <a href="#v:readValue" class="selflink">#</a></p><div class="doc"><p>Gets the value stored in a variable.</p><p>Note that this op is stateful since it depends on the value of the variable;
however, it may be CSE'd with other reads in the same context. The context can
be fixed by using <code><a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#v:render" title="TensorFlow.Tensor">render</a></code> along with (for example) <code><a href="../tensorflow-0.3.0.0/TensorFlow-ControlFlow.html#v:withControlDependencies" title="TensorFlow.ControlFlow">withControlDependencies</a></code>.
For example:</p><pre> runSession $ do
v &lt;- variable []
a &lt;- assign v 24
r &lt;- withControlDependencies a $ render $ readValue v + 18
result &lt;- run r
liftIO $ (42 :: Float) @=? unScalar result</pre></div></div><div class="top"><p class="src"><a id="v:initializedValue" class="def">initializedValue</a> :: <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../base-4.13.0.0/Data-Maybe.html#t:Maybe" title="Data.Maybe">Maybe</a> (<a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Value" title="TensorFlow.Tensor">Value</a> a) <a href="src/TensorFlow.Variable.html#initializedValue" class="link">Source</a> <a href="#v:initializedValue" class="selflink">#</a></p><div class="doc"><p>The initial value of a <code><a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a></code> created with <code><a href="TensorFlow-Variable.html#v:initializedVariable" title="TensorFlow.Variable">initializedVariable</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:initializedVariable" class="def">initializedVariable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#initializedVariable" class="link">Source</a> <a href="#v:initializedVariable" class="selflink">#</a></p><div class="doc"><p>Creates a variable initialized to the given value.
Initialization happens next time session runs.</p></div></div><div class="top"><p class="src"><a id="v:initializedVariable-39-" class="def">initializedVariable'</a> :: <span class="keyword">forall</span> a m v. (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#initializedVariable%27" class="link">Source</a> <a href="#v:initializedVariable-39-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:zeroInitializedVariable" class="def">zeroInitializedVariable</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a, <a href="../base-4.13.0.0/Prelude.html#t:Num" title="Prelude">Num</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#zeroInitializedVariable" class="link">Source</a> <a href="#v:zeroInitializedVariable" class="selflink">#</a></p><div class="doc"><p>Creates a zero-initialized variable with the given shape.</p></div></div><div class="top"><p class="src"><a id="v:zeroInitializedVariable-39-" class="def">zeroInitializedVariable'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a, <a href="../base-4.13.0.0/Prelude.html#t:Num" title="Prelude">Num</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:Shape" title="TensorFlow.Types">Shape</a> -&gt; m (<a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a) <a href="src/TensorFlow.Variable.html#zeroInitializedVariable%27" class="link">Source</a> <a href="#v:zeroInitializedVariable-39-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:assign" class="def">assign</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a> <a href="src/TensorFlow.Variable.html#assign" class="link">Source</a> <a href="#v:assign" class="selflink">#</a></p><div class="doc"><p>Sets the value of a variable.</p></div></div><div class="top"><p class="src"><a id="v:assign-39-" class="def">assign'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a> <a href="src/TensorFlow.Variable.html#assign%27" class="link">Source</a> <a href="#v:assign-39-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:assignAdd" class="def">assignAdd</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a> <a href="src/TensorFlow.Variable.html#assignAdd" class="link">Source</a> <a href="#v:assignAdd" class="selflink">#</a></p><div class="doc"><p>Increments the value of a variable.</p></div></div><div class="top"><p class="src"><a id="v:assignAdd-39-" class="def">assignAdd'</a> :: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:TensorType" title="TensorFlow.Types">TensorType</a> a) =&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a> -&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> a -&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v a -&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a> <a href="src/TensorFlow.Variable.html#assignAdd%27" class="link">Source</a> <a href="#v:assignAdd-39-" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:resourceApplyAdam" class="def">resourceApplyAdam</a> <a href="src/TensorFlow.Variable.html#resourceApplyAdam" class="link">Source</a> <a href="#v:resourceApplyAdam" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:OneOf" title="TensorFlow.Types">OneOf</a> '[<a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int16" title="Data.Int">Int16</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int32" title="Data.Int">Int32</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int64" title="Data.Int">Int64</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int8" title="Data.Int">Int8</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word16" title="Data.Word">Word16</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word8" title="Data.Word">Word8</a>, <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>] t)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>var</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>m</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>v</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v1 t</td><td class="doc"><p><strong>beta1_power</strong>: Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v2 t</td><td class="doc"><p><strong>beta2_power</strong>: Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v3 t</td><td class="doc"><p><strong>lr</strong>: Scaling factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v4 t</td><td class="doc"><p><strong>beta1</strong>: Momentum factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v5 t</td><td class="doc"><p><strong>beta2</strong>: Momentum factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v6 t</td><td class="doc"><p><strong>epsilon</strong>: Ridge term. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v7 t</td><td class="doc"><p><strong>grad</strong>: The gradient.</p></td></tr><tr><td class="src">-&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Update '*var' according to the Adam algorithm.</p><p>lr_t &lt;- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t)
m_t &lt;- beta1 * m_{t-1} + (1 - beta1) * g_t
v_t &lt;- beta2 * v_{t-1} + (1 - beta2) * g_t * g_t
variable &lt;- variable - lr_t * m_t / (sqrt(v_t) + epsilon)</p></div></div><div class="top"><p class="src"><a id="v:resourceApplyAdam-39-" class="def">resourceApplyAdam'</a> <a href="src/TensorFlow.Variable.html#resourceApplyAdam%27" class="link">Source</a> <a href="#v:resourceApplyAdam-39-" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="../tensorflow-0.3.0.0/TensorFlow-Build.html#t:MonadBuild" title="TensorFlow.Build">MonadBuild</a> m, <a href="../tensorflow-0.3.0.0/TensorFlow-Types.html#t:OneOf" title="TensorFlow.Types">OneOf</a> '[<a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Data-Complex.html#t:Complex" title="Data.Complex">Complex</a> <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int16" title="Data.Int">Int16</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int32" title="Data.Int">Int32</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int64" title="Data.Int">Int64</a>, <a href="../base-4.13.0.0/Data-Int.html#t:Int8" title="Data.Int">Int8</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word16" title="Data.Word">Word16</a>, <a href="../base-4.13.0.0/Data-Word.html#t:Word8" title="Data.Word">Word8</a>, <a href="../base-4.13.0.0/Prelude.html#t:Double" title="Prelude">Double</a>, <a href="../base-4.13.0.0/Prelude.html#t:Float" title="Prelude">Float</a>] t)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-BuildOp.html#t:OpParams" title="TensorFlow.BuildOp">OpParams</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">-&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>var</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>m</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="TensorFlow-Variable.html#t:Variable" title="TensorFlow.Variable">Variable</a> t</td><td class="doc"><p><strong>v</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v1 t</td><td class="doc"><p><strong>beta1_power</strong>: Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v2 t</td><td class="doc"><p><strong>beta2_power</strong>: Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v3 t</td><td class="doc"><p><strong>lr</strong>: Scaling factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v4 t</td><td class="doc"><p><strong>beta1</strong>: Momentum factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v5 t</td><td class="doc"><p><strong>beta2</strong>: Momentum factor. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v6 t</td><td class="doc"><p><strong>epsilon</strong>: Ridge term. Must be a scalar.</p></td></tr><tr><td class="src">-&gt; <a href="../tensorflow-0.3.0.0/TensorFlow-Tensor.html#t:Tensor" title="TensorFlow.Tensor">Tensor</a> v7 t</td><td class="doc"><p><strong>grad</strong>: The gradient.</p></td></tr><tr><td class="src">-&gt; m <a href="../tensorflow-0.3.0.0/TensorFlow-Output.html#t:ControlNode" title="TensorFlow.Output">ControlNode</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.23.0</p></div></body></html>