Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3c755c69
提交
3c755c69
authored
9月 15, 2016
作者:
Faruk Ahmed
提交者:
Frederic Bastien
10月 03, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ifelse - inherit from Op, rename make_thunk to make_py_thunk; scan - added make_py_thunk func
上级
7fa59095
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
5 行删除
+16
-5
ifelse.py
theano/ifelse.py
+3
-3
scan_op.py
theano/scan_module/scan_op.py
+13
-2
没有找到文件。
theano/ifelse.py
浏览文件 @
3c755c69
...
@@ -20,7 +20,7 @@ import numpy
...
@@ -20,7 +20,7 @@ import numpy
import
theano.tensor
import
theano.tensor
from
theano.tensor
import
TensorType
from
theano.tensor
import
TensorType
from
theano
import
gof
from
theano
import
gof
from
theano.gof
import
Pure
Op
,
Apply
from
theano.gof
import
Op
,
Apply
from
six
import
iteritems
from
six
import
iteritems
from
six.moves
import
xrange
from
six.moves
import
xrange
...
@@ -41,7 +41,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
...
@@ -41,7 +41,7 @@ __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
_logger
=
logging
.
getLogger
(
'theano.ifelse'
)
_logger
=
logging
.
getLogger
(
'theano.ifelse'
)
class
IfElse
(
Pure
Op
):
class
IfElse
(
Op
):
"""
"""
Op that provides conditional graph evaluation if used with the CVM/VM
Op that provides conditional graph evaluation if used with the CVM/VM
linkers. Note that there exist a helpful function `ifelse` that should
linkers. Note that there exist a helpful function `ifelse` that should
...
@@ -235,7 +235,7 @@ class IfElse(PureOp):
...
@@ -235,7 +235,7 @@ class IfElse(PureOp):
if_true_op
(
*
if_true
,
**
dict
(
return_list
=
True
))
+
if_true_op
(
*
if_true
,
**
dict
(
return_list
=
True
))
+
if_false_op
(
*
if_false
,
**
dict
(
return_list
=
True
)))
if_false_op
(
*
if_false
,
**
dict
(
return_list
=
True
)))
def
make_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
def
make_
py_
thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
cond
=
node
.
inputs
[
0
]
cond
=
node
.
inputs
[
0
]
ts
=
node
.
inputs
[
1
:][:
self
.
n_outs
]
ts
=
node
.
inputs
[
1
:][:
self
.
n_outs
]
fs
=
node
.
inputs
[
1
:][
self
.
n_outs
:]
fs
=
node
.
inputs
[
1
:][
self
.
n_outs
:]
...
...
theano/scan_module/scan_op.py
浏览文件 @
3c755c69
...
@@ -697,7 +697,8 @@ class Scan(PureOp):
...
@@ -697,7 +697,8 @@ class Scan(PureOp):
self
.
_hash_inner_graph
,
self
.
_hash_inner_graph
,
scan_utils
.
hash_listsDictsTuples
(
self
.
info
)))
scan_utils
.
hash_listsDictsTuples
(
self
.
info
)))
def
make_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
def
make_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
,
python_exec
=
False
):
"""
"""
Parameters
Parameters
...
@@ -715,7 +716,8 @@ class Scan(PureOp):
...
@@ -715,7 +716,8 @@ class Scan(PureOp):
no_recycling
no_recycling
List of variables for which it is forbidden to reuse memory
List of variables for which it is forbidden to reuse memory
allocated by a previous call.
allocated by a previous call.
python_exec
If we want python execution.
Notes
Notes
-----
-----
If the thunk consults the storage_map on every call, it is safe
If the thunk consults the storage_map on every call, it is safe
...
@@ -864,6 +866,8 @@ class Scan(PureOp):
...
@@ -864,6 +866,8 @@ class Scan(PureOp):
for
out
in
self
.
fn
.
maker
.
fgraph
.
outputs
]
for
out
in
self
.
fn
.
maker
.
fgraph
.
outputs
]
try
:
try
:
if
python_exec
is
True
:
raise
theano
.
gof
.
cmodule
.
MissingGXX
cython_mintaps
=
numpy
.
asarray
(
self
.
mintaps
,
dtype
=
'int32'
)
cython_mintaps
=
numpy
.
asarray
(
self
.
mintaps
,
dtype
=
'int32'
)
cython_tap_array_len
=
\
cython_tap_array_len
=
\
numpy
.
asarray
([
len
(
x
)
for
x
in
self
.
tap_array
],
numpy
.
asarray
([
len
(
x
)
for
x
in
self
.
tap_array
],
...
@@ -961,6 +965,13 @@ class Scan(PureOp):
...
@@ -961,6 +965,13 @@ class Scan(PureOp):
rval
.
lazy
=
False
rval
.
lazy
=
False
return
rval
return
rval
def
make_py_thunk
(
self
,
node
,
storage_map
,
compute_map
,
no_recycling
):
return
self
.
make_thunk
(
node
=
node
,
storage_map
=
storage_map
,
compute_map
=
compute_map
,
no_recycling
=
no_recycling
,
python_exec
=
True
)
def
inner_seqs
(
self
,
list_inputs
):
def
inner_seqs
(
self
,
list_inputs
):
# Given the list of inner inputs this function grabs those
# Given the list of inner inputs this function grabs those
# corresponding to sequences
# corresponding to sequences
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论