Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3545ffdf
提交
3545ffdf
authored
4月 27, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #625 from nouiz/mixed
Mixed
上级
560ad497
e22eee61
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
37 行增加
和
12 行删除
+37
-12
python.txt
doc/tutorial/python.txt
+1
-1
check_blas.py
theano/misc/check_blas.py
+1
-0
test_pycuda_example.py
theano/misc/tests/test_pycuda_example.py
+3
-3
basic.py
theano/sparse/basic.py
+8
-0
test_basic.py
theano/sparse/tests/test_basic.py
+16
-4
test_basic.py
theano/tensor/tests/test_basic.py
+8
-4
没有找到文件。
doc/tutorial/python.txt
浏览文件 @
3545ffdf
...
@@ -8,5 +8,5 @@ Python tutorial
...
@@ -8,5 +8,5 @@ Python tutorial
In this documentation, we suppose that reader know python. Here is a small list of python tutorials/exercices if you know know it or need a refresher:
In this documentation, we suppose that reader know python. Here is a small list of python tutorials/exercices if you know know it or need a refresher:
* `Python Challenge <http://www.pythonchallenge.com/>`__
* `Python Challenge <http://www.pythonchallenge.com/>`__
* `Dive into Python <http://diveintopython.
org
/>`__
* `Dive into Python <http://diveintopython.
net
/>`__
* `Google Python Class <http://code.google.com/edu/languages/google-python-class/index.html>`__
* `Google Python Class <http://code.google.com/edu/languages/google-python-class/index.html>`__
theano/misc/check_blas.py
浏览文件 @
3545ffdf
...
@@ -190,6 +190,7 @@ if __name__ == "__main__":
...
@@ -190,6 +190,7 @@ if __name__ == "__main__":
GTX580/3.2 0.20s
GTX580/3.2 0.20s
GTX480/3.2 0.24s
GTX480/3.2 0.24s
GTX480/3.0 0.27s
GTX480/3.0 0.27s
M2070/4.1 0.27s
GTX470/3.2 0.29s
GTX470/3.2 0.29s
M2070/3.2 0.32s
M2070/3.2 0.32s
GTX470/3.0 0.34s
GTX470/3.0 0.34s
...
...
theano/misc/tests/test_pycuda_example.py
浏览文件 @
3545ffdf
...
@@ -61,9 +61,9 @@ def test_pycuda_elemwise_source_module():
...
@@ -61,9 +61,9 @@ def test_pycuda_elemwise_source_module():
val1
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
val1
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
val2
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
val2
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
assert
(
f
(
val1
,
val2
)
==
f2
(
val1
,
val2
))
.
all
(
)
assert
numpy
.
allclose
(
f
(
val1
,
val2
),
f2
(
val1
,
val2
)
)
assert
(
f
(
val1
,
val2
)
==
f3
(
val1
,
val2
))
.
all
(
)
assert
numpy
.
allclose
(
f
(
val1
,
val2
),
f3
(
val1
,
val2
)
)
assert
(
f
(
val1
,
val2
)
==
f4
(
val1
,
val2
))
.
all
(
)
assert
numpy
.
allclose
(
f
(
val1
,
val2
),
f4
(
val1
,
val2
)
)
#print f(val1,val2)
#print f(val1,val2)
#print f2(val1,val2)
#print f2(val1,val2)
...
...
theano/sparse/basic.py
浏览文件 @
3545ffdf
...
@@ -704,6 +704,14 @@ class CSM(gof.Op):
...
@@ -704,6 +704,14 @@ class CSM(gof.Op):
g_data
=
csm_grad
(
self
.
kmap
)(
data
,
csm_data
(
g_out
),
csm_indices
(
g_out
))
g_data
=
csm_grad
(
self
.
kmap
)(
data
,
csm_data
(
g_out
),
csm_indices
(
g_out
))
return
[
g_data
,
None
,
None
,
None
]
return
[
g_data
,
None
,
None
,
None
]
def
infer_shape
(
self
,
node
,
shapes
):
if
self
.
kmap
is
None
:
# node.inputs[3] is of lenght as we only support sparse matrix.
return
[(
node
.
inputs
[
3
][
0
],
node
.
inputs
[
3
][
1
])]
else
:
return
node
.
env
.
shape_feature
.
default_infer_shape
(
node
,
shapes
)
CSC
=
CSM
(
'csc'
)
CSC
=
CSM
(
'csc'
)
CSR
=
CSM
(
'csr'
)
CSR
=
CSM
(
'csr'
)
...
...
theano/sparse/tests/test_basic.py
浏览文件 @
3545ffdf
...
@@ -153,6 +153,22 @@ class SparseInferShapeTester(utt.InferShapeTester):
...
@@ -153,6 +153,22 @@ class SparseInferShapeTester(utt.InferShapeTester):
config
.
floatX
,
3
))],
config
.
floatX
,
3
))],
GetItemScalar
)
GetItemScalar
)
def
test_csm
(
self
):
for
sparsetype
in
(
'csr'
,
'csc'
):
x
=
tensor
.
vector
()
y
=
tensor
.
ivector
()
z
=
tensor
.
ivector
()
s
=
tensor
.
ivector
()
call
=
getattr
(
sp
,
sparsetype
+
'_matrix'
)
spm
=
call
(
random_lil
((
300
,
400
),
config
.
floatX
,
5
))
out
=
CSM
(
sparsetype
)(
x
,
y
,
z
,
s
)
self
.
_compile_and_check
([
x
,
y
,
z
,
s
],
[
out
],
[
spm
.
data
,
spm
.
indices
,
spm
.
indptr
,
spm
.
shape
],
CSM
)
def
test_csm_grad
(
self
):
def
test_csm_grad
(
self
):
for
sparsetype
in
(
'csr'
,
'csc'
):
for
sparsetype
in
(
'csr'
,
'csc'
):
x
=
tensor
.
vector
()
x
=
tensor
.
vector
()
...
@@ -262,10 +278,6 @@ class SparseInferShapeTester(utt.InferShapeTester):
...
@@ -262,10 +278,6 @@ class SparseInferShapeTester(utt.InferShapeTester):
config
.
floatX
,
3
))],
config
.
floatX
,
3
))],
StructuredDot
)
StructuredDot
)
def
test_csm
(
self
):
# We also need the grad of CSM to be implemetned.
raise
SkipTest
(
'infer_shape not implemented for CSM'
)
def
test_structured_dot_grad
(
self
):
def
test_structured_dot_grad
(
self
):
# We also need the grad of CSM to be implemetned.
# We also need the grad of CSM to be implemetned.
raise
SkipTest
(
'infer_shape not implemented for the grad'
raise
SkipTest
(
'infer_shape not implemented for the grad'
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
3545ffdf
...
@@ -2441,10 +2441,14 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -2441,10 +2441,14 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
n
=
self
.
shared
(
numpy
.
asarray
(
5
,
dtype
=
self
.
dtype
))
n
=
self
.
shared
(
numpy
.
asarray
(
5
,
dtype
=
self
.
dtype
))
self
.
assertRaises
(
TypeError
,
n
.
__getitem__
,
[
0
,
0
])
self
.
assertRaises
(
TypeError
,
n
.
__getitem__
,
[
0
,
0
])
def
test_err_invalid_2list
(
self
):
def
test_err_invalid_not_2d
(
self
):
# TODO the error message is not clear
n
=
self
.
shared
(
numpy
.
ones
((
3
,
3
,
3
),
dtype
=
self
.
dtype
)
*
5
)
n
=
self
.
shared
(
numpy
.
ones
((
3
,
3
),
dtype
=
self
.
dtype
)
*
5
)
self
.
assertRaises
(
NotImplementedError
,
n
.
__getitem__
,
self
.
assertRaises
(
TypeError
,
n
.
__getitem__
,
([
0
,
0
],[
1
,
1
]))
([
0
,
0
,
0
],
[
1
,
1
,
1
],
[
2
,
2
,
2
]))
def
test_err_invalid_2list_dtype
(
self
):
n
=
self
.
shared
(
numpy
.
ones
((
3
,
3
),
dtype
=
self
.
dtype
)
*
5
)
self
.
assertRaises
(
TypeError
,
n
.
__getitem__
,
([
0.
,
0
],
[
1
,
1
]))
def
test_err_bound_list
(
self
):
def
test_err_bound_list
(
self
):
n
=
self
.
shared
(
numpy
.
ones
((
2
,
3
),
dtype
=
self
.
dtype
)
*
5
)
n
=
self
.
shared
(
numpy
.
ones
((
2
,
3
),
dtype
=
self
.
dtype
)
*
5
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论