Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b8141fca
提交
b8141fca
authored
1月 05, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improved doc for R_op
上级
9517a606
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
37 行增加
和
4 行删除
+37
-4
op.py
theano/gof/op.py
+32
-0
elemwise.py
theano/tensor/elemwise.py
+1
-0
tensor_grad.py
theano/tensor/tensor_grad.py
+4
-4
没有找到文件。
theano/gof/op.py
浏览文件 @
b8141fca
...
...
@@ -449,6 +449,38 @@ class PureOp(object):
# Python implementation #
#########################
def
R_op
(
self
,
inputs
,
eval_points
):
"""
This method is primarily used by tensor.Rop
Suppose the op outputs
[ f_1(inputs), ..., f_n(inputs) ]
inputs: a Variable or list of Variables
eval_points: a Variable or list of Variables with
the same length as inputs. Each element
of eval_points specifies the value of
the corresponding input at the point
where the R op is to be evaluated.
returns: a list of n elements
rval[i] should be Rop(f = f_i(inputs),
wrt = inputs,
eval_points = eval_points)
"""
raise
NotImplementedError
(
str
(
self
)
+
' of type '
+
str
(
self
.
__class__
.
__name__
)
+
" does not "
"implement R_op. If this is a theano op, write to the "
"theano-dev mailing list for assistance. If it is your "
"own op, implement the R_op method."
)
def
perform
(
self
,
node
,
inputs
,
output_storage
):
"""
Required: Calculate the function on the inputs and put the variables in the
...
...
theano/tensor/elemwise.py
浏览文件 @
b8141fca
...
...
@@ -1007,6 +1007,7 @@ class CAReduce(Op):
if
scalar_op
.
nin
not
in
[
-
1
,
2
]
or
scalar_op
.
nout
!=
1
:
raise
NotImplementedError
(
"CAReduce only supports binary functions with a single output."
)
self
.
scalar_op
=
scalar_op
if
axis
is
None
:
self
.
axis
=
axis
elif
isinstance
(
axis
,
int
):
...
...
theano/tensor/tensor_grad.py
浏览文件 @
b8141fca
...
...
@@ -65,6 +65,8 @@ def Rop(f, wrt, eval_points):
assert
len
(
wrt
)
==
len
(
eval_points
)
#check that each element of wrt corresponds to an element
#of eval_points with the same dimensionality
for
pack
in
enumerate
(
zip
(
wrt
,
eval_points
)):
i
=
pack
[
0
]
wrt_elem
,
eval_point
=
pack
[
1
]
...
...
@@ -82,15 +84,13 @@ def Rop(f, wrt, eval_points):
seen_nodes
=
{}
def
_traverse
(
node
):
""" TODO: writeme """
if
node
is
None
:
return
None
else
:
op
=
node
.
op
inputs
=
node
.
inputs
if
not
hasattr
(
op
,
'R_op'
):
raise
Exception
((
' R_op was not implemented for
%
s'
' operation. Email the mailing list'
' for help'
)
%
op
.
__class__
.
__name__
)
# Compute the evaluation points corresponding to each of the
# inputs of the node
local_eval_points
=
[]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论