Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5f08407d
提交
5f08407d
authored
3月 15, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Whitespace
上级
f5ed1817
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
13 行增加
和
21 行删除
+13
-21
test_pfunc.py
theano/compile/tests/test_pfunc.py
+0
-1
test_shared.py
theano/compile/tests/test_shared.py
+4
-7
test_blas.py
theano/sandbox/cuda/tests/test_blas.py
+3
-6
mlp_test.py
theano/tensor/tests/mlp_test.py
+0
-0
test_scan.py
theano/tests/test_scan.py
+6
-7
没有找到文件。
theano/compile/tests/test_pfunc.py
浏览文件 @
5f08407d
...
...
@@ -945,4 +945,3 @@ class Test_aliasing_rules(unittest.TestCase):
if
__name__
==
'__main__'
:
theano
.
config
.
mode
=
'FAST_COMPILE'
Test_pfunc
()
.
test_default_scalar_container
()
theano/compile/tests/test_shared.py
浏览文件 @
5f08407d
...
...
@@ -42,7 +42,7 @@ class Test_SharedVariable(unittest.TestCase):
# generic can hold anything even when strict=True
u
=
shared
(
'asdf'
,
strict
=
False
)
v
=
shared
(
'asdf'
,
strict
=
True
)
v
=
shared
(
'asdf'
,
strict
=
True
)
u
.
set_value
(
88
)
v
.
set_value
(
88
)
...
...
@@ -102,7 +102,7 @@ class Test_SharedVariable(unittest.TestCase):
assert
numpy
.
all
(
u
.
get_value
()
==
[
3
,
4
])
# check that assignments of nonsense fail
try
:
try
:
u
.
set_value
(
'adsf'
)
assert
0
except
ValueError
:
...
...
@@ -124,7 +124,7 @@ class Test_SharedVariable(unittest.TestCase):
b
=
shared
(
numpy
.
int32
(
7
),
strict
=
True
)
assert
b
.
type
==
theano
.
tensor
.
iscalar
self
.
failUnlessRaises
(
TypeError
,
f
,
b
,
8.23
)
b
=
shared
(
numpy
.
int16
(
7
),
strict
=
True
)
assert
b
.
type
==
theano
.
tensor
.
wscalar
self
.
failUnlessRaises
(
TypeError
,
f
,
b
,
8.23
)
...
...
@@ -235,7 +235,7 @@ class Test_SharedVariable(unittest.TestCase):
assert
b
.
type
==
theano
.
tensor
.
dscalar
f
(
b
,
8
)
assert
b
.
get_value
()
==
8
b
=
shared
(
numpy
.
float32
(
7.234
),
allow_downcast
=
True
)
assert
b
.
type
==
theano
.
tensor
.
fscalar
f
(
b
,
8
)
...
...
@@ -307,6 +307,3 @@ class Test_SharedVariable(unittest.TestCase):
c
=
shared
(
numpy
.
zeros
((
5
,
5
),
dtype
=
'float32'
),
allow_downcast
=
True
)
self
.
failUnlessRaises
(
TypeError
,
f
,
b
,
numpy
.
random
.
rand
(
5
,
5
))
theano/sandbox/cuda/tests/test_blas.py
浏览文件 @
5f08407d
...
...
@@ -133,7 +133,7 @@ if 0:
dmatrix4
=
tensor
.
TensorType
(
"float32"
,
(
False
,
False
,
False
,
False
))
b
=
dmatrix4
()
f
=
pfunc
([
b
],
[
a
(
b
)],
mode
=
mode_with_gpu
)
bval
=
numpy
.
arange
(
0
,
d0
*
d1
)
.
reshape
(
1
,
1
,
d0
,
d1
)
r
=
f
(
bval
)[
0
]
# print bval, bval.shape, border
...
...
@@ -143,7 +143,7 @@ if 0:
def
test_downsample
():
import
random
shps
=
[
(
1
,
1
,
1
,
12
),
(
1
,
1
,
2
,
2
),
(
1
,
1
,
2
,
2
),
(
1
,
1
,
1
,
1
),
(
1
,
1
,
4
,
4
),
(
1
,
1
,
10
,
11
),
...
...
@@ -181,7 +181,7 @@ def test_downsample():
assert
any
([
isinstance
(
node
.
op
,
tcn
.
blas
.
GpuDownsampleFactorMax
)
for
node
in
f
.
maker
.
env
.
toposort
()])
assert
numpy
.
allclose
(
f
(),
f2
())
g
=
pfunc
([],
tensor
.
grad
(
ds_op
(
tensor
.
as_tensor_variable
(
a
))
.
sum
(),
a
),
mode
=
mode_with_gpu
)
g2
=
pfunc
([],
tensor
.
grad
(
ds_op
(
tensor
.
as_tensor_variable
(
a
))
.
sum
(),
a
),
mode
=
mode_without_gpu
)
assert
any
([
isinstance
(
node
.
op
,
tcn
.
blas
.
GpuDownsampleFactorMaxGrad
)
...
...
@@ -190,6 +190,3 @@ def test_downsample():
#We already check that the gpu version return the same value as the gpu version
#for GpuDownsampleFactorMaxGrad. So no need to call verify_grad here.
theano/tensor/tests/mlp_test.py
浏览文件 @
5f08407d
差异被折叠。
点击展开。
theano/tests/test_scan.py
浏览文件 @
5f08407d
...
...
@@ -61,7 +61,7 @@ class multiple_outputs_numeric_grad:
# something else ( a random state ? ) with which we shouldn't really
# mess up
if
not
ndarray_mask
:
ndarray_mask
=
[
True
for
x
in
pt
]
ndarray_mask
=
[
True
for
x
in
pt
]
dtype_eps
=
multiple_outputs_numeric_grad
.
type_eps
[
'float64'
]
...
...
@@ -70,7 +70,7 @@ class multiple_outputs_numeric_grad:
pt
[
i
]
=
numpy
.
array
(
p
)
_eps
=
multiple_outputs_numeric_grad
.
type_eps
[
str
(
pt
[
i
]
.
dtype
)]
if
_eps
>
dtype_eps
:
dtype_eps
=
_eps
dtype_eps
=
_eps
# Compute clean output:
...
...
@@ -1050,7 +1050,7 @@ class T_Scan(unittest.TestCase):
f1
=
theano
.
tensor
.
dscalar
(
'f1'
)
def
scanStep
(
prev
,
seq
,
f1
):
return
prev
+
f1
*
seq
return
prev
+
f1
*
seq
scanned
,
_
=
theano
.
scan
(
fn
=
scanStep
,
\
sequences
=
[
seq
],
\
...
...
@@ -1074,8 +1074,8 @@ class T_Scan(unittest.TestCase):
inpt
=
theano
.
tensor
.
matrix
(
'inpt'
)
def
one_step
(
x_t
,
h_tm1
,
W
):
expr
=
T
.
dot
(
h_tm1
,
W
)
+
x_t
return
expr
expr
=
T
.
dot
(
h_tm1
,
W
)
+
x_t
return
expr
expr
,
_
=
theano
.
scan
(
fn
=
one_step
,
...
...
@@ -1114,7 +1114,7 @@ class T_Scan(unittest.TestCase):
floatX
=
theano
.
config
.
floatX
def
one_step
(
h_tm1
):
return
h_tm1
+
numpy
.
asarray
(
1.
,
dtype
=
floatX
)
return
h_tm1
+
numpy
.
asarray
(
1.
,
dtype
=
floatX
)
h
,
_
=
theano
.
scan
(
fn
=
one_step
,
...
...
@@ -1131,4 +1131,3 @@ class T_Scan(unittest.TestCase):
if
__name__
==
'__main__'
:
unittest
.
main
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论