Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9b9602c6
提交
9b9602c6
authored
4月 03, 2009
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
6d792716
764e81b9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
58 行增加
和
36 行删除
+58
-36
NEWS.txt
doc/NEWS.txt
+1
-1
ctype.txt
doc/advanced_tutorial/ctype.txt
+1
-1
graphstructures.txt
doc/advanced_tutorial/graphstructures.txt
+1
-1
contents.txt
doc/contents.txt
+0
-1
install.txt
doc/install.txt
+1
-1
how_to_release.txt
doc/internal/how_to_release.txt
+7
-1
unittest.txt
doc/topics/unittest.txt
+6
-0
test_basic.py
theano/sparse/tests/test_basic.py
+6
-6
basic.py
theano/tensor/basic.py
+0
-1
test_basic.py
theano/tensor/tests/test_basic.py
+0
-0
test_nnet.py
theano/tensor/tests/test_nnet.py
+20
-20
test_xlogx.py
theano/tensor/tests/test_xlogx.py
+3
-3
unittest_tools.py
theano/tests/unittest_tools.py
+12
-0
没有找到文件。
doc/NEWS.txt
浏览文件 @
9b9602c6
...
...
@@ -8,7 +8,7 @@ Release Notes
Theano 0.1
==========
*Release date: 2009-04-0
1
*
*Release date: 2009-04-0
2
*
What works
----------
...
...
doc/advanced_tutorial/ctype.txt
浏览文件 @
9b9602c6
...
...
@@ -42,7 +42,7 @@ What needs to be defined
In order to be C-compatible, a Type must define several additional
methods, which all start with the ``c_`` prefix. The complete list can
be found in the documentation for :api:`gof.Type`. Here, we'll focus on
be found in the documentation for :api:`gof.
type.
Type`. Here, we'll focus on
the most important ones:
...
...
doc/advanced_tutorial/graphstructures.txt
浏览文件 @
9b9602c6
...
...
@@ -146,7 +146,7 @@ Automatic wrapping
All nodes in the graph must be instances of ``Apply`` or ``Result``, but
``<Op subclass>.make_node()`` typically wraps constants to satisfy those
constraints. For example, the :api:`tensor.add <theano.tensor.add>`
constraints. For example, the :api:`tensor.add <theano.tensor.
basic.
add>`
Op instance is written so that:
.. code-block:: python
...
...
doc/contents.txt
浏览文件 @
9b9602c6
...
...
@@ -8,7 +8,6 @@ Contents
.. toctree::
:maxdepth: 2
index
introduction
LICENSE
install
...
...
doc/install.txt
浏览文件 @
9b9602c6
...
...
@@ -125,7 +125,7 @@ Mac
- Install some kind of BLAS library (TODO: how?)
- Set ``THEANO_BLAS_LDFLAGS to something which will link against said BLAS
- Set ``THEANO_BLAS_LDFLAGS
``
to something which will link against said BLAS
library. E.g., ``THEANO_BLAS_LDFLAGS='-lcblas -latlas -lgfortran'``.
This advice has not been tested recently, so please inform us of your results.
...
...
doc/internal/how_to_release.txt
浏览文件 @
9b9602c6
...
...
@@ -23,6 +23,7 @@ Edit ``doc/index.txt`` to contain a link to what will be the download URL::
Tag the release. The syntax is something like the following::
hg tag Theano-0.X
hg push
Now, package the release and move it to the static theano directory::
...
...
@@ -30,7 +31,6 @@ Now, package the release and move it to the static theano directory::
cd ..
tar cvf Theano-0.X.tar Theano-0.X
gzip -9 Theano-0.X.tar
rm -Rf Theano-0.X
mv Theano-0.X.tar.gz www/theano_static/downloads/
~/repos/theano/.hg/refresh-epydoc.sh
...
...
@@ -42,7 +42,13 @@ directory::
Finally, use setuptools to register and upload the release::
cd Theano-0.X
python setup.py register sdist bdist_egg upload
# If you get an error message about needing to be identified, then store
# your pypi information in ~/.pypirc
# You can remove this file after upload.
cd ..
rm -Rf Theano-0.X
I wrote the above without actually running it. This needs to be
scrutinized when you are actually do a release.
...
...
doc/topics/unittest.txt
浏览文件 @
9b9602c6
...
...
@@ -393,6 +393,12 @@ Here is an example showing how to use verify_grad:
>>> # ...
>>> tensor.verify_grad(Flatten(), [a_val])
.. note::
Although ``verify_grad`` is defined in ``theano.tensor.basic``, unittests
should use the version of ``verify_grad`` defined in ``theano.tests.unittest_tools``.
This is simply a wrapper function which takes care of seeding the random
number generator appropriately before calling ``theano.tensor.basic.verify_grad``
makeTester and makeBroadcastTester
==================================
...
...
theano/sparse/tests/test_basic.py
浏览文件 @
9b9602c6
...
...
@@ -11,7 +11,7 @@ from theano import gof
from
theano.sparse.basic
import
_is_dense
,
_is_sparse
,
_is_dense_variable
,
_is_sparse_variable
from
theano.sparse.basic
import
_mtypes
,
_mtype_to_str
from
theano.tests
import
unittest_tools
from
theano.tests
import
unittest_tools
as
utt
def
eval_outputs
(
outputs
):
...
...
@@ -19,7 +19,7 @@ def eval_outputs(outputs):
class
T_transpose
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test_transpose_csc
(
self
):
sp
=
sparse
.
csc_matrix
(
sparse
.
eye
(
5
,
3
))
...
...
@@ -126,7 +126,7 @@ class T_Add(unittest.TestCase):
class
T_conversion
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
a
=
tensor
.
as_tensor_variable
(
numpy
.
random
.
rand
(
5
))
...
...
@@ -157,7 +157,7 @@ class T_conversion(unittest.TestCase):
import
scipy.sparse
as
sp
class
test_structureddot
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test_structuredot
(
self
):
bsize
=
2
...
...
@@ -193,7 +193,7 @@ class test_structureddot(unittest.TestCase):
assert
_is_dense
(
c
)
assert
numpy
.
all
(
outvals
==
c
)
tensor
.
verify_grad
(
buildgraphCSC
,
[
kernvals
,
imvals
])
utt
.
verify_grad
(
buildgraphCSC
,
[
kernvals
,
imvals
])
##
# Test compressed-sparse row matrices ###
...
...
@@ -215,7 +215,7 @@ class test_structureddot(unittest.TestCase):
assert
_is_dense
(
c
)
assert
numpy
.
all
(
outvals
==
c
)
tensor
.
verify_grad
(
buildgraphCSR
,
[
kernvals
,
imvals
])
utt
.
verify_grad
(
buildgraphCSR
,
[
kernvals
,
imvals
])
if
__name__
==
'__main__'
:
...
...
theano/tensor/basic.py
浏览文件 @
9b9602c6
...
...
@@ -20,7 +20,6 @@ from ..gof.python25 import partial
from
..
import
compile
,
printing
from
..printing
import
pprint
,
Print
from
..tests
import
unittest_tools
### set up the external interface
from
elemwise
import
Elemwise
,
DimShuffle
,
CAReduce
,
Sum
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
9b9602c6
差异被折叠。
点击展开。
theano/tensor/tests/test_nnet.py
浏览文件 @
9b9602c6
...
...
@@ -5,86 +5,86 @@ from theano import tensor as T
from
theano
import
gof
import
test_basic
as
TT
import
numpy
from
theano.tests
import
unittest_tools
from
theano.tests
import
unittest_tools
as
utt
from
theano.tensor.nnet
import
*
class
T_sigmoid
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test_elemwise
(
self
):
TT
.
verify_grad
(
sigmoid
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
sigmoid
,
[
numpy
.
random
.
rand
(
3
,
4
)])
class
T_softplus
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test_elemwise
(
self
):
TT
.
verify_grad
(
softplus
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
softplus
,
[
numpy
.
random
.
rand
(
3
,
4
)])
class
T_Softmax
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
def
f
(
a
):
return
softmax
(
a
)[:,
0
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
def
test1
(
self
):
def
f
(
a
):
return
softmax
(
a
)[:,
1
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
def
test2
(
self
):
def
f
(
a
):
return
softmax
(
a
)[:,
2
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
def
test3
(
self
):
def
f
(
a
):
return
softmax
(
a
)[:,
3
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
class
T_SoftmaxWithBias
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
def
f
(
a
,
b
):
return
softmax_with_bias
(
a
,
b
)[:,
0
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
numpy
.
random
.
rand
(
4
)])
def
test1
(
self
):
def
f
(
a
,
b
):
return
softmax_with_bias
(
a
,
b
)[:,
1
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
numpy
.
random
.
rand
(
4
)])
def
test2
(
self
):
def
f
(
a
,
b
):
return
softmax_with_bias
(
a
,
b
)[:,
2
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
numpy
.
random
.
rand
(
4
)])
def
test3
(
self
):
def
f
(
a
,
b
):
return
softmax_with_bias
(
a
,
b
)[:,
3
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
numpy
.
random
.
rand
(
4
)])
class
T_CrossentropySoftmax1Hot
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
y_idx
=
[
0
,
1
,
3
]
def
f
(
a
,
b
):
return
crossentropy_softmax_1hot_with_bias
(
a
,
b
,
y_idx
)[
0
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
),
numpy
.
random
.
rand
(
4
)])
def
test1
(
self
):
y_idx
=
[
0
,
1
,
3
]
def
f
(
a
):
return
crossentropy_softmax_1hot
(
a
,
y_idx
)[
0
]
TT
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
f
,
[
numpy
.
random
.
rand
(
3
,
4
)])
class
T_prepend
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
"""basic functionality"""
x
=
tensor
.
matrix
(
'x'
)
...
...
@@ -110,7 +110,7 @@ class T_prepend(unittest.TestCase):
class
T_solve
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
rng
=
numpy
.
random
.
RandomState
(
u
nittest_tools
.
fetch_seed
(
666
))
self
.
rng
=
numpy
.
random
.
RandomState
(
u
tt
.
fetch_seed
(
666
))
def
test0
(
self
):
A
=
self
.
rng
.
randn
(
5
,
5
)
...
...
theano/tensor/tests/test_xlogx.py
浏览文件 @
9b9602c6
...
...
@@ -8,11 +8,11 @@ import test_basic as TT
import
random
import
numpy.random
from
theano.tests
import
unittest_tools
from
theano.tests
import
unittest_tools
as
utt
class
T_XlogX
(
unittest
.
TestCase
):
def
setUp
(
self
):
u
nittest_tools
.
seed_rng
()
u
tt
.
seed_rng
()
def
test0
(
self
):
x
=
as_tensor_variable
([
1
,
0
])
...
...
@@ -23,7 +23,7 @@ class T_XlogX(unittest.TestCase):
# class Dummy(object):
# def make_node(self, a):
# return [xlogx(a)[:,2]]
TT
.
verify_grad
(
xlogx
,
[
numpy
.
random
.
rand
(
3
,
4
)])
utt
.
verify_grad
(
xlogx
,
[
numpy
.
random
.
rand
(
3
,
4
)])
if
__name__
==
'__main__'
:
...
...
theano/tests/unittest_tools.py
浏览文件 @
9b9602c6
import
unittest
import
numpy
import
theano.tensor
as
T
import
os
,
sys
...
...
@@ -40,3 +41,14 @@ def seed_rng(pseed=None):
'instead of seed
%
i given as parameter'
%
(
seed
,
pseed
)
numpy
.
random
.
seed
(
seed
)
return
seed
def
verify_grad
(
op
,
pt
,
n_tests
=
2
,
rng
=
None
,
eps
=
1.0e-7
,
tol
=
0.0001
):
"""
Wrapper for tensor/basic.py:verify_grad
Takes care of seeding the random number generator if None is given
"""
if
rng
is
None
:
seed_rng
()
rng
=
numpy
.
random
T
.
verify_grad
(
op
,
pt
,
n_tests
,
rng
,
eps
,
tol
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论