Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f21bd7d3
提交
f21bd7d3
authored
1月 23, 2017
作者:
wazeerzulfikar
提交者:
abergeron
1月 23, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed grad() to L_op in given elemwise (#5431)
上级
d9e51499
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
5 行增加
和
13 行删除
+5
-13
elemwise.py
theano/tensor/elemwise.py
+5
-13
没有找到文件。
theano/tensor/elemwise.py
浏览文件 @
f21bd7d3
...
@@ -634,11 +634,7 @@ second dimension
...
@@ -634,11 +634,7 @@ second dimension
return
[[
True
for
output
in
node
.
outputs
]
for
ipt
in
node
.
inputs
]
return
[[
True
for
output
in
node
.
outputs
]
for
ipt
in
node
.
inputs
]
def
grad
(
self
,
inputs
,
ograds
):
def
L_op
(
self
,
inputs
,
outs
,
ograds
):
outs
=
self
(
*
inputs
)
if
not
isinstance
(
outs
,
(
list
,
tuple
)):
outs
=
[
outs
]
# compute grad with respect to broadcasted input
# compute grad with respect to broadcasted input
rval
=
self
.
_bgrad
(
inputs
,
ograds
)
rval
=
self
.
_bgrad
(
inputs
,
ograds
)
...
@@ -1927,12 +1923,10 @@ class Sum(CAReduceDtype):
...
@@ -1927,12 +1923,10 @@ class Sum(CAReduceDtype):
str
(
self
.
acc_dtype
)
str
(
self
.
acc_dtype
)
)
)
def
grad
(
self
,
inp
,
grads
):
def
L_op
(
self
,
inp
,
out
,
grads
):
x
,
=
inp
x
,
=
inp
out
=
self
(
*
inp
)
if
out
[
0
]
.
dtype
not
in
theano
.
tensor
.
continuous_dtypes
:
if
out
.
dtype
not
in
theano
.
tensor
.
continuous_dtypes
:
return
[
x
.
zeros_like
(
dtype
=
theano
.
config
.
floatX
)]
return
[
x
.
zeros_like
(
dtype
=
theano
.
config
.
floatX
)]
gz
,
=
grads
gz
,
=
grads
...
@@ -1985,7 +1979,7 @@ class Prod(CAReduceDtype):
...
@@ -1985,7 +1979,7 @@ class Prod(CAReduceDtype):
if
'no_zeros_in_input'
not
in
dct
:
if
'no_zeros_in_input'
not
in
dct
:
self
.
no_zeros_in_input
=
False
self
.
no_zeros_in_input
=
False
def
grad
(
self
,
inp
,
grads
):
def
L_op
(
self
,
inp
,
out
,
grads
):
"""
"""
The grad of this Op could be very easy, if it is was not for the case
The grad of this Op could be very easy, if it is was not for the case
where zeros are present in a given "group" (ie. elements reduced
where zeros are present in a given "group" (ie. elements reduced
...
@@ -2034,9 +2028,7 @@ class Prod(CAReduceDtype):
...
@@ -2034,9 +2028,7 @@ class Prod(CAReduceDtype):
prod_in
,
=
inp
prod_in
,
=
inp
gz
,
=
grads
gz
,
=
grads
out
=
self
(
*
inp
)
if
(
out
[
0
]
.
dtype
in
theano
.
tensor
.
discrete_dtypes
or
if
(
out
.
dtype
in
theano
.
tensor
.
discrete_dtypes
or
self
.
acc_dtype
in
theano
.
tensor
.
discrete_dtypes
):
self
.
acc_dtype
in
theano
.
tensor
.
discrete_dtypes
):
# There is an int conversion in the way
# There is an int conversion in the way
return
[
prod_in
.
zeros_like
(
dtype
=
theano
.
config
.
floatX
)]
return
[
prod_in
.
zeros_like
(
dtype
=
theano
.
config
.
floatX
)]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论