tensorflow-0.1.0.2: 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 :: TensorKind v => {..} -> Tensor v a 

Fields

Instances

newtype Value a Source #

Constructors

Value 

Fields

Instances

Monad Value Source # 

Methods

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

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

return :: a -> Value a #

fail :: String -> Value a #

Functor Value Source # 

Methods

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

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

Applicative Value Source # 

Methods

pure :: a -> Value a #

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

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

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

TensorKind Value Source # 

Methods

toBuild :: Value a -> Build a Source #

Rendered (Tensor Value) Source # 

newtype Ref a Source #

Constructors

Ref 

Fields

Instances

Monad Ref Source # 

Methods

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

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

return :: a -> Ref a #

fail :: String -> Ref a #

Functor Ref Source # 

Methods

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

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

Applicative Ref Source # 

Methods

pure :: a -> Ref a #

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

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

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

TensorKind Ref Source # 

Methods

toBuild :: Ref a -> Build a Source #

Rendered (Tensor Ref) Source # 

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.

Minimal complete definition

renderedOutput

Methods

renderedOutput :: t a -> Output Source #

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.

Minimal complete definition

toBuild

Methods

toBuild :: v a -> Build a Source #

Instances

class ToTensor t where Source #

Types which can be converted to Tensor.

Minimal complete definition

toTensor

Methods

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

Instances