1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-12-26 11:39:46 +01:00
tensorflow-haskell/docs/haddock/tensorflow-opgen-0.1.0.0/tensorflow-opgen.txt

162 lines
5.6 KiB
Text
Raw Normal View History

-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Code generation for TensorFlow operations.
--
-- Please see README.md
@package tensorflow-opgen
@version 0.1.0.0
2016-11-23 19:55:35 +01:00
-- | This module helps parse the proto OpDef into a Haskell type which is
-- more descriptive of how the attributes and arguments will be used in
-- the generated code.
module TensorFlow.OpGen.ParsedOp
data ParsedOp
2017-04-08 16:14:47 +02:00
ParsedOp :: Name -> Text -> Text -> [ParsedArg] -> [ParsedArg] -> [Attr AttrType] -> [Attr TypeParam] -> [Attr (NonEmpty Name)] -> Bool -> ParsedOp
2016-11-23 19:55:35 +01:00
[parsedOpName] :: ParsedOp -> Name
[parsedOpSummary] :: ParsedOp -> Text
[parsedOpDescription] :: ParsedOp -> Text
[parsedInputs] :: ParsedOp -> [ParsedArg]
[parsedOutputs] :: ParsedOp -> [ParsedArg]
-- | Attributes that must be set explicitly when creating the op.
-- Associated with the type of the attribute.
[explicitInputAttrs] :: ParsedOp -> [Attr AttrType]
2017-04-08 16:14:47 +02:00
-- | Attributes that are type parameters.
[inferredTypeAttrs] :: ParsedOp -> [Attr TypeParam]
2016-11-23 19:55:35 +01:00
[inferredListSizeAttrs] :: ParsedOp -> [Attr (NonEmpty Name)]
-- | Whether this op is stateful or takes a stateful input. Such ops should
-- not be CSE'd and must be monadic in our API (i.e., return a Build
-- action).
[parsedOpIsMonadic] :: ParsedOp -> Bool
data Name
Name :: HaskellName -> TFName -> Name
[haskellName] :: Name -> HaskellName
[tfName] :: Name -> TFName
-- | A name that's appropriate for a variable in a Haskell source file.
newtype HaskellName
HaskellName :: Text -> HaskellName
[unHaskellName] :: HaskellName -> Text
-- | A raw name as specified in the OpDef proto.
newtype TFName
TFName :: Text -> TFName
[unTFName] :: TFName -> Text
-- | A named attribute, associated with some information about it.
data Attr a
Attr :: Name -> Text -> a -> Attr a
[attrName] :: Attr a -> Name
[attrDescription] :: Attr a -> Text
[attrInfo] :: Attr a -> a
-- | The type of an attribute.
data AttrType
AttrSingle :: AttrBaseType -> AttrType
AttrList :: AttrBaseType -> AttrType
data AttrBaseType
AttrBytes :: AttrBaseType
AttrInt64 :: AttrBaseType
AttrFloat :: AttrBaseType
AttrBool :: AttrBaseType
AttrType :: AttrBaseType
AttrShape :: AttrBaseType
AttrTensor :: AttrBaseType
2017-04-08 16:14:47 +02:00
data TypeParam
TypeParam :: Bool -> Maybe (NonEmpty DataType) -> TypeParam
[typeParamIsList] :: TypeParam -> Bool
-- | The list of allowed types (see: TensorFlow.Types.OneOf). If
-- <a>Nothing</a>, then any type is acceptable.
[typeParamRestrictions] :: TypeParam -> Maybe (NonEmpty DataType)
2016-11-23 19:55:35 +01:00
-- | An input or output argument (Tensor) for an op.
data ParsedArg
2017-04-08 16:14:47 +02:00
ParsedArg :: Name -> Text -> ParsedArgCase -> ParsedArg
2016-11-23 19:55:35 +01:00
[parsedArgName] :: ParsedArg -> Name
[parsedArgDescription] :: ParsedArg -> Text
[parsedArgCase] :: ParsedArg -> ParsedArgCase
data ParsedArgCase
2017-04-08 16:14:47 +02:00
SimpleArg :: ArgType -> ArgKind -> ParsedArgCase
2016-11-23 19:55:35 +01:00
[argType] :: ParsedArgCase -> ArgType
2017-04-08 16:14:47 +02:00
[argCaseKind] :: ParsedArgCase -> ArgKind
ListArg :: Name -> ArgType -> ArgKind -> ParsedArgCase
2016-11-23 19:55:35 +01:00
-- | The attribute that specifies this list's length.
[argLength] :: ParsedArgCase -> Name
[argType] :: ParsedArgCase -> ArgType
2017-04-08 16:14:47 +02:00
[argCaseKind] :: ParsedArgCase -> ArgKind
2016-11-23 19:55:35 +01:00
2017-04-08 16:14:47 +02:00
-- | A heterogeneous list.
MixedListArg :: Name -> ArgKind -> ParsedArgCase
2016-11-23 19:55:35 +01:00
[argTypeAttr] :: ParsedArgCase -> Name
2017-04-08 16:14:47 +02:00
[argCaseKind] :: ParsedArgCase -> ArgKind
ResourceArg :: ParsedArgCase
2016-11-23 19:55:35 +01:00
-- | The type of an argument.
data ArgType
-- | A fixed type.
ArgTypeFixed :: DataType -> ArgType
-- | A type that depends on an attribute.
ArgTypeAttr :: Name -> ArgType
data ArgKind
ArgTensorRef :: ArgKind
ArgTensorValue :: ArgKind
2017-04-08 16:14:47 +02:00
ArgTensorBuild :: ArgKind
ArgSomeTensor :: Text -> ArgKind
argKind :: ParsedArgCase -> Maybe ArgKind
2016-11-23 19:55:35 +01:00
parseOp :: OpDef -> ParsedOp
camelCase :: Text -> Text
2017-04-08 16:14:47 +02:00
instance GHC.Classes.Eq TensorFlow.OpGen.ParsedOp.ArgKind
2016-11-23 19:55:35 +01:00
instance GHC.Classes.Eq TensorFlow.OpGen.ParsedOp.AttrType
instance GHC.Classes.Eq TensorFlow.OpGen.ParsedOp.AttrBaseType
instance GHC.Classes.Ord TensorFlow.OpGen.ParsedOp.TFName
instance GHC.Classes.Eq TensorFlow.OpGen.ParsedOp.TFName
-- | Rendering of TensorFlow operations as Haskell functions.
2016-11-23 19:55:35 +01:00
--
-- The basic type signature generated for each op is:
--
-- <pre>
-- {constraints} =&gt; {mandatory attrs} -&gt; {input tensors} -&gt; {output tensors}
-- </pre>
--
-- where:
--
-- <ul>
-- <li><tt>{mandatory attrs}</tt> is of the form <tt>A_1 -&gt; ... -&gt;
-- A_N</tt>, where each <tt>A</tt> is an op attribute that doesn't have a
-- default and can't be inferred from other inputs.</li>
-- <li><tt>{constraints}</tt> restrict the type parameters of the input
-- and output tensors (for example: <tt>TensorType</tt> or
-- <tt>OneOf</tt>).</li>
-- <li><tt>{input tensors}</tt> is of the form <tt>T_1 -&gt; ... -&gt;
-- T_N</tt>, where each <tt>T</tt> is of the form <tt>Tensor Ref a</tt>,
2017-04-08 16:14:47 +02:00
-- <tt>Tensor v a</tt> or <tt>ResourceHandle</tt> (or a list of one of
2016-11-23 19:55:35 +01:00
-- those types), and <tt>a</tt> is either a concrete type or a
-- (constrained) type variable.</li>
-- <li><tt>{output tensors}</tt> is of the form <tt>(T_1,...,T_N)</tt>
-- for "pure" ops, and <tt>Build (T_1,...,T_N)</tt> for "stateful" ops.
-- An op is considered "stateful" if it takes a <tt>Tensor Ref</tt> or
-- <tt>ResourceHandle</tt> as input, or if it's explicitly marked
-- "Stateful" in its <tt>REGISTER_OP</tt> definition. (If there are no
-- outputs, it is either <tt>ControlNode</tt> or <tt>Build
-- ControlNode</tt>.)</li>
-- </ul>
module TensorFlow.OpGen
data OpGenFlags
OpGenFlags :: String -> String -> String -> OpGenFlags
[outputFile] :: OpGenFlags -> String
[prefix] :: OpGenFlags -> String
[excludeList] :: OpGenFlags -> String
docOpList :: OpGenFlags -> OpList -> Doc
flagParser :: Parser OpGenFlags