Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
201e95a7
提交
201e95a7
authored
12月 01, 2011
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #249 from pascanur/infershape_cond_scan
Infershape cond scan
上级
a2480e41
c9d31714
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
2 行删除
+16
-2
scan_op.py
theano/scan_module/scan_op.py
+5
-0
test_scan.py
theano/scan_module/tests/test_scan.py
+11
-2
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
201e95a7
...
@@ -979,6 +979,11 @@ class Scan(PureOp):
...
@@ -979,6 +979,11 @@ class Scan(PureOp):
scan_outs
+=
[
x
for
x
in
scan_outs
+=
[
x
for
x
in
input_shapes
[
offset
:
offset
+
self
.
n_shared_outs
]]
input_shapes
[
offset
:
offset
+
self
.
n_shared_outs
]]
# if we are dealing with a repeat-until, then we do not know the
# leading dimension so we replace it for every entry with Shape_i
if
self
.
as_while
:
scan_outs
=
[(
Shape_i
(
0
)(
o
),)
+
x
[
1
:]
for
o
,
x
in
zip
(
node
.
outputs
,
scan_outs
)]
return
scan_outs
return
scan_outs
### GRAD FUNCTION
### GRAD FUNCTION
...
...
theano/scan_module/tests/test_scan.py
浏览文件 @
201e95a7
...
@@ -2495,8 +2495,6 @@ class T_Scan(unittest.TestCase):
...
@@ -2495,8 +2495,6 @@ class T_Scan(unittest.TestCase):
# so if it compiles it means the test pass
# so if it compiles it means the test pass
f
=
theano
.
function
([
V
,
W
],
O
)
f
=
theano
.
function
([
V
,
W
],
O
)
def
test_while2
(
self
):
def
test_while2
(
self
):
x
=
tensor
.
vector
(
'x'
)
x
=
tensor
.
vector
(
'x'
)
def
lambda_fn
(
x_t
):
def
lambda_fn
(
x_t
):
...
@@ -2515,6 +2513,17 @@ class T_Scan(unittest.TestCase):
...
@@ -2515,6 +2513,17 @@ class T_Scan(unittest.TestCase):
if
isinstance
(
x
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
)]
if
isinstance
(
x
.
op
,
theano
.
scan_module
.
scan_op
.
Scan
)]
assert
len
(
lssc
)
==
1
assert
len
(
lssc
)
==
1
def
test_while_infershape
(
self
):
x
=
tensor
.
vector
(
'x'
)
def
lambda_fn
(
x_t
):
return
x_t
+
1
,
theano
.
scan_module
.
until
(
x_t
>
3
)
o
,
_
=
theano
.
scan
(
lambda_fn
,
x
)
f
=
theano
.
function
([
x
],
o
.
shape
[
0
],
mode
=
mode_with_opt
)
vx
=
numpy
.
zeros
((
50
,),
dtype
=
theano
.
config
.
floatX
)
vx
[
23
]
=
4
out
=
f
(
vx
)
assert
out
==
24
def
test_grad_multiple_seqs_different_nsteps
(
self
):
def
test_grad_multiple_seqs_different_nsteps
(
self
):
# Example provided Michael Forbes
# Example provided Michael Forbes
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论