Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
15812503
提交
15812503
authored
1月 22, 2012
作者:
Razvan Pascanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PEP8 fixes
上级
1457461a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
62 行增加
和
62 行删除
+62
-62
scan_views.py
theano/scan_module/scan_views.py
+62
-62
没有找到文件。
theano/scan_module/scan_views.py
浏览文件 @
15812503
...
@@ -5,10 +5,10 @@ See scan.py for details on scan
...
@@ -5,10 +5,10 @@ See scan.py for details on scan
"""
"""
__docformat__
=
'restructedtext en'
__docformat__
=
'restructedtext en'
__authors__
=
(
"Razvan Pascanu "
__authors__
=
(
"Razvan Pascanu "
"Frederic Bastien "
"Frederic Bastien "
"James Bergstra "
"James Bergstra "
"Pascal Lamblin "
)
"Pascal Lamblin "
)
__copyright__
=
"(c) 2010, Universite de Montreal"
__copyright__
=
"(c) 2010, Universite de Montreal"
__contact__
=
"Razvan Pascanu <r.pascanu@gmail>"
__contact__
=
"Razvan Pascanu <r.pascanu@gmail>"
...
@@ -27,13 +27,13 @@ _logger = logging.getLogger('theano.scan_module.scan_views')
...
@@ -27,13 +27,13 @@ _logger = logging.getLogger('theano.scan_module.scan_views')
# The ``map`` view of Scan Op.
# The ``map`` view of Scan Op.
def
map
(
fn
def
map
(
fn
,
,
sequences
sequences
,
,
non_sequences
=
None
non_sequences
=
None
,
,
truncate_gradient
=
-
1
truncate_gradient
=-
1
,
,
go_backwards
=
False
go_backwards
=
False
,
,
mode
=
None
mode
=
None
,
,
name
=
None
):
name
=
None
):
"""
"""
Similar behaviour as python's map.
Similar behaviour as python's map.
...
@@ -58,24 +58,24 @@ def map( fn
...
@@ -58,24 +58,24 @@ def map( fn
:param name: See ``scan``.
:param name: See ``scan``.
"""
"""
return
scan
.
scan
(
fn
=
fn
return
scan
.
scan
(
fn
=
fn
,
,
sequences
=
sequences
sequences
=
sequences
,
,
outputs_info
=
[]
outputs_info
=
[],
,
non_sequences
=
non_sequences
non_sequences
=
non_sequences
,
,
truncate_gradient
=
truncate_gradient
truncate_gradient
=
truncate_gradient
,
,
go_backwards
=
go_backwards
go_backwards
=
go_backwards
,
,
mode
=
mode
mode
=
mode
,
,
name
=
name
)
name
=
name
)
# The ``reduce`` view of Scan Op.
# The ``reduce`` view of Scan Op.
def
reduce
(
fn
def
reduce
(
fn
,
,
sequences
sequences
,
,
outputs_info
outputs_info
,
,
non_sequences
=
None
non_sequences
=
None
,
,
go_backwards
=
False
go_backwards
=
False
,
,
mode
=
None
mode
=
None
,
,
name
=
None
):
name
=
None
):
"""
"""
Similar behaviour as python's reduce
Similar behaviour as python's reduce
...
@@ -101,27 +101,27 @@ def reduce( fn
...
@@ -101,27 +101,27 @@ def reduce( fn
:param name: See ``scan``.
:param name: See ``scan``.
"""
"""
rval
=
scan
.
scan
(
fn
=
fn
rval
=
scan
.
scan
(
fn
=
fn
,
,
sequences
=
sequences
sequences
=
sequences
,
,
outputs_info
=
outputs_info
outputs_info
=
outputs_info
,
,
non_sequences
=
non_sequences
non_sequences
=
non_sequences
,
,
go_backwards
=
go_backwards
go_backwards
=
go_backwards
,
,
truncate_gradient
=
-
1
truncate_gradient
=-
1
,
,
mode
=
mode
mode
=
mode
,
,
name
=
name
)
name
=
name
)
if
isinstance
(
rval
[
0
],
(
list
,
tuple
)):
if
isinstance
(
rval
[
0
],
(
list
,
tuple
)):
return
[
x
[
-
1
]
for
x
in
rval
[
0
]],
rval
[
1
]
return
[
x
[
-
1
]
for
x
in
rval
[
0
]],
rval
[
1
]
else
:
else
:
return
rval
[
0
][
-
1
],
rval
[
1
]
return
rval
[
0
][
-
1
],
rval
[
1
]
# The ``foldl`` view of Scan Op.
# The ``foldl`` view of Scan Op.
def
foldl
(
fn
def
foldl
(
fn
,
,
sequences
sequences
,
,
outputs_info
outputs_info
,
,
non_sequences
=
None
non_sequences
=
None
,
,
mode
=
None
mode
=
None
,
,
name
=
None
):
name
=
None
):
"""
"""
Similar behaviour as haskell's foldl
Similar behaviour as haskell's foldl
...
@@ -143,22 +143,22 @@ def foldl( fn
...
@@ -143,22 +143,22 @@ def foldl( fn
:param name: See ``scan``.
:param name: See ``scan``.
"""
"""
return
reduce
(
fn
=
fn
return
reduce
(
fn
=
fn
,
,
sequences
=
sequences
sequences
=
sequences
,
,
outputs_info
=
outputs_info
outputs_info
=
outputs_info
,
,
non_sequences
=
non_sequences
non_sequences
=
non_sequences
,
,
go_backwards
=
False
go_backwards
=
False
,
,
mode
=
mode
mode
=
mode
,
,
name
=
name
)
name
=
name
)
# The ``foldl`` view of Scan Op.
# The ``foldl`` view of Scan Op.
def
foldr
(
fn
def
foldr
(
fn
,
,
sequences
sequences
,
,
outputs_info
outputs_info
,
,
non_sequences
=
None
non_sequences
=
None
,
,
mode
=
None
mode
=
None
,
,
name
=
None
):
name
=
None
):
"""
"""
Similar behaviour as haskell' foldr
Similar behaviour as haskell' foldr
...
@@ -180,10 +180,10 @@ def foldr( fn
...
@@ -180,10 +180,10 @@ def foldr( fn
:param name: See ``scan``.
:param name: See ``scan``.
"""
"""
return
reduce
(
fn
=
fn
return
reduce
(
fn
=
fn
,
,
sequences
=
sequences
sequences
=
sequences
,
,
outputs_info
=
outputs_info
outputs_info
=
outputs_info
,
,
non_sequences
=
non_sequences
non_sequences
=
non_sequences
,
,
go_backwards
=
True
go_backwards
=
True
,
,
mode
=
mode
mode
=
mode
,
,
name
=
name
)
name
=
name
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论