Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Tensor v a where
- Tensor :: TensorKind v => {..} -> Tensor v a
- newtype Value a = Value {
- runValue :: a
- newtype Ref a = Ref {
- runRef :: a
- value :: Tensor Ref a -> Tensor Value a
- renderValue :: MonadBuild m => Tensor v a -> m (Tensor Value a)
- data Feed = Feed Output TensorData
- class Rendered t where
- renderedOutput :: t a -> Output
- tensorNodeName :: Rendered t => t a -> NodeName
- feed :: Rendered t => t a -> TensorData a -> Feed
- tensorFromName :: TensorKind v => Text -> Tensor v a
- tensorValueFromName :: Text -> Tensor Value a
- tensorRefFromName :: Text -> Tensor Ref a
- type TensorList v = ListOf (Tensor v)
- tensorListOutputs :: Rendered (Tensor v) => TensorList v as -> [Output]
- colocateWith :: (MonadBuild m, Rendered t) => t b -> m a -> m a
- render :: MonadBuild m => Tensor Build a -> m (Tensor Value a)
- expr :: TensorKind v => Tensor v a -> Tensor Build a
- addSummary :: (MonadBuild m, TensorKind v) => Tensor v ByteString -> m ()
- collectAllSummaries :: MonadBuild m => m [SummaryTensor]
- type SummaryTensor = Tensor Value ByteString
- class Monad v => TensorKind v where
- class ToTensor t where
- toTensor :: TensorType a => t a -> Tensor Build a
Documentation
data Tensor v a where Source #
A named output of a TensorFlow operation.
The type parameter a
is the type of the elements in the Tensor
. The
parameter v
is either:
Build
: An unrendered, immutable value.Value
: A rendered, immutable value.Ref
: A rendered stateful handle (e.g., a variable).
Note that expr
, value
, render
and renderValue
can help convert between
the different types of Tensor
.
Tensor | |
|
Instances
value :: Tensor Ref a -> Tensor Value a Source #
Cast a 'Tensor Ref' into a 'Tensor Value'. This behaves like a no-op.
renderValue :: MonadBuild m => Tensor v a -> m (Tensor Value a) Source #
class Rendered t where Source #
A class ensuring that a given tensor is rendered, i.e., has a fixed name, device, etc.
renderedOutput :: t a -> Output Source #
tensorNodeName :: Rendered t => t a -> NodeName Source #
tensorFromName :: TensorKind v => Text -> Tensor v a Source #
Create a Tensor
for a given name. This can be used to reference nodes
in a GraphDef
that was loaded via addGraphDef
.
TODO(judahjacobson): add more safety checks here.
tensorValueFromName :: Text -> Tensor Value a Source #
Like tensorFromName
, but type-restricted to Value
.
tensorRefFromName :: Text -> Tensor Ref a Source #
Like tensorFromName
, but type-restricted to Ref
.
type TensorList v = ListOf (Tensor v) Source #
tensorListOutputs :: Rendered (Tensor v) => TensorList v as -> [Output] Source #
colocateWith :: (MonadBuild m, Rendered t) => t b -> m a -> m a Source #
Places all nodes rendered in the given Build
action on the same
device as the given Tensor (see also withDevice
). Make sure that
the action has side effects of rendering the desired tensors. A pure
return would not have the desired effect.
render :: MonadBuild m => Tensor Build a -> m (Tensor Value a) Source #
Render a Tensor
, fixing its name, scope, device and control inputs from
the MonadBuild
context. Also renders any dependencies of the Tensor
that
weren't already rendered.
This operation is idempotent; calling render
on the same input in the same
context will produce the same result. However, rendering the same
Tensor Build
in two different contexts may result in two different
Tensor Value
s.
:: (MonadBuild m, TensorKind v) | |
=> Tensor v ByteString | |
-> m () |
Records the given summary action in Build for retrieval with Summary protocol buffer in string form. For safety, use the pre-composed functions: Logging.scalarSummary and Logging.histogramSummary.
collectAllSummaries :: MonadBuild m => m [SummaryTensor] Source #
Retrieves the summary ops collected thus far. Typically this only
happens once, but if buildWithSummary
is used
repeatedly, the values accumulate.
type SummaryTensor = Tensor Value ByteString Source #
Synonym for the tensors that return serialized Summary proto.
class Monad v => TensorKind v where Source #
An internal class for kinds of Tensors.