Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
99647a3b
提交
99647a3b
authored
3月 20, 2009
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
e8a4b044
6c77667d
全部展开
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
101 行增加
和
68 行删除
+101
-68
op.txt
doc/advanced_tutorial/ex1/op.txt
+0
-0
type.txt
doc/advanced_tutorial/ex1/type.txt
+0
-37
graphstructures.txt
doc/advanced_tutorial/graphstructures.txt
+77
-29
theano_vs_python.txt
doc/advanced_tutorial/theano_vs_python.txt
+1
-1
function.txt
doc/basic_tutorial/function.txt
+0
-0
index.txt
doc/basic_tutorial/index.txt
+1
-0
numpy.txt
doc/sandbox/numpy.txt
+8
-0
function_module.py
theano/compile/function_module.py
+12
-0
io.py
theano/compile/io.py
+2
-1
没有找到文件。
doc/advanced_tutorial/ex1/op.txt
浏览文件 @
99647a3b
差异被折叠。
点击展开。
doc/advanced_tutorial/ex1/type.txt
浏览文件 @
99647a3b
...
@@ -5,43 +5,6 @@ Making the double type
...
@@ -5,43 +5,6 @@ Making the double type
======================
======================
What is a Type?
===============
A :ref:`type` in Theano represents a set of constraints on potential
data objects. These constraints allow Theano to tailor C code to handle
them and to statically optimize the computation graph. For instance,
the :ref:`irow <predefinedtypes>` type in the ``theano.tensor`` package
gives the following constraints on the data the Results of type ``irow``
may contain:
#. Must be an instance of ``numpy.ndarray``: ``isinstance(x, numpy.ndarray)``
#. Must be an array of 32-bit integers: ``str(x.dtype) == 'int32'``
#. Must have a shape of 1xN: ``len(x.shape) == 2 and x.shape[0] == 1``
Knowing these restrictions, Theano may generate C code for addition, etc.
that declares the right data types and that contains the right number
of loops over the dimensions.
Note that a Theano :ref:`type` is not equivalent to a Python type or
class. Indeed, in Theano, :ref:`irow <predefinedtypes>` and :ref:`dmatrix
<predefinedtypes>` both use ``numpy.ndarray`` as the underlying type
for doing computations and storing data, yet they are different Theano
Types. Indeed, the constraints set by ``dmatrix`` are:
#. Must be an instance of ``numpy.ndarray``: ``isinstance(x, numpy.ndarray)``
#. Must be an array of 64-bit floating point numbers: ``str(x.dtype) == 'float64'``
#. Must have a shape of MxN, no restriction on M or N: ``len(x.shape) == 2``
These restrictions are different from those of ``irow`` which are listed above.
There are cases in which a Type can fully correspond to a Python type,
such as the ``double`` Type we will define here which corresponds to
Python's ``float``. But, it's good to know that this is not necessarily
the case. Unless specified otherwise, when we say "Type" we mean a
Theano Type.
Type's contract
Type's contract
===============
===============
...
...
doc/advanced_tutorial/graphstructures.txt
浏览文件 @
99647a3b
...
@@ -169,6 +169,10 @@ theano's version of a function definition.
...
@@ -169,6 +169,10 @@ theano's version of a function definition.
An Apply instance has three important fields:
An Apply instance has three important fields:
**op**
An :ref:`op` that determines the function/transformation being
applied here.
**inputs**
**inputs**
A list of :ref:`Results <result>` that represent the arguments of
A list of :ref:`Results <result>` that represent the arguments of
the function.
the function.
...
@@ -177,33 +181,8 @@ An Apply instance has three important fields:
...
@@ -177,33 +181,8 @@ An Apply instance has three important fields:
A list of :ref:`Results <result>` that represent the return values
A list of :ref:`Results <result>` that represent the return values
of the function.
of the function.
**op**
An Apply instance can be created by calling ``gof.Apply(op, inputs,
An :ref:`op` that determines the function/transformation being
outputs)``.
applied here.
.. index::
single: Constant
single: graph construct; Constant
.. _constant:
--------
Constant
--------
A constant is a :ref:`Result` with one extra field, *data* (only
settable once). When used in a computation graph as the input of an
:ref:`Op` :ref:`application <Apply>`, it is assumed that said input
will *always* take the value contained in the constant's data
field. Furthermore, it is assumed that the :ref:`Op` will not under
any circumstances modify the input. This means that a constant is
eligible to participate in numerous optimizations: constant inlining
in C code, constant folding, etc.
A constant does not need to be specified in a :ref:`function`'s list
of inputs.
.. index::
.. index::
...
@@ -212,6 +191,8 @@ of inputs.
...
@@ -212,6 +191,8 @@ of inputs.
.. _result:
.. _result:
------
------
Result
Result
------
------
...
@@ -263,6 +244,28 @@ A Result ``r`` contains four important fields:
...
@@ -263,6 +244,28 @@ A Result ``r`` contains four important fields:
Result has one special subclass: :ref:`constant <constant>`.
Result has one special subclass: :ref:`constant <constant>`.
.. index::
single: Constant
single: graph construct; Constant
.. _constant:
Constant
^^^^^^^^
A constant is a :ref:`Result` with one extra field, *data* (only
settable once). When used in a computation graph as the input of an
:ref:`Op` :ref:`application <Apply>`, it is assumed that said input
will *always* take the value contained in the constant's data
field. Furthermore, it is assumed that the :ref:`Op` will not under
any circumstances modify the input. This means that a constant is
eligible to participate in numerous optimizations: constant inlining
in C code, constant folding, etc.
A constant does not need to be specified in a :ref:`function`'s list
of inputs.
.. index::
.. index::
...
@@ -275,7 +278,20 @@ Result has one special subclass: :ref:`constant <constant>`.
...
@@ -275,7 +278,20 @@ Result has one special subclass: :ref:`constant <constant>`.
Op
Op
--
--
WRITEME
An :ref:`op` in Theano defines a certain computation on some types of
inputs, producing some types of outputs. It is equivalent to a
function definition in most programming languages. From a list of
input :ref:`Results <result>` and an Op, you can build an :ref:`apply`
node representing the application of the Op to the inputs.
It is important to understand the distinction between an Op (the
definition of a function) and an Apply node (the application of a
function). If you were to interpret the Python language using Theano's
structures, code going like ``def f(x): ...`` would produce an Op for
``f`` whereas code like ``a = f(x)`` or ``g(f(4), 5)`` would produce an
Apply node involving the ``f`` Op.
...
@@ -289,5 +305,37 @@ WRITEME
...
@@ -289,5 +305,37 @@ WRITEME
Type
Type
----
----
WRITEME
A :ref:`type` in Theano represents a set of constraints on potential
data objects. These constraints allow Theano to tailor C code to handle
them and to statically optimize the computation graph. For instance,
the :ref:`irow <predefinedtypes>` type in the ``theano.tensor`` package
gives the following constraints on the data the Results of type ``irow``
may contain:
#. Must be an instance of ``numpy.ndarray``: ``isinstance(x, numpy.ndarray)``
#. Must be an array of 32-bit integers: ``str(x.dtype) == 'int32'``
#. Must have a shape of 1xN: ``len(x.shape) == 2 and x.shape[0] == 1``
Knowing these restrictions, Theano may generate C code for addition, etc.
that declares the right data types and that contains the right number
of loops over the dimensions.
Note that a Theano :ref:`type` is not equivalent to a Python type or
class. Indeed, in Theano, :ref:`irow <predefinedtypes>` and :ref:`dmatrix
<predefinedtypes>` both use ``numpy.ndarray`` as the underlying type
for doing computations and storing data, yet they are different Theano
Types. Indeed, the constraints set by ``dmatrix`` are:
#. Must be an instance of ``numpy.ndarray``: ``isinstance(x, numpy.ndarray)``
#. Must be an array of 64-bit floating point numbers: ``str(x.dtype) == 'float64'``
#. Must have a shape of MxN, no restriction on M or N: ``len(x.shape) == 2``
These restrictions are different from those of ``irow`` which are listed above.
There are cases in which a Type can fully correspond to a Python type,
such as the ``double`` Type we will define here which corresponds to
Python's ``float``. But, it's good to know that this is not necessarily
the case. Unless specified otherwise, when we say "Type" we mean a
Theano Type.
doc/advanced_tutorial/theano_vs_python.txt
浏览文件 @
99647a3b
...
@@ -12,7 +12,7 @@ analogue in Python:
...
@@ -12,7 +12,7 @@ analogue in Python:
Theano Python
Theano Python
=============== ===========================================================
=============== ===========================================================
Apply function application / function call
Apply function application / function call
Result function data
Result function data
/ variable
Op operations carried out in computation / function definition
Op operations carried out in computation / function definition
Type data types
Type data types
Module ??? class?
Module ??? class?
...
...
doc/basic_tutorial/function.txt
0 → 100644
浏览文件 @
99647a3b
差异被折叠。
点击展开。
doc/basic_tutorial/index.txt
浏览文件 @
99647a3b
...
@@ -30,6 +30,7 @@ Now we're ready for the tour:
...
@@ -30,6 +30,7 @@ Now we're ready for the tour:
adding
adding
examples
examples
function
module
module
module_vs_op
module_vs_op
randomstreams
randomstreams
...
...
doc/sandbox/numpy.txt
0 → 100644
浏览文件 @
99647a3b
.. _numpy::
===============
NumPy refresher
===============
Give summary of type(x) vs x.type vs x.dtype
theano/compile/function_module.py
浏览文件 @
99647a3b
...
@@ -110,8 +110,20 @@ class Function(object):
...
@@ -110,8 +110,20 @@ class Function(object):
outputs, performs the packing and unpacking of inputs and return values. It implements the
outputs, performs the packing and unpacking of inputs and return values. It implements the
square-bracket indexing so that you can look up the value of a symbolic node.
square-bracket indexing so that you can look up the value of a symbolic node.
Functions are copyable via {{{fn.copy()}}} and {{{copy.copy(fn)}}}.
When a function is copied, this instance is duplicated. Contrast with self.maker
When a function is copied, this instance is duplicated. Contrast with self.maker
(instance of `FunctionMaker`) that is shared between copies.
(instance of `FunctionMaker`) that is shared between copies.
The meaning of copying a function is that the containers and their current values will all be duplicated.
This requires that mutable inputs be copied, whereas immutable inputs may be shared between copies.
A Function instance is hashable, on the basis of its memory address (its id).
A Function instance is only equal to itself.
A Function instance may be serialized using the `pickle` or `cPickle` modules.
This will save all default inputs, the graph, and *** to the pickle file (WRITEME).
"""
"""
...
...
theano/compile/io.py
浏览文件 @
99647a3b
"""Define `SymbolicInput`, `SymbolicOutput`, `In`, `Out` """
__docformat__
=
'restructuredtext en'
class
SymbolicInput
(
object
):
class
SymbolicInput
(
object
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论