Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
50d34560
提交
50d34560
authored
3月 20, 2011
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
re-wrote the shape_i test optimization to cover more cases ( hopefully all
interesting ones ?) with the disadvantage of making it slow
上级
ad810a3f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
8 行删除
+21
-8
test_basic.py
theano/tensor/tests/test_basic.py
+21
-8
没有找到文件。
theano/tensor/tests/test_basic.py
浏览文件 @
50d34560
...
@@ -1690,15 +1690,28 @@ class T_subtensor(unittest.TestCase):
...
@@ -1690,15 +1690,28 @@ class T_subtensor(unittest.TestCase):
self
.
assertRaises
(
IndexError
,
f
)
self
.
assertRaises
(
IndexError
,
f
)
def
test_shape_i
(
self
):
def
test_shape_i
(
self
):
data
=
self
.
shared
(
numpy
.
zeros
((
50
,
50
,
50
,
50
),
dtype
=
'int32'
))
# Each axis is treated independently by shape_i/shape operators
for
slices
in
[
(
slice
(
2
,
10
,
2
),
slice
(
None
,
None
,
None
),
slice
(
None
,
None
,
-
1
)),
(
slice
(
-
5
,
10
,
1
),
slice
(
10
,
2
,
-
1
),
slice
(
4
,
None
,
None
)),
mode_opt
=
config
.
mode
(
slice
(
3
,
-
10
,
1
),
slice
(
10
,
15
,
8
))
]:
if
mode_opt
==
'FAST_COMPILE'
:
sliced_data
=
data
[
slices
]
mode_opt
=
'FAST_RUN'
f
=
function
([],
sliced_data
.
shape
)
mode_opt
=
compile
.
mode
.
get_mode
(
mode_opt
)
assert
numpy
.
all
(
f
()
==
data
.
get_value
()[
slices
]
.
shape
)
data
=
self
.
shared
(
numpy
.
zeros
((
5
,),
dtype
=
'int32'
))
for
start
in
[
None
]
+
[
-
8
,
-
5
,
-
4
,
-
1
,
0
,
1
,
4
,
5
,
8
]:
outs
=
[]
shapes
=
[]
for
stop
in
[
None
]
+
[
-
8
,
-
5
,
-
4
,
-
1
,
0
,
1
,
4
,
5
,
8
]:
for
step
in
[
None
]
+
[
-
3
,
-
1
,
2
]:
outs
+=
[
data
[
start
:
stop
:
step
]
.
shape
]
shapes
+=
[
data
.
get_value
()[
start
:
stop
:
step
]
.
shape
]
f
=
function
([],
outs
,
mode
=
mode_opt
)
t_shapes
=
f
()
for
t_shape
,
shape
in
zip
(
t_shapes
,
shapes
):
assert
numpy
.
all
(
t_shape
==
shape
)
assert
theano
.
tensor
.
Subtensor
not
in
[
x
.
op
for
x
in
assert
theano
.
tensor
.
Subtensor
not
in
[
x
.
op
for
x
in
f
.
maker
.
env
.
toposort
()
]
f
.
maker
.
env
.
toposort
()
]
def
grad_list_
(
self
,
idxs
,
data
):
def
grad_list_
(
self
,
idxs
,
data
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论