Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6264d52b
提交
6264d52b
authored
5月 08, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2888 from nouiz/tests
Update some GPU tests
上级
1838b8e2
fa37f260
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
16 行增加
和
13 行删除
+16
-13
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+1
-1
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+3
-1
scan_op.py
theano/scan_module/scan_op.py
+1
-1
test_elemwise.py
theano/tensor/tests/test_elemwise.py
+11
-10
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
6264d52b
...
@@ -3070,7 +3070,7 @@ class GpuJoin(tensor.Join, GpuOp):
...
@@ -3070,7 +3070,7 @@ class GpuJoin(tensor.Join, GpuOp):
axis
,
cndas
=
axis_and_tensors
[
0
],
axis_and_tensors
[
1
:]
axis
,
cndas
=
axis_and_tensors
[
0
],
axis_and_tensors
[
1
:]
# In case axis is numpy.int8 and has no __index__() method
# In case axis is numpy.int8 and has no __index__() method
axis
=
int
(
axis
)
axis
=
int
(
axis
)
ndim
=
tensor
s
[
0
]
.
ndim
ndim
=
cnda
s
[
0
]
.
ndim
if
axis
<
-
ndim
:
if
axis
<
-
ndim
:
raise
IndexError
(
"Join axis
%
d out of bounds [0,
%
d)"
%
raise
IndexError
(
"Join axis
%
d out of bounds [0,
%
d)"
%
(
axis
,
ndim
))
(
axis
,
ndim
))
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
6264d52b
...
@@ -304,7 +304,9 @@ def test_careduce():
...
@@ -304,7 +304,9 @@ def test_careduce():
def
test_flatten
():
def
test_flatten
():
x
=
cuda
.
fmatrix
(
'x'
)
x
=
cuda
.
fmatrix
(
'x'
)
f
=
theano
.
function
([
x
],
x
.
flatten
())
f
=
theano
.
function
([
x
],
x
.
flatten
(),
mode
=
mode_with_gpu
)
assert
any
([
node
for
node
in
f
.
maker
.
fgraph
.
toposort
()
if
isinstance
(
node
.
op
,
B
.
GpuFlatten
)])
assert
len
(
f
([[
0.
,
0.
],
[
0.
,
0.
]])
.
shape
)
==
1
assert
len
(
f
([[
0.
,
0.
],
[
0.
,
0.
]])
.
shape
)
==
1
...
...
theano/scan_module/scan_op.py
浏览文件 @
6264d52b
...
@@ -245,7 +245,7 @@ class Scan(PureOp):
...
@@ -245,7 +245,7 @@ class Scan(PureOp):
"that it shouldn't be the case"
)
"that it shouldn't be the case"
)
for
out
in
self
.
outputs
:
for
out
in
self
.
outputs
:
if
isinstance
(
inp
.
type
,
GpuArrayType
):
if
isinstance
(
out
.
type
,
GpuArrayType
):
raise
TypeError
(
"Inconsistency in the inner graph of "
raise
TypeError
(
"Inconsistency in the inner graph of "
"scan '
%
s' : one of the outputs to the "
"scan '
%
s' : one of the outputs to the "
"inner graph is of type GpuArrayType but "
"inner graph is of type GpuArrayType but "
...
...
theano/tensor/tests/test_elemwise.py
浏览文件 @
6264d52b
...
@@ -27,6 +27,7 @@ def FunctionGraph(i, o):
...
@@ -27,6 +27,7 @@ def FunctionGraph(i, o):
class
test_DimShuffle
(
unittest_tools
.
InferShapeTester
):
class
test_DimShuffle
(
unittest_tools
.
InferShapeTester
):
op
=
DimShuffle
op
=
DimShuffle
type
=
TensorType
type
=
TensorType
dtype
=
theano
.
config
.
floatX
def
with_linker
(
self
,
linker
):
def
with_linker
(
self
,
linker
):
for
xsh
,
shuffle
,
zsh
in
[((
2
,
3
),
(
1
,
'x'
,
0
),
(
3
,
1
,
2
)),
for
xsh
,
shuffle
,
zsh
in
[((
2
,
3
),
(
1
,
'x'
,
0
),
(
3
,
1
,
2
)),
...
@@ -40,25 +41,25 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
...
@@ -40,25 +41,25 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
((
1
,
1
,
1
),
(),
()),
((
1
,
1
,
1
),
(),
()),
((
1
,),
(
'x'
,
'x'
),
(
1
,
1
))]:
((
1
,),
(
'x'
,
'x'
),
(
1
,
1
))]:
ib
=
[(
entry
==
1
)
for
entry
in
xsh
]
ib
=
[(
entry
==
1
)
for
entry
in
xsh
]
x
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
x
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
e
=
self
.
op
(
ib
,
shuffle
)(
x
)
e
=
self
.
op
(
ib
,
shuffle
)(
x
)
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
[
e
]))
.
make_function
()
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
[
e
]))
.
make_function
()
assert
f
(
numpy
.
ones
(
xsh
))
.
shape
==
zsh
assert
f
(
numpy
.
ones
(
xsh
,
dtype
=
self
.
dtype
))
.
shape
==
zsh
# test that DimShuffle.infer_shape work correctly
# test that DimShuffle.infer_shape work correctly
x
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
x
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
e
=
self
.
op
(
ib
,
shuffle
)(
x
)
e
=
self
.
op
(
ib
,
shuffle
)(
x
)
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
[
e
.
shape
]))
.
make_function
()
[
e
.
shape
]))
.
make_function
()
assert
all
(
f
(
numpy
.
ones
(
xsh
)))
==
all
(
zsh
)
assert
all
(
f
(
numpy
.
ones
(
xsh
,
dtype
=
self
.
dtype
)))
==
all
(
zsh
)
# Test when we drop a axis that is not broadcastable
# Test when we drop a axis that is not broadcastable
ib
=
[
False
,
True
,
False
]
ib
=
[
False
,
True
,
False
]
x
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
x
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
self
.
assertRaises
(
ValueError
,
self
.
op
,
ib
,
shuffle
)
self
.
assertRaises
(
ValueError
,
self
.
op
,
ib
,
shuffle
)
# Test when we drop a axis that don't have shape 1
# Test when we drop a axis that don't have shape 1
ib
=
[
True
,
True
,
False
]
ib
=
[
True
,
True
,
False
]
x
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
x
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
e
=
self
.
op
(
ib
,
(
1
,
2
))(
x
)
e
=
self
.
op
(
ib
,
(
1
,
2
))(
x
)
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
[
e
.
shape
]))
.
make_function
()
f
=
copy
(
linker
)
.
accept
(
FunctionGraph
([
x
],
[
e
.
shape
]))
.
make_function
()
self
.
assertRaises
(
TypeError
,
f
,
numpy
.
ones
((
2
,
1
,
4
)))
self
.
assertRaises
(
TypeError
,
f
,
numpy
.
ones
((
2
,
1
,
4
)))
...
@@ -66,7 +67,7 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
...
@@ -66,7 +67,7 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
# Test that we can't take a dimensions multiple time
# Test that we can't take a dimensions multiple time
xsh
,
shuffle
,
zsh
=
((
1
,
1
,
4
),
(
0
,
1
,
2
,
0
),
(
1
,
4
))
xsh
,
shuffle
,
zsh
=
((
1
,
1
,
4
),
(
0
,
1
,
2
,
0
),
(
1
,
4
))
ib
=
[
False
,
True
,
False
]
ib
=
[
False
,
True
,
False
]
x
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
x
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
self
.
assertRaises
(
ValueError
,
DimShuffle
,
ib
,
shuffle
)
self
.
assertRaises
(
ValueError
,
DimShuffle
,
ib
,
shuffle
)
def
test_perform
(
self
):
def
test_perform
(
self
):
...
@@ -89,15 +90,15 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
...
@@ -89,15 +90,15 @@ class test_DimShuffle(unittest_tools.InferShapeTester):
((
1
,
1
,
1
),
()),
((
1
,
1
,
1
),
()),
((
1
,),
(
'x'
,
'x'
))]:
((
1
,),
(
'x'
,
'x'
))]:
ib
=
[(
entry
==
1
)
for
entry
in
xsh
]
ib
=
[(
entry
==
1
)
for
entry
in
xsh
]
adtens
=
self
.
type
(
'float64'
,
ib
)(
'x'
)
adtens
=
self
.
type
(
self
.
dtype
,
ib
)(
'x'
)
adtens_val
=
numpy
.
ones
(
xsh
)
adtens_val
=
numpy
.
ones
(
xsh
,
dtype
=
self
.
dtype
)
self
.
_compile_and_check
([
adtens
],
self
.
_compile_and_check
([
adtens
],
[
self
.
op
(
ib
,
shuffle
)(
adtens
)],
[
self
.
op
(
ib
,
shuffle
)(
adtens
)],
[
adtens_val
],
self
.
op
,
[
adtens_val
],
self
.
op
,
warn
=
False
)
warn
=
False
)
def
test_too_big_rank
(
self
):
def
test_too_big_rank
(
self
):
x
=
self
.
type
(
'float64'
,
broadcastable
=
())()
x
=
self
.
type
(
self
.
dtype
,
broadcastable
=
())()
y
=
x
.
dimshuffle
((
'x'
,)
*
(
numpy
.
MAXDIMS
+
1
))
y
=
x
.
dimshuffle
((
'x'
,)
*
(
numpy
.
MAXDIMS
+
1
))
self
.
assertRaises
(
ValueError
,
y
.
eval
,
{
x
:
0
})
self
.
assertRaises
(
ValueError
,
y
.
eval
,
{
x
:
0
})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论