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.)
Synopsis
- add :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. 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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. 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 :: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- abs' :: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor Build t
- addN :: forall (v'1 :: Type -> Type) t. 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' :: forall (v'1 :: Type -> Type) t. 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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx output_type. (OneOf '[Complex Double, Complex Float, Bool, 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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx output_type. (OneOf '[Complex Double, Complex Float, Bool, 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 :: forall (v'2 :: Type -> Type) t m'. (MonadBuild m', TensorType t) => Tensor Ref t -> Tensor v'2 t -> m' (Tensor Ref t)
- assign' :: forall (v'2 :: Type -> Type) t m'. (MonadBuild m', TensorType t) => OpParams -> Tensor Ref t -> Tensor v'2 t -> m' (Tensor Ref t)
- broadcastGradientArgs :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int32, Int64] t => Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
- broadcastGradientArgs' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int32, Int64] t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
- cast :: forall (v'1 :: Type -> Type) srcT dstT. (TensorType srcT, TensorType dstT) => Tensor v'1 srcT -> Tensor Build dstT
- cast' :: forall (v'1 :: Type -> Type) srcT dstT. (TensorType srcT, TensorType dstT) => OpParams -> Tensor v'1 srcT -> Tensor Build dstT
- concat :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. TensorType t => Tensor v'1 Int32 -> [Tensor v'2 t] -> Tensor Build t
- concat' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. 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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Bool, ByteString, Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build Bool
- equal' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Bool, ByteString, Int16, Int32, Int64, Int8, Word16, Word32, Word64, 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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t index_type. (TensorType t, OneOf '[Int32, Int64] index_type) => Tensor v'1 index_type -> Tensor v'2 t -> Tensor Build t
- fill' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t index_type. (TensorType t, OneOf '[Int32, Int64] index_type) => OpParams -> Tensor v'1 index_type -> Tensor v'2 t -> Tensor Build t
- identity :: forall (v'1 :: Type -> Type) t. TensorType t => Tensor v'1 t -> Tensor Build t
- identity' :: forall (v'1 :: Type -> Type) t. TensorType t => OpParams -> Tensor v'1 t -> Tensor Build t
- matMul :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- matMul' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- einsum :: forall (v'1 :: Type -> Type) t. TensorType t => ByteString -> [Tensor v'1 t] -> Tensor Build t
- einsum' :: forall (v'1 :: Type -> Type) t. TensorType t => OpParams -> ByteString -> [Tensor v'1 t] -> Tensor Build t
- matTranspose :: TensorType a => Tensor e a -> Tensor Build a
- matTranspose' :: TensorType a => OpParams -> Tensor v a -> Tensor Build a
- mean :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. 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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. 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 :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- neg' :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor Build t
- oneHot :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tI. (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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tI. (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 :: forall (v'1 :: Type -> Type) t. TensorType t => [Tensor v'1 t] -> Tensor Build t
- pack' :: forall (v'1 :: Type -> Type) t. 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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) tidx. OneOf '[Int32, Int64, Word16, Double, Float] tidx => Tensor v'1 tidx -> Tensor v'2 tidx -> Tensor v'3 tidx -> Tensor Build tidx
- range' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) tidx. 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 :: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t => Tensor v'1 t -> Tensor Build t
- relu' :: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor Build t
- reluGrad :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- reluGrad' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- tanh :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- tanhGrad :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- reshape :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tshape. (TensorType t, OneOf '[Int32, Int64] tshape) => Tensor v'1 t -> Tensor v'2 tshape -> Tensor Build t
- reshape' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tshape. (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
- sigmoid :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- sigmoidGrad :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- sign :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- sign' :: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor Build t
- size :: forall (v'1 :: Type -> Type) t out_type. (TensorType t, OneOf '[Int32, Int64] out_type) => Tensor v'1 t -> Tensor Build out_type
- size' :: forall (v'1 :: Type -> Type) t out_type. (TensorType t, OneOf '[Int32, Int64] out_type) => OpParams -> Tensor v'1 t -> Tensor Build out_type
- softmax :: forall (v'1 :: Type -> Type) t. OneOf '[Word16, Double, Float] t => Tensor v'1 t -> Tensor Build t
- softmax' :: forall (v'1 :: Type -> Type) t. OneOf '[Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor Build t
- softmaxCrossEntropyWithLogits :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Word16, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
- softmaxCrossEntropyWithLogits' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Word16, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> (Tensor Build t, Tensor Build t)
- sparseToDense :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tindices. (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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tindices. (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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Word32, Word8, Double, Float] t => Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- sub' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Word32, Word8, Double, Float] t => OpParams -> Tensor v'1 t -> Tensor v'2 t -> Tensor Build t
- sum :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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 :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tperm. (TensorType t, OneOf '[Int32, Int64] tperm) => Tensor v'1 t -> Tensor v'2 tperm -> Tensor Build t
- transpose' :: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tperm. (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 :: forall dtype m'. (MonadBuild m', TensorType dtype) => Shape -> m' (Tensor Ref dtype)
- variable' :: forall dtype m'. (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 :: forall (v'1 :: Type -> Type) t. TensorType t => Tensor v'1 t -> Tensor Build t
- zerosLike' :: forall (v'1 :: Type -> Type) t. TensorType t => OpParams -> Tensor v'1 t -> Tensor Build t
- scalarize :: TensorType a => Tensor v a -> Tensor Build a
Documentation
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, ByteString, Int16, Int32, Int64, Int8, Word16, Word8, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor v'2 t | y |
-> Tensor Build t | z |
:: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor Build t | y |
:: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float, Variant] t | |
=> [Tensor v'1 t] | inputs |
-> Tensor Build t | sum |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx output_type. (OneOf '[Complex Double, Complex Float, Bool, 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 |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx output_type. (OneOf '[Complex Double, Complex Float, Bool, 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 |
:: forall (v'2 :: Type -> Type) t m'. (MonadBuild m', TensorType t) | |
=> Tensor Ref t | ref |
-> Tensor v'2 t | value |
-> m' (Tensor Ref t) | output_ref |
:: forall (v'2 :: Type -> Type) t m'. (MonadBuild m', TensorType t) | |
=> OpParams | |
-> Tensor Ref t | ref |
-> Tensor v'2 t | value |
-> m' (Tensor Ref t) | output_ref |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int32, Int64] t | |
=> Tensor v'1 t | s0 |
-> Tensor v'2 t | s1 |
-> (Tensor Build t, Tensor Build t) | (r0, r1)
|
:: forall (v'1 :: Type -> Type) srcT dstT. (TensorType srcT, TensorType dstT) | |
=> Tensor v'1 srcT | x |
-> Tensor Build dstT | y |
:: forall (v'1 :: Type -> Type) srcT dstT. (TensorType srcT, TensorType dstT) | |
=> OpParams | |
-> Tensor v'1 srcT | x |
-> Tensor Build dstT | y |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. TensorType t | |
=> Tensor v'1 Int32 | concat_dim |
-> [Tensor v'2 t] | values |
-> Tensor Build t | output |
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) ...
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Bool, ByteString, Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor v'2 t | y |
-> Tensor Build Bool | z |
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 #
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t index_type. (TensorType t, OneOf '[Int32, Int64] index_type) | |
=> Tensor v'1 index_type | dims |
-> Tensor v'2 t | value |
-> Tensor Build t | output |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t | |
=> Tensor v'1 t | a |
-> Tensor v'2 t | b |
-> Tensor Build t | product |
:: forall (v'1 :: Type -> Type) t. TensorType t | |
=> ByteString | equation |
-> [Tensor v'1 t] | inputs |
-> Tensor Build t | output |
:: forall (v'1 :: Type -> Type) t. TensorType t | |
=> OpParams | |
-> ByteString | equation |
-> [Tensor v'1 t] | inputs |
-> Tensor Build t | output |
matTranspose :: TensorType a => Tensor e a -> Tensor Build a Source #
matTranspose' :: TensorType a => OpParams -> Tensor v a -> Tensor Build a Source #
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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 |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Word8, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor v'2 t | y |
-> Tensor Build t | z |
:: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor Build t | y |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tI. (TensorType t, OneOf '[Int32, Int64, Word8] tI) | |
=> Tensor v'1 tI | indices |
-> Tensor v'2 Int32 | depth |
-> Tensor v'3 t | on_value |
-> Tensor v'4 t | off_value |
-> 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 #
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) tidx. OneOf '[Int32, Int64, Word16, Double, Float] tidx | |
=> Tensor v'1 tidx | start |
-> Tensor v'2 tidx | limit |
-> Tensor v'3 tidx | delta |
-> Tensor Build tidx | output |
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 #
:: forall (v'1 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t | |
=> Tensor v'1 t | features |
-> Tensor Build t | activations |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Int16, Int32, Int64, Int8, Word16, Word32, Word64, Word8, Double, Float] t | |
=> Tensor v'1 t | gradients |
-> Tensor v'2 t | features |
-> Tensor Build t | backprops |
:: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor Build t | y |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t | |
=> Tensor v'1 t | y |
-> Tensor v'2 t | dy |
-> Tensor Build t | z |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tshape. (TensorType t, OneOf '[Int32, Int64] tshape) | |
=> Tensor v'1 t | tensor |
-> Tensor v'2 tshape | shape |
-> Tensor Build t | output |
:: forall a m. (MonadBuild m, TensorType a) | |
=> ByteString | File path. |
-> Tensor Ref a | Tensor to restore. |
-> m ControlNode |
Restore a tensor's value from a checkpoint file.
:: forall a m. (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.
:: forall a m v. (Rendered (Tensor v), MonadBuild m, TensorType a) | |
=> ByteString | File path. |
-> [Tensor v a] | Tensors to save. |
-> m ControlNode |
:: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor Build t | y |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Word16, Double, Float] t | |
=> Tensor v'1 t | y |
-> Tensor v'2 t | dy |
-> Tensor Build t | z |
:: forall (v'1 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int32, Int64, Word16, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor Build t | y |
:: forall (v'1 :: Type -> Type) t out_type. (TensorType t, OneOf '[Int32, Int64] out_type) | |
=> Tensor v'1 t | input |
-> Tensor Build out_type | output |
:: forall (v'1 :: Type -> Type) t. OneOf '[Word16, Double, Float] t | |
=> Tensor v'1 t | logits |
-> Tensor Build t | softmax |
softmaxCrossEntropyWithLogits #
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Word16, Double, Float] t | |
=> Tensor v'1 t | features |
-> Tensor v'2 t | labels |
-> (Tensor Build t, Tensor Build t) | (loss, backprop)
|
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tindices. (TensorType t, OneOf '[Int32, Int64] tindices) | |
=> Tensor v'1 tindices | sparse_indices |
-> Tensor v'2 tindices | output_shape |
-> Tensor v'3 t | sparse_values |
-> Tensor v'4 t | default_value |
-> Tensor Build t | dense |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) (v'3 :: Type -> Type) (v'4 :: Type -> Type) t tindices. (TensorType t, OneOf '[Int32, Int64] tindices) | |
=> OpParams | |
-> Tensor v'1 tindices | sparse_indices |
-> Tensor v'2 tindices | output_shape |
-> Tensor v'3 t | sparse_values |
-> Tensor v'4 t | default_value |
-> Tensor Build t | dense |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t. OneOf '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16, Word32, Word8, Double, Float] t | |
=> Tensor v'1 t | x |
-> Tensor v'2 t | y |
-> Tensor Build t | z |
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tidx. (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 |
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 #
:: forall (v'1 :: Type -> Type) (v'2 :: Type -> Type) t tperm. (TensorType t, OneOf '[Int32, Int64] tperm) | |
=> Tensor v'1 t | x |
-> Tensor v'2 tperm | perm |
-> Tensor Build t | y |
Random tensor from the unit normal distribution with bounded values.
This is a type-restricted version of truncatedNormal
.
:: forall dtype m'. (MonadBuild m', TensorType dtype) | |
=> Shape | shape |
-> m' (Tensor Ref dtype) | ref |
:: forall dtype m'. (MonadBuild m', TensorType dtype) | |
=> OpParams | |
-> Shape | shape |
-> m' (Tensor Ref dtype) | ref |
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". |