提交 a8242ddf authored 作者: james@crane's avatar james@crane

more better docs for type

上级 c72934ba
...@@ -240,6 +240,9 @@ class PureType(object): ...@@ -240,6 +240,9 @@ class PureType(object):
return r return r
_nothing = """
"""
class Type(object2, PureType, CLinkerType): class Type(object2, PureType, CLinkerType):
"""Convenience wrapper combining `PureType` and `CLinkerType`. """Convenience wrapper combining `PureType` and `CLinkerType`.
...@@ -254,15 +257,14 @@ class Type(object2, PureType, CLinkerType): ...@@ -254,15 +257,14 @@ class Type(object2, PureType, CLinkerType):
But you are encouraged to write your own, as described in WRITEME. But you are encouraged to write your own, as described in WRITEME.
In the following code: The following following code illustrates the use of a Type instance, here tensor.fvector:
.. python::
# Note: tensor.fvector is a Type (subtype Tensor) instance
# Declare a symbolic floating-point vector using __call__
b = tensor.fvector()
# Create a second Result with the same Type instance .. python::
c = tensor.fvector() # Declare a symbolic floating-point vector using __call__
b = tensor.fvector()
# Create a second Result with the same Type instance
c = tensor.fvector()
Whenever you create a symbolic variable in theano (technically, `Result`) it will contain a Whenever you create a symbolic variable in theano (technically, `Result`) it will contain a
reference to a Type instance. That reference is typically constant during the lifetime of reference to a Type instance. That reference is typically constant during the lifetime of
...@@ -276,7 +278,6 @@ class Type(object2, PureType, CLinkerType): ...@@ -276,7 +278,6 @@ class Type(object2, PureType, CLinkerType):
Many `Op` instances will raise an exception if they are applied to inputs with incorrect Many `Op` instances will raise an exception if they are applied to inputs with incorrect
types. Type references are also useful to do type-checking in pattern-based optimizations. types. Type references are also useful to do type-checking in pattern-based optimizations.
""" """
class SingletonType(Type): class SingletonType(Type):
......
...@@ -7,7 +7,17 @@ ...@@ -7,7 +7,17 @@
# The list of objects to document. Objects can be named using # The list of objects to document. Objects can be named using
# dotted names, module filenames, or package directory names. # dotted names, module filenames, or package directory names.
# Alases for this option include "objects" and "values". # Alases for this option include "objects" and "values".
modules: *.py, gof/*.py modules: *.py, gof/__init__.py,
gof/a*,
gof/c*,
gof/d*,
gof/e*,
gof/g*,
gof/l*,
gof/o*,
gof/p*,
gof/t*,
gof/u*
# The type of output that should be generated. Should be one # The type of output that should be generated. Should be one
# of: html, text, latex, dvi, ps, pdf. # of: html, text, latex, dvi, ps, pdf.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论