Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
21b6b3b1
提交
21b6b3b1
authored
7月 09, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix optimization crash with more tests of the GPU.
上级
0bc13e93
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
14 行删除
+19
-14
opt.py
theano/sandbox/gpuarray/opt.py
+3
-3
type.py
theano/sandbox/gpuarray/type.py
+2
-2
test_basic.py
theano/tensor/tests/test_basic.py
+14
-9
没有找到文件。
theano/sandbox/gpuarray/opt.py
浏览文件 @
21b6b3b1
...
...
@@ -407,7 +407,7 @@ def local_gpua_careduce(node):
for
idx
,
m
in
enumerate
(
new_mask
):
if
m
==
1
:
new_axis
.
append
(
idx
)
new_
greduce
=
GpuCAReduceCuda
(
greduce
=
GpuCAReduceCuda
(
node
.
op
.
scalar_op
,
axis
=
new_axis
,
reduce_mask
=
new_mask
,
dtype
=
getattr
(
node
.
op
,
'dtype'
,
None
),
...
...
@@ -419,9 +419,9 @@ def local_gpua_careduce(node):
# We need to have the make node called, otherwise the mask can
# be None
reshaped_gpu_inputs
=
[
gpu_reshaped_x
]
if
new_
greduce
.
supports_c_code
(
reshaped_gpu_inputs
):
if
greduce
.
supports_c_code
(
reshaped_gpu_inputs
):
reduce_reshaped_x
=
host_from_gpu
(
new_
greduce
(
gpu_reshaped_x
))
greduce
(
gpu_reshaped_x
))
if
reduce_reshaped_x
.
ndim
!=
node
.
outputs
[
0
]
.
ndim
:
unreshaped_reduce
=
reduce_reshaped_x
.
reshape
(
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
21b6b3b1
...
...
@@ -341,11 +341,11 @@ theano.compile.register_deep_copy_op_c_code(GpuArrayType, """
theano
.
compile
.
register_rebroadcast_c_code
(
GpuArrayType
,
"""
if(
PyGpuArray_DIMS(
%(iname)
s)
[
%(axis)
s] != 1){
if(
%(iname)
s->ga.dimensions
[
%(axis)
s] != 1){
PyErr_Format(PyExc_ValueError,
"Dimension
%(axis)
s in Rebroadcast's input was"
" supposed to be 1 (got
%%
d instead)",
PyGpuArray_DIMS(
%(iname)
s)
[
%(axis)
s]);
%(iname)
s->ga.dimensions
[
%(axis)
s]);
%(fail)
s
}
"""
,
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
21b6b3b1
...
...
@@ -3246,7 +3246,7 @@ class T_Join_and_Split(unittest.TestCase):
# assert tensor.grad(join(1,a,b), a
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
1
,
a
,
b
),
[
av
,
bv
],
eps
=
1.0e-4
,
rel_tol
=
1.0e-3
)
eps
=
1.0e-4
,
rel_tol
=
1.0e-3
,
mode
=
self
.
mode
)
def
test_join_matrix1_using_vertical_stack
(
self
):
a
=
self
.
shared
(
numpy
.
array
([[
1
,
2
,
3
],
[
4
,
5
,
6
]],
dtype
=
self
.
floatX
))
...
...
@@ -3272,7 +3272,7 @@ class T_Join_and_Split(unittest.TestCase):
self
.
assertTrue
((
out
==
want
)
.
all
())
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
1
,
a
,
b
),
[
av
,
bv
],
eps
=
1.0e-4
,
rel_tol
=
1.0e-3
)
eps
=
1.0e-4
,
rel_tol
=
1.0e-3
,
mode
=
self
.
mode
)
def
test_join_matrixV
(
self
):
"""variable join axis"""
...
...
@@ -3294,8 +3294,8 @@ class T_Join_and_Split(unittest.TestCase):
got
=
f
(
1
)
self
.
assertTrue
((
got
==
want
)
.
all
(),
(
got
,
want
))
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
0
,
a
,
b
),
[
v
,
2
*
v
])
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
1
,
a
,
b
),
[
v
,
2
*
v
])
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
0
,
a
,
b
),
[
v
,
2
*
v
]
,
mode
=
self
.
mode
)
utt
.
verify_grad
(
lambda
a
,
b
:
join
(
1
,
a
,
b
),
[
v
,
2
*
v
]
,
mode
=
self
.
mode
)
def
test_vector_len
(
self
):
x
=
lscalar
(
'x'
)
...
...
@@ -3344,7 +3344,8 @@ class T_Join_and_Split(unittest.TestCase):
assert
[
True
for
node
in
topo
if
isinstance
(
node
.
op
,
self
.
join_op
)]
f
()
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
1
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
)
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
1
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
,
mode
=
self
.
mode
)
# Should raise an error if dimension 0 does not match
a
.
set_value
(
rng
.
rand
(
2
,
4
,
1
)
.
astype
(
self
.
floatX
))
...
...
@@ -3370,7 +3371,8 @@ class T_Join_and_Split(unittest.TestCase):
assert
[
True
for
node
in
topo
if
isinstance
(
node
.
op
,
self
.
join_op
)]
f
()
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
0
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
)
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
0
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
,
mode
=
self
.
mode
)
# Should raise an error if b_val.shape[0] is not 1
# We can't set the value|
self
.
assertRaises
(
TypeError
,
b
.
set_value
,
...
...
@@ -3402,7 +3404,8 @@ class T_Join_and_Split(unittest.TestCase):
assert
[
True
for
node
in
topo
if
isinstance
(
node
.
op
,
self
.
join_op
)]
f
()
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
0
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
)
utt
.
verify_grad
((
lambda
a
,
b
:
join
(
0
,
a
,
b
)),
[
a_val
,
b_val
],
rng
=
rng
,
mode
=
self
.
mode
)
def
test_broadcastable_single_input_broadcastable_dimension
(
self
):
# Test that all broadcastable flags are preserved by a
...
...
@@ -3422,7 +3425,8 @@ class T_Join_and_Split(unittest.TestCase):
node
.
op
,
self
.
join_op
)]
f
()
utt
.
verify_grad
((
lambda
a
:
join
(
0
,
a
)),
[
a_val
],
rng
=
rng
)
utt
.
verify_grad
((
lambda
a
:
join
(
0
,
a
)),
[
a_val
],
rng
=
rng
,
mode
=
self
.
mode
)
# Should raise an error if length of dimension 0 is not 1
self
.
assertRaises
(
TypeError
,
a
.
set_value
,
rng
.
rand
(
2
,
4
,
1
)
.
astype
(
self
.
floatX
))
...
...
@@ -3458,7 +3462,8 @@ class T_Join_and_Split(unittest.TestCase):
e_val
=
rng
.
rand
(
1
,
1
,
1
,
1
,
2
,
1
)
.
astype
(
self
.
floatX
)
f
(
a_val
,
b_val
,
c_val
,
d_val
,
e_val
)
utt
.
verify_grad
((
lambda
a
,
b
,
c
,
d
,
e
:
join
(
0
,
a
,
b
,
c
,
d
,
e
)),
[
a_val
,
b_val
,
c_val
,
d_val
,
e_val
],
rng
=
rng
)
[
a_val
,
b_val
,
c_val
,
d_val
,
e_val
],
rng
=
rng
,
mode
=
self
.
mode
)
# Should raise an error if length of dimension 0 is not 1
bad_val
=
rng
.
rand
(
2
,
1
,
1
,
1
,
2
,
1
)
.
astype
(
self
.
floatX
)
self
.
assertRaises
(
TypeError
,
f
,
bad_val
,
b_val
,
c_val
,
d_val
,
e_val
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论