mirror of
https://github.com/tensorflow/haskell.git
synced 2024-11-30 06:49:44 +01:00
19 lines
No EOL
30 KiB
HTML
19 lines
No EOL
30 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" /><title>TensorFlow.Variable</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 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="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><p class="caption">tensorflow-ops-0.2.0.0: Friendly layer around 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.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.2.0.0/TensorFlow-Tensor.html#t:Ref">Ref</a></code>-based variables is
|
|
that reads are explicit, via the <code><a href="TensorFlow-Variable.html#v:readValue">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"><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"><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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t:Variable">Variable</a> a)</li><li class="src short"><a href="#v:readValue">readValue</a> :: <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> <a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:Build">Build</a> a</li><li class="src short"><a href="#v:initializedValue">initializedValue</a> :: <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../base-4.10.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Value">Value</a> a)</li><li class="src short"><a href="#v:initializedVariable">initializedVariable</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m (<a href="TensorFlow-Variable.html#t:Variable">Variable</a> a)</li><li class="src short"><a href="#v:zeroInitializedVariable">zeroInitializedVariable</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a, <a href="../base-4.10.1.0/Prelude.html#t:Num">Num</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t:Variable">Variable</a> a)</li><li class="src short"><a href="#v:zeroInitializedVariable-39-">zeroInitializedVariable'</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a, <a href="../base-4.10.1.0/Prelude.html#t:Num">Num</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t:Variable">Variable</a> a)</li><li class="src short"><a href="#v:assign">assign</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:assign-39-">assign'</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:assignAdd">assignAdd</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:assignAdd-39-">assignAdd'</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:resourceApplyAdam">resourceApplyAdam</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:OneOf">OneOf</a> '[<a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int16">Int16</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int32">Int32</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int64">Int64</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int8">Int8</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word16">Word16</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word8">Word8</a>, <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>] t) => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v1 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v2 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v3 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v4 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v5 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v6 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v7 t -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li><li class="src short"><a href="#v:resourceApplyAdam-39-">resourceApplyAdam'</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:OneOf">OneOf</a> '[<a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int16">Int16</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int32">Int32</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int64">Int64</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int8">Int8</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word16">Word16</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word8">Word8</a>, <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>] t) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v1 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v2 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v3 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v4 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v5 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v6 t -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v7 t -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></li></ul></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"><p id="control.i:Variable" class="caption collapser" onclick="toggleSection('i:Variable')">Instances</p><div id="section.i:Variable" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Variable:Rendered:1" class="instance expander" onclick="toggleSection('i:id:Variable:Rendered:1')"></span> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Rendered">Rendered</a> <a href="TensorFlow-Variable.html#t: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"> </td></tr><tr><td colspan="2"><div id="section.i:id:Variable:Rendered:1" class="inst-details hide"><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">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:Output">Output</a> <a href="#v:renderedOutput" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Variable:ToTensor:2" class="instance expander" onclick="toggleSection('i:id:Variable:ToTensor:2')"></span> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:ToTensor">ToTensor</a> <a href="TensorFlow-Variable.html#t: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"> </td></tr><tr><td colspan="2"><div id="section.i:id:Variable:ToTensor:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toTensor">toTensor</a> :: <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> <a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:Build">Build</a> a <a href="#v:toTensor" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:variable" class="def">variable</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> <a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t: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.2.0.0/TensorFlow-Tensor.html#v:render">render</a></code> along with (for example) <code><a href="../tensorflow-0.2.0.0/TensorFlow-ControlFlow.html#v:withControlDependencies">withControlDependencies</a></code>.
|
|
For example:</p><pre> runSession $ do
|
|
v <- variable []
|
|
a <- assign v 24
|
|
r <- withControlDependencies a $ render $ readValue v + 18
|
|
result <- 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">Variable</a> a -> <a href="../base-4.10.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Value">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">Variable</a></code> created with <code><a href="TensorFlow-Variable.html#v:initializedVariable">initializedVariable</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:initializedVariable" class="def">initializedVariable</a> :: (<a href="../tensorflow-0.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a, <a href="../base-4.10.1.0/Prelude.html#t:Num">Num</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a, <a href="../base-4.10.1.0/Prelude.html#t:Num">Num</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:Shape">Shape</a> -> m (<a href="TensorFlow-Variable.html#t: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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:TensorType">TensorType</a> a) => <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a> -> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> a -> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v a -> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:OneOf">OneOf</a> '[<a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int16">Int16</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int32">Int32</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int64">Int64</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int8">Int8</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word16">Word16</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word8">Word8</a>, <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>] t)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>var</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>m</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>v</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v7 t</td><td class="doc"><p><strong>grad</strong>: The gradient.</p></td></tr><tr><td class="src">-> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Update '*var' according to the Adam algorithm.</p><p>lr_t <- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t)
|
|
m_t <- beta1 * m_{t-1} + (1 - beta1) * g_t
|
|
v_t <- beta2 * v_{t-1} + (1 - beta2) * g_t * g_t
|
|
variable <- 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.2.0.0/TensorFlow-Build.html#t:MonadBuild">MonadBuild</a> m, <a href="../tensorflow-0.2.0.0/TensorFlow-Types.html#t:OneOf">OneOf</a> '[<a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Data-Complex.html#t:Complex">Complex</a> <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int16">Int16</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int32">Int32</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int64">Int64</a>, <a href="../base-4.10.1.0/Data-Int.html#t:Int8">Int8</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word16">Word16</a>, <a href="../base-4.10.1.0/Data-Word.html#t:Word8">Word8</a>, <a href="../base-4.10.1.0/Prelude.html#t:Double">Double</a>, <a href="../base-4.10.1.0/Prelude.html#t:Float">Float</a>] t)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="../tensorflow-0.2.0.0/TensorFlow-BuildOp.html#t:OpParams">OpParams</a></td><td class="doc empty"> </td></tr><tr><td class="src">-> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>var</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>m</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="TensorFlow-Variable.html#t:Variable">Variable</a> t</td><td class="doc"><p><strong>v</strong>: Should be from a Variable().</p></td></tr><tr><td class="src">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t: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">-> <a href="../tensorflow-0.2.0.0/TensorFlow-Tensor.html#t:Tensor">Tensor</a> v7 t</td><td class="doc"><p><strong>grad</strong>: The gradient.</p></td></tr><tr><td class="src">-> m <a href="../tensorflow-0.2.0.0/TensorFlow-Output.html#t:ControlNode">ControlNode</a></td><td class="doc empty"> </td></tr></table></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.18.1</p></div></body></html> |