Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ba408e6b
提交
ba408e6b
authored
4月 02, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix failing tests due to change in join/subtensor or inconsistency between version.
上级
d304bb64
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
25 行删除
+38
-25
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+2
-7
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+1
-0
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+20
-8
test_basic.py
theano/tensor/tests/test_basic.py
+15
-10
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
ba408e6b
...
@@ -3043,13 +3043,8 @@ class GpuJoin(tensor.Join, GpuOp):
...
@@ -3043,13 +3043,8 @@ class GpuJoin(tensor.Join, GpuOp):
axis
,
tensors
=
axis_and_tensors
[
0
],
axis_and_tensors
[
1
:]
axis
,
tensors
=
axis_and_tensors
[
0
],
axis_and_tensors
[
1
:]
if
not
tensors
:
if
not
tensors
:
raise
ValueError
(
'Cannot join an empty list of tensors'
)
raise
ValueError
(
'Cannot join an empty list of tensors'
)
are_instances
=
[
isinstance
(
x
.
type
,
CudaNdarrayType
)
\
as_tensor_variable_args
=
[
as_cuda_ndarray_variable
(
x
)
for
x
in
tensors
]
for
x
in
tensors
]
assert
numpy
.
all
(
are_instances
)
# no conversion needed, we just checked everything was
# a CNDA var
as_tensor_variable_args
=
tensors
output_maker
=
\
output_maker
=
\
lambda
bcast
:
CudaNdarrayType
(
broadcastable
=
bcast
)()
lambda
bcast
:
CudaNdarrayType
(
broadcastable
=
bcast
)()
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
ba408e6b
...
@@ -1000,6 +1000,7 @@ class T_subtensor(theano.tensor.tests.test_subtensor.T_subtensor):
...
@@ -1000,6 +1000,7 @@ class T_subtensor(theano.tensor.tests.test_subtensor.T_subtensor):
adv_incsub1
=
cuda
.
GpuAdvancedIncSubtensor1
adv_incsub1
=
cuda
.
GpuAdvancedIncSubtensor1
mode
=
mode_with_gpu
mode
=
mode_with_gpu
dtype
=
'float32'
dtype
=
'float32'
type
=
tcn
.
CudaNdarrayType
ignore_topo
=
(
B
.
HostFromGpu
,
B
.
GpuFromHost
,
theano
.
compile
.
DeepCopyOp
)
ignore_topo
=
(
B
.
HostFromGpu
,
B
.
GpuFromHost
,
theano
.
compile
.
DeepCopyOp
)
fast_compile
=
False
fast_compile
=
False
ops
=
(
cuda
.
GpuSubtensor
,
cuda
.
GpuIncSubtensor
,
ops
=
(
cuda
.
GpuSubtensor
,
cuda
.
GpuIncSubtensor
,
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
ba408e6b
...
@@ -368,13 +368,19 @@ class GpuAdvancedIncSubtensor1(HideC, tensor.AdvancedIncSubtensor1):
...
@@ -368,13 +368,19 @@ class GpuAdvancedIncSubtensor1(HideC, tensor.AdvancedIncSubtensor1):
if
ilist_
.
type
.
dtype
[:
3
]
not
in
(
'int'
,
'uin'
):
if
ilist_
.
type
.
dtype
[:
3
]
not
in
(
'int'
,
'uin'
):
raise
TypeError
(
'index must be integers'
)
raise
TypeError
(
'index must be integers'
)
if
ilist_
.
type
.
broadcastable
!=
(
False
,)
:
if
ilist_
.
type
.
ndim
!=
1
:
raise
TypeError
(
'index must be vector'
)
raise
TypeError
(
'index must be vector'
)
if
x_
.
type
.
ndim
==
0
:
if
x_
.
type
.
ndim
==
0
:
raise
TypeError
(
'cannot index into a scalar'
)
raise
TypeError
(
'cannot index into a scalar'
)
if
x_
.
type
.
broadcastable
[
0
]:
if
y_
.
type
.
ndim
>
x_
.
type
.
ndim
:
# the caller should have made a copy of x len(ilist) times
if
self
.
set_instead_of_inc
:
raise
TypeError
(
'cannot index into a broadcastable dimension'
)
opname
=
'set'
else
:
opname
=
'increment'
raise
TypeError
(
'cannot
%
s x subtensor with ndim=
%
s'
' by y with ndim=
%
s to x subtensor with ndim=
%
s '
%
(
opname
,
x_
.
type
.
ndim
,
y_
.
type
.
ndim
))
return
gof
.
Apply
(
self
,
[
x_
,
y_
,
ilist_
],
[
x_
.
type
()])
return
gof
.
Apply
(
self
,
[
x_
,
y_
,
ilist_
],
[
x_
.
type
()])
...
@@ -459,13 +465,19 @@ class GpuAdvancedIncSubtensor1_dev20(GpuAdvancedIncSubtensor1):
...
@@ -459,13 +465,19 @@ class GpuAdvancedIncSubtensor1_dev20(GpuAdvancedIncSubtensor1):
if
ilist_
.
type
.
dtype
[:
3
]
not
in
(
'int'
,
'uin'
):
if
ilist_
.
type
.
dtype
[:
3
]
not
in
(
'int'
,
'uin'
):
raise
TypeError
(
'index must be integers'
)
raise
TypeError
(
'index must be integers'
)
if
ilist_
.
type
.
broadcastable
!=
(
False
,)
:
if
ilist_
.
type
.
ndim
!=
1
:
raise
TypeError
(
'index must be vector'
)
raise
TypeError
(
'index must be vector'
)
if
x_
.
type
.
ndim
==
0
:
if
x_
.
type
.
ndim
==
0
:
raise
TypeError
(
'cannot index into a scalar'
)
raise
TypeError
(
'cannot index into a scalar'
)
if
x_
.
type
.
broadcastable
[
0
]:
if
y_
.
type
.
ndim
>
x_
.
type
.
ndim
:
# the caller should have made a copy of x len(ilist) times
if
self
.
set_instead_of_inc
:
raise
TypeError
(
'cannot index into a broadcastable dimension'
)
opname
=
'set'
else
:
opname
=
'increment'
raise
TypeError
(
'cannot
%
s x subtensor with ndim=
%
s'
' by y with ndim=
%
s to x subtensor with ndim=
%
s '
%
(
opname
,
x_
.
type
.
ndim
,
y_
.
type
.
ndim
))
return
gof
.
Apply
(
self
,
[
x_
,
y_
,
ilist_
],
[
x_
.
type
()])
return
gof
.
Apply
(
self
,
[
x_
,
y_
,
ilist_
],
[
x_
.
type
()])
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
ba408e6b
...
@@ -3713,20 +3713,20 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3713,20 +3713,20 @@ class T_Join_and_Split(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
f
,
a_val
,
b_val
,
c_val
,
d_val
,
bad_e_val
)
self
.
assertRaises
(
ValueError
,
f
,
a_val
,
b_val
,
c_val
,
d_val
,
bad_e_val
)
def
test_infer_shape_join
(
self
):
def
test_infer_shape_join
(
self
):
x1
=
matrix
()
x2
=
matrix
()
x3
=
matrix
()
def
get_mat
(
s1
,
s2
):
def
get_mat
(
s1
,
s2
):
return
numpy
.
asarray
(
numpy
.
random
.
uniform
(
size
=
(
s1
,
s2
)),
return
numpy
.
asarray
(
numpy
.
random
.
uniform
(
size
=
(
s1
,
s2
)),
dtype
=
self
.
floatX
)
dtype
=
self
.
floatX
)
x1
=
self
.
shared
(
get_mat
(
3
,
4
))
x2
=
self
.
shared
(
get_mat
(
2
,
4
))
x3
=
self
.
shared
(
get_mat
(
1
,
4
))
# Test dim 0
# Test dim 0
z
=
self
.
join_op
(
0
,
x1
,
x2
,
x3
)
z
=
self
.
join_op
(
0
,
x1
,
x2
,
x3
)
f
=
theano
.
function
([
x1
,
x2
,
x3
],
z
.
shape
,
mode
=
self
.
mode
)
f
=
theano
.
function
([],
z
.
shape
,
mode
=
self
.
mode
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
out
=
f
(
get_mat
(
3
,
4
),
get_mat
(
2
,
4
),
get_mat
(
1
,
4
)
)
out
=
f
()
assert
(
out
==
[
6
,
4
])
.
all
()
assert
(
out
==
[
6
,
4
])
.
all
()
if
theano
.
config
.
mode
!=
'FAST_COMPILE'
:
if
theano
.
config
.
mode
!=
'FAST_COMPILE'
:
...
@@ -3735,10 +3735,12 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3735,10 +3735,12 @@ class T_Join_and_Split(unittest.TestCase):
# Test dim 1
# Test dim 1
z
=
self
.
join_op
(
1
,
x1
,
x2
,
x3
)
z
=
self
.
join_op
(
1
,
x1
,
x2
,
x3
)
f
=
theano
.
function
([
x1
,
x2
,
x3
],
z
.
shape
,
mode
=
self
.
mode
)
f
=
theano
.
function
([],
z
.
shape
,
mode
=
self
.
mode
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
x1
.
set_value
(
get_mat
(
3
,
4
))
out
=
f
(
get_mat
(
3
,
4
),
get_mat
(
3
,
4
),
get_mat
(
3
,
5
))
x2
.
set_value
(
get_mat
(
3
,
4
))
x3
.
set_value
(
get_mat
(
3
,
5
))
out
=
f
()
assert
(
out
==
[
3
,
13
])
.
all
()
assert
(
out
==
[
3
,
13
])
.
all
()
if
theano
.
config
.
mode
!=
'FAST_COMPILE'
:
if
theano
.
config
.
mode
!=
'FAST_COMPILE'
:
...
@@ -3750,7 +3752,10 @@ class T_Join_and_Split(unittest.TestCase):
...
@@ -3750,7 +3752,10 @@ class T_Join_and_Split(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
f
,
get_mat
(
3
,
4
),
get_mat
(
3
,
4
),
self
.
assertRaises
(
ValueError
,
f
,
get_mat
(
3
,
4
),
get_mat
(
3
,
4
),
get_mat
(
2
,
5
))
get_mat
(
2
,
5
))
else
:
else
:
f
(
get_mat
(
3
,
4
),
get_mat
(
3
,
4
),
get_mat
(
2
,
5
))
x1
.
set_value
(
get_mat
(
3
,
4
))
x2
.
set_value
(
get_mat
(
3
,
4
))
x3
.
set_value
(
get_mat
(
2
,
5
))
f
()
def
test_rebroadcast
(
self
):
def
test_rebroadcast
(
self
):
# Regression test for a crash that used to happen when rebroadcasting.
# Regression test for a crash that used to happen when rebroadcasting.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论