Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains definitions for some built-in TensorFlow operations.
Note that certain, "stateful" ops like variable
and assign
return a
Build
action (e.g., Build (Tensor Ref a)
instead of a pure value; the
returned Tensor
s are always rendered in the current Build
context. This
approach helps us avoid problems with inlining or common subexpression
elimination, by writing
do v <- variable [] w <- assign v 3 render $ w * w
instead of
let v = variable [] w = assign v 3 in w * w
since the latter could be reasonably transformed by the compiler into (or vice versa)
let v = variable [] w = assign v 3 w' = assign v 3 in w * w'
Ops should return a Build
action if their original OpDef
marks them as
stateful, or if they take any Refs as input. (This mirrors the rules that
TensorFlow uses to avoid common subexpression elimination.)
- 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
- 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
- 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)
- 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
- reducedShape :: (OneOf '[Int32, Int64] t1, OneOf '[Int32, Int64] t2) => Tensor v1 t1 -> Tensor v2 t2 -> Tensor Build Int32
- 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 :: forall a m. (MonadBuild m, TensorType a) => ByteString -> Tensor Ref a -> m ControlNode
- 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
- 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
- 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
- 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)
- 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
- scalarize :: TensorType a => Tensor v a -> Tensor Build a
Documentation
:: (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 | input |
-> Tensor v'2 tidx | dimension |
-> Tensor Build output_type | output |
:: (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 | input |
-> Tensor v'2 tidx | dimension |
-> Tensor Build output_type | output |
:: (MonadBuild m', TensorType t) | |
=> Tensor Ref t | ref |
-> Tensor v'2 t | value |
-> m' (Tensor Ref t) | output_ref |
:: (MonadBuild m', TensorType t) | |
=> OpParams | |
-> Tensor Ref t | ref |
-> Tensor v'2 t | value |
-> m' (Tensor Ref t) | output_ref |
:: (TensorType srcT, TensorType dstT) | |
=> Tensor v'1 srcT | x |
-> Tensor Build dstT | y |
:: (TensorType srcT, TensorType dstT) | |
=> OpParams | |
-> Tensor v'1 srcT | x |
-> Tensor Build dstT | y |
constant :: TensorType a => Shape -> [a] -> Tensor Build a Source #
Create a constant tensor.
The values should be in row major order, e.g.,
element 0: index (0, ..., 0) element 1: index (0, ..., 1) ...
expandDims :: TensorType t => Tensor v1 t -> Tensor v2 Int32 -> Tensor Build t Source #
expandDims' :: TensorType t => OpParams -> Tensor v1 t -> Tensor v2 Int32 -> Tensor Build t Source #
initializedVariable :: (MonadBuild m, TensorType a) => Tensor v a -> m (Tensor Ref a) Source #
Creates a variable initialized to the given value. Initialization happens next time session runs.
initializedVariable' :: (MonadBuild m, TensorType a) => OpParams -> Tensor v a -> m (Tensor Ref a) Source #
zeroInitializedVariable :: (MonadBuild m, TensorType a, Num a) => Shape -> m (Tensor Ref a) Source #
Creates a zero-initialized variable with the given shape.
zeroInitializedVariable' :: (MonadBuild m, TensorType a, Num a) => OpParams -> Shape -> m (Tensor Ref a) Source #
matTranspose :: TensorType a => Tensor e a -> Tensor Build a Source #
matTranspose' :: TensorType a => OpParams -> Tensor v a -> Tensor Build a Source #
:: (OneOf ((:) * (Complex Double) ((:) * (Complex Float) ((:) * Int16 ((:) * Int32 ((:) * Int64 ((:) * Int8 ((:) * Word16 ((:) * Word32 ((:) * Word64 ((:) * Word8 ((:) * Double ((:) * Float ([] *))))))))))))) t, OneOf ((:) * Int32 ((:) * Int64 ([] *))) tidx) | |
=> Tensor v'1 t | input |
-> Tensor v'2 tidx | reduction_indices |
-> Tensor Build t | output |
:: (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 | input |
-> Tensor v'2 tidx | reduction_indices |
-> Tensor Build t | output |
placeholder :: (MonadBuild m, TensorType a) => Shape -> m (Tensor Value a) Source #
placeholder' :: forall m a. (MonadBuild m, TensorType a) => OpParams -> Shape -> m (Tensor Value a) Source #
reducedShape :: (OneOf '[Int32, Int64] t1, OneOf '[Int32, Int64] t2) => Tensor v1 t1 -> Tensor v2 t2 -> Tensor Build Int32 Source #
Helper function for reduction ops (translation of math_ops.reduced_shape).
reduceMean :: (TensorType a, OneOf '[Double, Float, Complex Float, Complex Double] a) => Tensor v a -> Tensor Build a Source #
Computes the mean of elements across dimensions of a tensor.
See mean
reduceMean' :: (TensorType a, OneOf '[Double, Float, Complex Float, Complex Double] a) => OpParams -> Tensor v a -> Tensor Build a Source #
:: (MonadBuild m, TensorType a) | |
=> ByteString | File path. |
-> Tensor Ref a | Tensor to restore. |
-> m ControlNode |
Restore a tensor's value from a checkpoint file.
:: (MonadBuild m, TensorType a) | |
=> ByteString | File path. |
-> ByteString | Tensor name override. |
-> Tensor Ref a | Tensor to restore. |
-> 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.
:: (Rendered (Tensor v), MonadBuild m, TensorType a) | |
=> ByteString | File path. |
-> [Tensor v a] | Tensors to save. |
-> m ControlNode |
:: (OneOf ((:) * (Complex Double) ((:) * (Complex Float) ((:) * Int16 ((:) * Int32 ((:) * Int64 ((:) * Int8 ((:) * Word16 ((:) * Word32 ((:) * Word64 ((:) * Word8 ((:) * Double ((:) * Float ([] *))))))))))))) t, OneOf ((:) * Int32 ((:) * Int64 ([] *))) tidx) | |
=> Tensor v'1 t | input |
-> Tensor v'2 tidx | reduction_indices |
-> Tensor Build t | output |
:: (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 | input |
-> Tensor v'2 tidx | reduction_indices |
-> Tensor Build t | output |
reduceSum :: OneOf '[Double, Float, Int32, Int64, Complex Float, Complex Double] a => Tensor v a -> Tensor Build a Source #
Sum a tensor down to a scalar
Seee sum
reduceSum' :: OneOf '[Double, Float, Int32, Int64, Complex Float, Complex Double] a => OpParams -> Tensor v a -> Tensor Build a Source #
Random tensor from the unit normal distribution with bounded values.
This is a type-restricted version of truncatedNormal
.
:: (MonadBuild m', TensorType dtype) | |
=> Shape | shape |
-> m' (Tensor Ref dtype) | ref |
:: (MonadBuild m', TensorType dtype) | |
=> OpParams | |
-> Shape | shape |
-> m' (Tensor Ref dtype) | ref |
:: TensorType t | |
=> OpParams | |
-> Tensor v'1 t | x |
-> Tensor Build t | y |
scalarize :: TensorType a => Tensor v a -> Tensor Build a Source #
Reshape a N-D tensor down to a scalar.
See reshape
.
Orphan instances
(TensorType a, Num a, (~) (* -> *) v Build, OneOf ((:) * Double ((:) * Float ((:) * Int32 ((:) * Int64 ((:) * (Complex Float) ((:) * (Complex Double) ([] *))))))) a) => Num (Tensor v a) Source # | Must be defined as an orphan because of the dependency order between Ops and Tensor. The indirect constraint "v ~ Value" helps disambiguate types, for example in "neg 1 :: Tensor Value Float", it helps find the type of the subexpression "1". |