Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class TensorType a where
- tensorType :: a -> DataType
- tensorRefType :: a -> DataType
- tensorVal :: Lens' TensorProto [a]
- newtype TensorData a = TensorData {}
- class TensorType a => TensorDataType s a where
- decodeTensorData :: TensorData a -> s a
- encodeTensorData :: Shape -> s a -> TensorData a
- newtype Scalar a = Scalar {
- unScalar :: a
- newtype Shape = Shape [Int64]
- protoShape :: Lens' TensorShapeProto Shape
- class Attribute a where
- data DataType
- = DT_INVALID
- | DT_FLOAT
- | DT_DOUBLE
- | DT_INT32
- | DT_UINT8
- | DT_INT16
- | DT_INT8
- | DT_STRING
- | DT_COMPLEX64
- | DT_INT64
- | DT_BOOL
- | DT_QINT8
- | DT_QUINT8
- | DT_QINT32
- | DT_BFLOAT16
- | DT_QINT16
- | DT_QUINT16
- | DT_UINT16
- | DT_COMPLEX128
- | DT_HALF
- | DT_RESOURCE
- | DT_VARIANT
- | DT_UINT32
- | DT_UINT64
- | DT_FLOAT_REF
- | DT_DOUBLE_REF
- | DT_INT32_REF
- | DT_UINT8_REF
- | DT_INT16_REF
- | DT_INT8_REF
- | DT_STRING_REF
- | DT_COMPLEX64_REF
- | DT_INT64_REF
- | DT_BOOL_REF
- | DT_QINT8_REF
- | DT_QUINT8_REF
- | DT_QINT32_REF
- | DT_BFLOAT16_REF
- | DT_QINT16_REF
- | DT_QUINT16_REF
- | DT_UINT16_REF
- | DT_COMPLEX128_REF
- | DT_HALF_REF
- | DT_RESOURCE_REF
- | DT_VARIANT_REF
- | DT_UINT32_REF
- | DT_UINT64_REF
- | DataType'Unrecognized !DataType'UnrecognizedValue
- type ResourceHandle = ResourceHandleProto
- data Variant
- data ListOf f as where
- type List = ListOf Identity
- (/:/) :: a -> List as -> List (a ': as)
- data TensorTypeProxy a where
- TensorTypeProxy :: TensorType a => TensorTypeProxy a
- class TensorTypes (ts :: [*]) where
- tensorTypes :: TensorTypeList ts
- type TensorTypeList = ListOf TensorTypeProxy
- fromTensorTypeList :: TensorTypeList ts -> [DataType]
- fromTensorTypes :: forall as. TensorTypes as => Proxy as -> [DataType]
- type OneOf ts a = (TensorType a, TensorTypes' ts, NoneOf (AllTensorTypes \\ ts) a)
- type family a /= b :: Constraint where ...
- type OneOfs ts as = (TensorTypes as, TensorTypes' ts, NoneOfs (AllTensorTypes \\ ts) as)
- data TypeError a
- data ExcludedCase
- type family NoneOf ts a :: Constraint where ...
- type family as \\ bs where ...
- type family Delete a as where ...
- type AllTensorTypes = '[Float, Double, Int8, Int16, Int32, Int64, Word8, Word16, ByteString, Bool]
Documentation
class TensorType a where Source #
The class of scalar types supported by tensorflow.
tensorType :: a -> DataType Source #
tensorRefType :: a -> DataType Source #
tensorVal :: Lens' TensorProto [a] Source #
Instances
newtype TensorData a Source #
Tensor data with the correct memory layout for tensorflow.
Instances
(TensorType a, a ~ a') => Fetchable (Tensor v a) (TensorData a') Source # | |
Defined in TensorFlow.Nodes |
class TensorType a => TensorDataType s a where Source #
Types that can be converted to and from TensorData
.
Vector
is the most efficient to encode/decode for most element types.
decodeTensorData :: TensorData a -> s a Source #
Decode the bytes of a TensorData
into an s
.
encodeTensorData :: Shape -> s a -> TensorData a Source #
Encode an s
into a TensorData
.
The values should be in row major order, e.g.,
element 0: index (0, ..., 0) element 1: index (0, ..., 1) ...
Instances
Instances
Shape (dimensions) of a tensor.
TensorFlow supports shapes of unknown rank, which are represented as
Nothing :: Maybe Shape
in Haskell.
protoShape :: Lens' TensorShapeProto Shape Source #
class Attribute a where Source #
Instances
Attribute Bool Source # | |
Attribute Float Source # | |
Attribute Int64 Source # | |
Attribute ByteString Source # | |
Defined in TensorFlow.Types attrLens :: Lens' AttrValue ByteString Source # | |
Attribute AttrValue'ListValue Source # | |
Defined in TensorFlow.Types attrLens :: Lens' AttrValue AttrValue'ListValue Source # | |
Attribute TensorProto Source # | |
Defined in TensorFlow.Types attrLens :: Lens' AttrValue TensorProto Source # | |
Attribute DataType Source # | |
Attribute Shape Source # | |
Attribute [Int64] Source # | |
Attribute [DataType] Source # | |
Attribute (Maybe Shape) Source # | |
Instances
type ResourceHandle = ResourceHandleProto Source #
Dynamic type. TensorFlow variants aren't supported yet. This type acts a placeholder to simplify op generation.
Instances
TensorType Variant Source # | |
Defined in TensorFlow.Types tensorType :: Variant -> DataType Source # tensorRefType :: Variant -> DataType Source # tensorVal :: Lens' TensorProto [Variant] Source # |
Lists
data ListOf f as where Source #
A heterogeneous list type.
Instances
All Eq (Map f as) => Eq (ListOf f as) Source # | |
All Show (Map f as) => Show (ListOf f as) Source # | |
(Nodes (f a), Nodes (ListOf f as)) => Nodes (ListOf f (a ': as)) Source # | |
Nodes (ListOf f ('[] :: [Type])) Source # | |
BuildInputs (ListOf (Tensor v) as) Source # | |
Defined in TensorFlow.BuildOp | |
TensorTypes as => PureResult (TensorList Build as) Source # | |
Defined in TensorFlow.BuildOp pureResult :: ReaderT (Build OpDef) (State ResultState) (TensorList Build as) Source # | |
(TensorKind v, Rendered (Tensor v), TensorTypes as) => BuildResult (TensorList v as) Source # | |
Defined in TensorFlow.BuildOp buildResult :: Result (TensorList v as) Source # | |
l ~ List ('[] :: [Type]) => Fetchable (ListOf f ('[] :: [Type])) l Source # | |
(Fetchable (f t) a, Fetchable (ListOf f ts) (List as), i ~ Identity) => Fetchable (ListOf f (t ': ts)) (ListOf i (a ': as)) Source # | |
data TensorTypeProxy a where Source #
TensorTypeProxy :: TensorType a => TensorTypeProxy a |
class TensorTypes (ts :: [*]) where Source #
tensorTypes :: TensorTypeList ts Source #
Instances
TensorTypes ('[] :: [Type]) Source # | |
Defined in TensorFlow.Types tensorTypes :: TensorTypeList '[] Source # | |
(TensorType t, TensorTypes ts) => TensorTypes (t ': ts) Source # | A constraint that the input is a list of |
Defined in TensorFlow.Types tensorTypes :: TensorTypeList (t ': ts) Source # |
type TensorTypeList = ListOf TensorTypeProxy Source #
fromTensorTypeList :: TensorTypeList ts -> [DataType] Source #
fromTensorTypes :: forall as. TensorTypes as => Proxy as -> [DataType] Source #
Type constraints
type OneOf ts a = (TensorType a, TensorTypes' ts, NoneOf (AllTensorTypes \\ ts) a) Source #
A Constraint
specifying the possible choices of a TensorType
.
We implement a Constraint
like OneOf '[Double, Float] a
by turning the
natural representation as a conjunction, i.e.,
a == Double || a == Float
into a disjunction like
a /= Int32 && a /= Int64 && a /= ByteString && ...
using an enumeration of all the possible TensorType
s.
type family a /= b :: Constraint where ... Source #
A constraint checking that two types are different.
a /= a = TypeError a ~ ExcludedCase | |
a /= b = () |
type OneOfs ts as = (TensorTypes as, TensorTypes' ts, NoneOfs (AllTensorTypes \\ ts) as) Source #
Implementation of constraints
Helper types to produce a reasonable type error message when the Constraint "a /= a" fails. TODO(judahjacobson): Use ghc-8's CustomTypeErrors for this.
data ExcludedCase Source #
type family NoneOf ts a :: Constraint where ... Source #
A constraint that the type a
doesn't appear in the type list ts
.
Assumes that a
and each of the elements of ts
are TensorType
s.
type AllTensorTypes = '[Float, Double, Int8, Int16, Int32, Int64, Word8, Word16, ByteString, Bool] Source #
An enumeration of all valid TensorType
s.