tensorflow-0.3.0.0: TensorFlow bindings.
Safe HaskellNone
LanguageHaskell2010

TensorFlow.Tensor

Synopsis

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.

Constructors

Tensor 

Fields

Instances

Instances details
TensorKind v => ToTensor (Tensor v) Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toTensor :: TensorType a => Tensor v a -> Tensor Build a Source #

Rendered (Tensor Ref) Source # 
Instance details

Defined in TensorFlow.Tensor

Rendered (Tensor Value) Source # 
Instance details

Defined in TensorFlow.Tensor

Nodes (Tensor v a) Source # 
Instance details

Defined in TensorFlow.Nodes

Methods

getNodes :: Tensor v a -> Build (Set NodeName) Source #

BuildInputs (ListOf (Tensor v) as) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

buildInputs :: ListOf (Tensor v) as -> Build [Output] Source #

BuildInputs (Tensor v a) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

buildInputs :: Tensor v a -> Build [Output] Source #

TensorTypes as => PureResult (TensorList Build as) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

pureResult :: ReaderT (Build OpDef) (State ResultState) (TensorList Build as) Source #

PureResult (Tensor Build a) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

pureResult :: ReaderT (Build OpDef) (State ResultState) (Tensor Build a) Source #

(TensorKind v, Rendered (Tensor v), TensorTypes as) => BuildResult (TensorList v as) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

buildResult :: Result (TensorList v as) Source #

(TensorKind v, Rendered (Tensor v)) => BuildResult (Tensor v a) Source # 
Instance details

Defined in TensorFlow.BuildOp

Methods

buildResult :: Result (Tensor v a) Source #

(TensorType a, TensorDataType s a, a ~ a') => Fetchable (Tensor v a) (s a') Source # 
Instance details

Defined in TensorFlow.Nodes

Methods

getFetch :: Tensor v a -> Build (Fetch (s a')) Source #

(TensorType a, a ~ a') => Fetchable (Tensor v a) (TensorData a') Source # 
Instance details

Defined in TensorFlow.Nodes

Methods

getFetch :: Tensor v a -> Build (Fetch (TensorData a')) Source #

newtype Value a Source #

Constructors

Value 

Fields

Instances

Instances details
Monad Value Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

(>>=) :: Value a -> (a -> Value b) -> Value b #

(>>) :: Value a -> Value b -> Value b #

return :: a -> Value a #

Functor Value Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

fmap :: (a -> b) -> Value a -> Value b #

(<$) :: a -> Value b -> Value a #

Applicative Value Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

pure :: a -> Value a #

(<*>) :: Value (a -> b) -> Value a -> Value b #

liftA2 :: (a -> b -> c) -> Value a -> Value b -> Value c #

(*>) :: Value a -> Value b -> Value b #

(<*) :: Value a -> Value b -> Value a #

TensorKind Value Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toBuild :: Value a -> Build a Source #

Rendered (Tensor Value) Source # 
Instance details

Defined in TensorFlow.Tensor

newtype Ref a Source #

Constructors

Ref 

Fields

Instances

Instances details
Monad Ref Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

(>>=) :: Ref a -> (a -> Ref b) -> Ref b #

(>>) :: Ref a -> Ref b -> Ref b #

return :: a -> Ref a #

Functor Ref Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

fmap :: (a -> b) -> Ref a -> Ref b #

(<$) :: a -> Ref b -> Ref a #

Applicative Ref Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

pure :: a -> Ref a #

(<*>) :: Ref (a -> b) -> Ref a -> Ref b #

liftA2 :: (a -> b -> c) -> Ref a -> Ref b -> Ref c #

(*>) :: Ref a -> Ref b -> Ref b #

(<*) :: Ref a -> Ref b -> Ref a #

TensorKind Ref Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toBuild :: Ref a -> Build a Source #

Rendered (Tensor Ref) Source # 
Instance details

Defined in TensorFlow.Tensor

value :: Tensor Ref a -> Tensor Value a Source #

Cast a 'Tensor Ref' into a 'Tensor Value'. This behaves like a no-op.

data Feed Source #

A pair of a Tensor and some data that should be fed into that Tensor when running the graph.

Constructors

Feed Output TensorData 

class Rendered t where Source #

A class ensuring that a given tensor is rendered, i.e., has a fixed name, device, etc.

Methods

renderedOutput :: t a -> Output Source #

Instances

Instances details
Rendered (Tensor Ref) Source # 
Instance details

Defined in TensorFlow.Tensor

Rendered (Tensor Value) Source # 
Instance details

Defined in TensorFlow.Tensor

feed :: Rendered t => t a -> TensorData a -> Feed Source #

Create a Feed for feeding the given data into a Tensor when running the graph.

Note that if a Tensor is rendered, its identity may change; so feeding the rendered Tensor may be different than feeding the original Tensor.

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.

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 Values.

addSummary Source #

Arguments

:: (MonadBuild m, TensorKind v) 
=> Tensor v ByteString

A SummaryTensor

-> 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.

Methods

toBuild :: v a -> Build a Source #

Instances

Instances details
TensorKind Build Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toBuild :: Build a -> Build a Source #

TensorKind Ref Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toBuild :: Ref a -> Build a Source #

TensorKind Value Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toBuild :: Value a -> Build a Source #

class ToTensor t where Source #

Types which can be converted to Tensor.

Methods

toTensor :: TensorType a => t a -> Tensor Build a Source #

Instances

Instances details
TensorKind v => ToTensor (Tensor v) Source # 
Instance details

Defined in TensorFlow.Tensor

Methods

toTensor :: TensorType a => Tensor v a -> Tensor Build a Source #