1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-30 06:49:44 +01:00
tensorflow-haskell/docs/haddock/tensorflow-ops-0.2.0.0/tensorflow-ops.txt
2018-08-13 21:05:49 -07:00

352 lines
23 KiB
Text

-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Friendly layer around TensorFlow bindings.
--
-- Please see README.md
@package tensorflow-ops
@version 0.2.0.0
-- | This module contains definitions for some built-in TensorFlow
-- operations.
--
-- Note that certain, "stateful" ops like <tt>variable</tt> and
-- <tt>assign</tt> return a <a>Build</a> action (e.g., <tt>Build (Tensor
-- Ref a)</tt> instead of a pure value; the returned <a>Tensor</a>s are
-- always rendered in the current <a>Build</a> context. This approach
-- helps us avoid problems with inlining or common subexpression
-- elimination, by writing
--
-- <pre>
-- do
-- v &lt;- variable []
-- w &lt;- assign v 3
-- render $ w * w
-- </pre>
--
-- instead of
--
-- <pre>
-- let
-- v = variable []
-- w = assign v 3
-- in w * w
-- </pre>
--
-- since the latter could be reasonably transformed by the compiler into
-- (or vice versa)
--
-- <pre>
-- let
-- v = variable []
-- w = assign v 3
-- w' = assign v 3
-- in w * w'
-- </pre>
--
-- Ops should return a <a>Build</a> action if their original
-- <tt>OpDef</tt> marks them as stateful, or if they take any Refs as
-- input. (This mirrors the rules that TensorFlow uses to avoid common
-- subexpression elimination.)
module TensorFlow.Ops
add :: OneOf (:) * Complex Double (:) * Complex Float (:) * ByteString (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
add' :: OneOf (:) * Complex Double (:) * Complex Float (:) * ByteString (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
abs :: OneOf (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor Build t
abs' :: OneOf (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor Build t
addN :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float (:) * Variant [] * t => [Tensor v'1 t] -> Tensor Build t
addN' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float (:) * Variant [] * t => OpParams -> [Tensor v'1 t] -> Tensor Build t
argMax :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx, OneOf (:) * Int32 (:) * Int64 [] * output_type) => Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build output_type
argMax' :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx, OneOf (:) * Int32 (:) * Int64 [] * output_type) => OpParams -> Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build output_type
assign :: (MonadBuild m', TensorType t) => Tensor Ref t -> Tensor v'2 t -> m' Tensor Ref t
assign' :: (MonadBuild m', TensorType t) => OpParams -> Tensor Ref t -> Tensor v'2 t -> m' Tensor Ref t
broadcastGradientArgs :: OneOf (:) * Int32 (:) * Int64 [] * t => Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
broadcastGradientArgs' :: OneOf (:) * Int32 (:) * Int64 [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
cast :: (TensorType srcT, TensorType dstT) => Tensor v'1 srcT -> Tensor Build dstT
cast' :: (TensorType srcT, TensorType dstT) => OpParams -> Tensor v'1 srcT -> Tensor Build dstT
concat :: TensorType t => Tensor v'1 Int32 -> [Tensor v'2 t] -> Tensor Build t
concat' :: TensorType t => OpParams -> Tensor v'1 Int32 -> [Tensor v'2 t] -> Tensor Build t
-- | Create a constant tensor.
--
-- The values should be in row major order, e.g.,
--
-- element 0: index (0, ..., 0) element 1: index (0, ..., 1) ...
constant :: TensorType a => Shape -> [a] -> Tensor Build a
constant' :: forall a. TensorType a => OpParams -> Shape -> [a] -> Tensor Build a
equal :: OneOf (:) * Complex Double (:) * Complex Float (:) * Bool (:) * ByteString (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build Bool
equal' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Bool (:) * ByteString (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build Bool
expandDims :: TensorType t => Tensor v1 t -> Tensor v2 Int32 -> Tensor Build t
expandDims' :: TensorType t => OpParams -> Tensor v1 t -> Tensor v2 Int32 -> Tensor Build t
-- | Creates a variable initialized to the given value. Initialization
-- happens next time session runs.
initializedVariable :: (MonadBuild m, TensorType a) => Tensor v a -> m (Tensor Ref a)
initializedVariable' :: (MonadBuild m, TensorType a) => OpParams -> Tensor v a -> m (Tensor Ref a)
-- | Creates a zero-initialized variable with the given shape.
zeroInitializedVariable :: (MonadBuild m, TensorType a, Num a) => Shape -> m (Tensor Ref a)
zeroInitializedVariable' :: (MonadBuild m, TensorType a, Num a) => OpParams -> Shape -> m (Tensor Ref a)
fill :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * index_type) => Tensor v'1 index_type -> Tensor v'2 t -> Tensor Build t
fill' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * index_type) => OpParams -> Tensor v'1 index_type -> Tensor v'2 t -> Tensor Build t
identity :: TensorType t => Tensor v'1 t -> Tensor Build t
identity' :: TensorType t => OpParams -> Tensor v'1 t -> Tensor Build t
matMul :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
matMul' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
matTranspose :: TensorType a => Tensor e a -> Tensor Build a
matTranspose' :: TensorType a => OpParams -> Tensor v a -> Tensor Build a
mean :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx) => Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build t
mean' :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx) => OpParams -> Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build t
mul :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
mul' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
neg :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor Build t
neg' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor Build t
oneHot :: (TensorType t, OneOf (:) * Int32 (:) * Int64 (:) * Word8 [] * tI) => Tensor v'1 tI -> Tensor v'2 Int32 -> Tensor v'3 t -> Tensor v'4 t -> Tensor Build t
oneHot' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 (:) * Word8 [] * tI) => OpParams -> Tensor v'1 tI -> Tensor v'2 Int32 -> Tensor v'3 t -> Tensor v'4 t -> Tensor Build t
pack :: TensorType t => [Tensor v'1 t] -> Tensor Build t
pack' :: TensorType t => OpParams -> [Tensor v'1 t] -> Tensor Build t
placeholder :: (MonadBuild m, TensorType a) => Shape -> m (Tensor Value a)
placeholder' :: forall m a. (MonadBuild m, TensorType a) => OpParams -> Shape -> m (Tensor Value a)
range :: OneOf (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * tidx => Tensor v'1 tidx -> Tensor v'2 tidx -> Tensor v'3 tidx -> Tensor Build tidx
range' :: OneOf (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * tidx => OpParams -> Tensor v'1 tidx -> Tensor v'2 tidx -> Tensor v'3 tidx -> Tensor Build tidx
-- | Helper function for reduction ops (translation of
-- math_ops.reduced_shape).
reducedShape :: (OneOf '[Int32, Int64] t1, OneOf '[Int32, Int64] t2) => Tensor v1 t1 -> Tensor v2 t2 -> Tensor Build Int32
-- | Computes the mean of elements across dimensions of a tensor. See
-- <a>mean</a>
reduceMean :: (TensorType a, OneOf '[Double, Float, Complex Float, Complex Double] a) => Tensor v a -> Tensor Build a
reduceMean' :: (TensorType a, OneOf '[Double, Float, Complex Float, Complex Double] a) => OpParams -> Tensor v a -> Tensor Build a
relu :: OneOf (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor Build t
relu' :: OneOf (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor Build t
reluGrad :: OneOf (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
reluGrad' :: OneOf (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
reshape :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tshape) => Tensor v'1 t -> Tensor v'2 tshape -> Tensor Build t
reshape' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tshape) => OpParams -> Tensor v'1 t -> Tensor v'2 tshape -> Tensor Build t
-- | Restore a tensor's value from a checkpoint file.
restore :: forall a m. (MonadBuild m, TensorType a) => ByteString -> Tensor Ref a -> m ControlNode
-- | Restore a tensor's value from a checkpoint file.
--
-- This version allows restoring from a checkpoint file that uses a
-- different tensor name than the variable.
restoreFromName :: forall a m. (MonadBuild m, TensorType a) => ByteString -> ByteString -> Tensor Ref a -> m ControlNode
save :: forall a m v. (Rendered (Tensor v), MonadBuild m, TensorType a) => ByteString -> [Tensor v a] -> m ControlNode
-- | Create a constant scalar.
scalar :: TensorType a => a -> Tensor Build a
scalar' :: TensorType a => OpParams -> a -> Tensor Build a
shape :: TensorType t => Tensor v t -> Tensor Build Int32
shape' :: TensorType t => OpParams -> Tensor v t -> Tensor Build Int32
sign :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor Build t
sign' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int32 (:) * Int64 (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor Build t
size :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * out_type) => Tensor v'1 t -> Tensor Build out_type
size' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * out_type) => OpParams -> Tensor v'1 t -> Tensor Build out_type
softmax :: OneOf (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor Build t
softmax' :: OneOf (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor Build t
softmaxCrossEntropyWithLogits :: OneOf (:) * Word16 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
softmaxCrossEntropyWithLogits' :: OneOf (:) * Word16 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
sparseToDense :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tindices) => Tensor v'1 tindices -> Tensor v'2 tindices -> Tensor v'3 t -> Tensor v'4 t -> Tensor Build t
sparseToDense' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tindices) => OpParams -> Tensor v'1 tindices -> Tensor v'2 tindices -> Tensor v'3 t -> Tensor v'4 t -> Tensor Build t
sub :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
sub' :: OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word8 (:) * Double (:) * Float [] * t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
sum :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx) => Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build t
sum' :: (OneOf (:) * Complex Double (:) * Complex Float (:) * Int16 (:) * Int32 (:) * Int64 (:) * Int8 (:) * Word16 (:) * Word32 (:) * Word64 (:) * Word8 (:) * Double (:) * Float [] * t, OneOf (:) * Int32 (:) * Int64 [] * tidx) => OpParams -> Tensor v'1 t -> Tensor v'2 tidx -> Tensor Build t
-- | Sum a tensor down to a scalar Seee <a>sum</a>
reduceSum :: (OneOf '[Double, Float, Int32, Int64, Complex Float, Complex Double] a) => Tensor v a -> Tensor Build a
reduceSum' :: (OneOf '[Double, Float, Int32, Int64, Complex Float, Complex Double] a) => OpParams -> Tensor v a -> Tensor Build a
transpose :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tperm) => Tensor v'1 t -> Tensor v'2 tperm -> Tensor Build t
transpose' :: (TensorType t, OneOf (:) * Int32 (:) * Int64 [] * tperm) => OpParams -> Tensor v'1 t -> Tensor v'2 tperm -> Tensor Build t
-- | Random tensor from the unit normal distribution with bounded values.
--
-- This is a type-restricted version of <a>truncatedNormal</a>.
truncatedNormal :: (MonadBuild m, OneOf '[Word16, Double, Float] a) => Tensor v Int64 -> m (Tensor Value a)
truncatedNormal' :: (MonadBuild m, OneOf '[Word16, Double, Float] a) => OpParams -> Tensor v Int64 -> m (Tensor Value a)
variable :: (MonadBuild m', TensorType dtype) => Shape -> m' Tensor Ref dtype
variable' :: (MonadBuild m', TensorType dtype) => OpParams -> Shape -> m' Tensor Ref dtype
-- | Create a constant vector.
vector :: TensorType a => [a] -> Tensor Build a
vector' :: TensorType a => OpParams -> [a] -> Tensor Build a
zeros :: forall a. (Num a, TensorType a) => Shape -> Tensor Build a
zerosLike :: TensorType t => Tensor v'1 t -> Tensor Build t
zerosLike' :: TensorType t => OpParams -> Tensor v'1 t -> Tensor Build t
-- | Reshape a N-D tensor down to a scalar.
--
-- See <a>reshape</a>.
scalarize :: TensorType a => Tensor v a -> Tensor Build a
instance (TensorFlow.Types.TensorType a, GHC.Num.Num a, v ~ TensorFlow.Build.Build, TensorFlow.Types.OneOf '[GHC.Types.Double, GHC.Types.Float, GHC.Int.Int32, GHC.Int.Int64, Data.Complex.Complex GHC.Types.Float, Data.Complex.Complex GHC.Types.Double] a) => GHC.Num.Num (TensorFlow.Tensor.Tensor v a)
module TensorFlow.NN
-- | Computes sigmoid cross entropy given <tt>logits</tt>.
--
-- Measures the probability error in discrete classification tasks in
-- which each class is independent and not mutually exclusive. For
-- instance, one could perform multilabel classification where a picture
-- can contain both an elephant and a dog at the same time.
--
-- For brevity, let `x = logits`, `z = targets`. The logistic loss is
--
-- z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) = z * -log(1 <i>
-- (1 + exp(-x))) + (1 - z) * -log(exp(-x) </i> (1 + exp(-x))) = z *
-- log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x))) = z *
-- log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x)) = (1 - z) * x +
-- log(1 + exp(-x)) = x - x * z + log(1 + exp(-x))
--
-- For x &lt; 0, to avoid overflow in exp(-x), we reformulate the above
--
-- x - x * z + log(1 + exp(-x)) = log(exp(x)) - x * z + log(1 + exp(-x))
-- = - x * z + log(1 + exp(x))
--
-- Hence, to ensure stability and avoid overflow, the implementation uses
-- this equivalent formulation
--
-- max(x, 0) - x * z + log(1 + exp(-abs(x)))
--
-- <tt>logits</tt> and <tt>targets</tt> must have the same type and
-- shape.
sigmoidCrossEntropyWithLogits :: (MonadBuild m, OneOf '[Float, Double] a, TensorType a, Num a) => Tensor Value a -> Tensor Value a -> m (Tensor Value a)
module TensorFlow.Gradient
type GradientCompatible a = (Num a, OneOf '[Float, Complex Float, Complex Double] a)
-- | Gradient of <tt>y</tt> w.r.t. each element of <tt>xs</tt>.
gradients :: forall a v1 t m. (MonadBuild m, Rendered t, ToTensor t, GradientCompatible a) => Tensor v1 a -> [t a] -> m [Tensor Value a]
-- | Parallel lookups on the list of tensors.
module TensorFlow.EmbeddingOps
-- | Looks up <tt>ids</tt> in a list of embedding tensors.
--
-- This function is used to perform parallel lookups on the list of
-- tensors in <tt>params</tt>. It is a generalization of <a>gather</a>,
-- where <tt>params</tt> is interpreted as a partition of a larger
-- embedding tensor.
--
-- The partition_strategy is "mod", we assign each id to partition `p =
-- id % len(params)`. For instance, 13 ids are split across 5 partitions
-- as: `[[0, 5, 10], [1, 6, 11], [2, 7, 12], [3, 8], [4, 9]]`
--
-- The results of the lookup are concatenated into a dense tensor. The
-- returned tensor has shape `shape(ids) + shape(params)[1:]`.
embeddingLookup :: forall a b v1 v2 m. (MonadBuild m, Rendered (Tensor v1), TensorType a, OneOf '[Int64, Int32] b, Num b) => [Tensor v1 a] -> Tensor v2 b -> m (Tensor Value a)
-- | Queues in TensorFlow graph. Very limited support for now.
module TensorFlow.Queue
-- | A queue carrying tuples.
data Queue (as :: [*])
-- | Creates a new queue with the given capacity and shared name.
makeQueue :: forall as m. (MonadBuild m, TensorTypes as) => Int64 -> ByteString -> m (Queue as)
-- | Adds the given values to the queue.
enqueue :: forall as v m. (MonadBuild m, TensorTypes as) => Queue as -> TensorList v as -> m ControlNode
-- | Retrieves the values from the queue.
dequeue :: forall as m. (MonadBuild m, TensorTypes as) => Queue as -> m (TensorList Value as)
-- | An implementation of ResourceHandle-based variables.
--
-- The main difference between this and <a>Ref</a>-based variables is
-- that reads are explicit, via the <a>readValue</a> op.
--
-- TODO: given that distinction, figure out a good story around gradients
-- and save/restore. Then, merge this module into TensorFlow.Ops.
module TensorFlow.Variable
data Variable a
-- | Creates a new, uninitialized variable.
variable :: (MonadBuild m, TensorType a) => Shape -> m (Variable a)
variable' :: forall m a. (MonadBuild m, TensorType a) => OpParams -> Shape -> m (Variable a)
-- | Gets the value stored in a variable.
--
-- 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 <a>render</a> along with
-- (for example) <a>withControlDependencies</a>. For example:
--
-- <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>
readValue :: TensorType a => Variable a -> Tensor Build a
-- | The initial value of a <a>Variable</a> created with
-- <a>initializedVariable</a>.
initializedValue :: Variable a -> Maybe (Tensor Value a)
-- | Creates a variable initialized to the given value. Initialization
-- happens next time session runs.
initializedVariable :: (MonadBuild m, TensorType a) => Tensor v a -> m (Variable a)
initializedVariable' :: forall a m v. (MonadBuild m, TensorType a) => OpParams -> Tensor v a -> m (Variable a)
-- | Creates a zero-initialized variable with the given shape.
zeroInitializedVariable :: (MonadBuild m, TensorType a, Num a) => Shape -> m (Variable a)
zeroInitializedVariable' :: (MonadBuild m, TensorType a, Num a) => OpParams -> Shape -> m (Variable a)
-- | Sets the value of a variable.
assign :: (MonadBuild m, TensorType a) => Variable a -> Tensor v a -> m ControlNode
assign' :: (MonadBuild m, TensorType a) => OpParams -> Variable a -> Tensor v a -> m ControlNode
-- | Increments the value of a variable.
assignAdd :: (MonadBuild m, TensorType a) => Variable a -> Tensor v a -> m ControlNode
assignAdd' :: (MonadBuild m, TensorType a) => OpParams -> Variable a -> Tensor v a -> m ControlNode
-- | Update '*var' according to the Adam algorithm.
--
-- 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)
resourceApplyAdam :: (MonadBuild m, OneOf '[(Complex Double), (Complex Float), Int16, Int32, Int64, Int8, Word16, Word8, Double, Float] t) => Variable t -> Variable t -> Variable t -> Tensor v1 t -> Tensor v2 t -> Tensor v3 t -> Tensor v4 t -> Tensor v5 t -> Tensor v6 t -> Tensor v7 t -> m (ControlNode)
resourceApplyAdam' :: (MonadBuild m, OneOf '[(Complex Double), (Complex Float), Int16, Int32, Int64, Int8, Word16, Word8, Double, Float] t) => OpParams -> Variable t -> Variable t -> Variable t -> Tensor v1 t -> Tensor v2 t -> Tensor v3 t -> Tensor v4 t -> Tensor v5 t -> Tensor v6 t -> Tensor v7 t -> m (ControlNode)
instance TensorFlow.Tensor.Rendered TensorFlow.Variable.Variable
instance TensorFlow.Tensor.ToTensor TensorFlow.Variable.Variable
module TensorFlow.Minimize
-- | Functions that minimize a loss w.r.t. a set of <a>Variable</a>s.
--
-- Generally only performs one step of an iterative algorithm.
--
-- <a>Minimizer</a>s are defined as a function of the gradients instead
-- of the loss so that users can apply transformations to the gradients.
type Minimizer a = forall m. MonadBuild m => [Variable a] -> [Tensor Value a] -> m ControlNode
-- | Convenience wrapper around <a>gradients</a> and a <a>Minimizer</a>.
minimizeWith :: (MonadBuild m, GradientCompatible a) => Minimizer a -> Tensor v a -> [Variable a] -> m ControlNode
-- | Perform one step of the gradient descent algorithm.
gradientDescent :: GradientCompatible a => a -> Minimizer a
data AdamConfig
AdamConfig :: Float -> Float -> Float -> Float -> AdamConfig
[adamLearningRate] :: AdamConfig -> Float
[adamBeta1] :: AdamConfig -> Float
[adamBeta2] :: AdamConfig -> Float
[adamEpsilon] :: AdamConfig -> Float
-- | Perform one step of the adam algorithm.
--
-- See <a>https://arxiv.org/abs/1412.6980</a>.
--
-- NOTE: Currently requires all <a>Variable</a>s to have an
-- <a>initializedValue</a>.
adam :: Minimizer Float
adam' :: AdamConfig -> Minimizer Float
instance Data.Default.Class.Default TensorFlow.Minimize.AdamConfig