Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1ab45a7f
提交
1ab45a7f
authored
10月 20, 2011
作者:
Razvan Pascanu
提交者:
David Warde-Farley
11月 16, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cosmetic changes
上级
af161adb
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
4 行增加
和
6 行删除
+4
-6
ifelse.py
theano/ifelse.py
+4
-6
没有找到文件。
theano/ifelse.py
浏览文件 @
1ab45a7f
...
@@ -69,7 +69,6 @@ class IfElse(PureOp):
...
@@ -69,7 +69,6 @@ class IfElse(PureOp):
for
idx
in
xrange
(
n_outs
):
for
idx
in
xrange
(
n_outs
):
view_map
[
idx
]
=
[
idx
+
1
]
view_map
[
idx
]
=
[
idx
+
1
]
self
.
view_map
=
view_map
self
.
view_map
=
view_map
#raise NotImplementedError('Cond must copy for now')
self
.
as_view
=
as_view
self
.
as_view
=
as_view
self
.
gpu
=
gpu
self
.
gpu
=
gpu
self
.
n_outs
=
n_outs
self
.
n_outs
=
n_outs
...
@@ -87,12 +86,10 @@ class IfElse(PureOp):
...
@@ -87,12 +86,10 @@ class IfElse(PureOp):
return
True
return
True
def
__hash__
(
self
):
def
__hash__
(
self
):
rval
=
(
hash
(
type
(
self
))
^
rval
=
(
hash
(
type
(
self
))
^
hash
(
self
.
as_view
)
^
hash
(
self
.
as_view
)
^
hash
(
self
.
gpu
)
^
hash
(
self
.
gpu
)
^
hash
(
self
.
n_outs
))
hash
(
self
.
n_outs
))
return
rval
return
rval
def
__str__
(
self
):
def
__str__
(
self
):
...
@@ -107,6 +104,7 @@ class IfElse(PureOp):
...
@@ -107,6 +104,7 @@ class IfElse(PureOp):
def
infer_shape
(
self
,
node
,
inputs_shapes
):
def
infer_shape
(
self
,
node
,
inputs_shapes
):
# By construction, corresponding then/else pairs have the same number
# By construction, corresponding then/else pairs have the same number
# of dimensions
# of dimensions
ts_shapes
=
inputs_shapes
[
1
:][:
self
.
n_outs
]
ts_shapes
=
inputs_shapes
[
1
:][:
self
.
n_outs
]
fs_shapes
=
inputs_shapes
[
1
:][
self
.
n_outs
:]
fs_shapes
=
inputs_shapes
[
1
:][
self
.
n_outs
:]
new_ts_inputs
=
[]
new_ts_inputs
=
[]
...
@@ -150,9 +148,6 @@ class IfElse(PureOp):
...
@@ -150,9 +148,6 @@ class IfElse(PureOp):
out_shapes
+=
[
tuple
(
current_shape
)]
out_shapes
+=
[
tuple
(
current_shape
)]
return
out_shapes
return
out_shapes
def
R_op
(
self
,
inputs
,
eval_points
):
return
self
.
make_node
(
inputs
[
0
],
*
eval_points
[
1
:])
.
outputs
def
make_node
(
self
,
c
,
*
args
):
def
make_node
(
self
,
c
,
*
args
):
if
not
self
.
gpu
:
if
not
self
.
gpu
:
# When gpu is true, we are given only cuda ndarrays, and we want
# When gpu is true, we are given only cuda ndarrays, and we want
...
@@ -178,6 +173,9 @@ class IfElse(PureOp):
...
@@ -178,6 +173,9 @@ class IfElse(PureOp):
'for True'
))
'for True'
))
return
Apply
(
self
,
[
c
]
+
list
(
args
),
[
t
.
type
()
for
t
in
ts
])
return
Apply
(
self
,
[
c
]
+
list
(
args
),
[
t
.
type
()
for
t
in
ts
])
def
R_op
(
self
,
inputs
,
eval_points
):
return
self
.
make_node
(
inputs
[
0
],
*
eval_points
[
1
:])
.
outputs
def
grad
(
self
,
ins
,
grads
):
def
grad
(
self
,
ins
,
grads
):
ts
=
ins
[
1
:][:
self
.
n_outs
]
ts
=
ins
[
1
:][:
self
.
n_outs
]
fs
=
ins
[
1
:][
self
.
n_outs
:]
fs
=
ins
[
1
:][
self
.
n_outs
:]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论