Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b0f466d8
提交
b0f466d8
authored
9月 06, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
got rid of uses of warn_type
上级
bf23cabf
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
21 行删除
+6
-21
gradient.py
theano/gradient.py
+6
-21
没有找到文件。
theano/gradient.py
浏览文件 @
b0f466d8
...
...
@@ -292,7 +292,7 @@ def Rop(f, wrt, eval_points):
return
format_as
(
using_list
,
using_tuple
,
rval
)
def
Lop
(
f
,
wrt
,
eval_points
,
consider_constant
=
None
,
warn_type
=
False
,
def
Lop
(
f
,
wrt
,
eval_points
,
consider_constant
=
None
,
disconnected_inputs
=
'raise'
):
"""
Computes the L operation on `f` wrt to `wrt` evaluated at points given
...
...
@@ -345,8 +345,7 @@ def Lop(f, wrt, eval_points, consider_constant=None, warn_type=False,
gmap
=
grad_sources_inputs
(
arg1
,
arg2
,
warn_type
=
warn_type
)
arg2
)
# Note : If p is not in gmap there can be several reasons, among which
# is the fact that p might not be part of the computational graph. A
...
...
@@ -385,7 +384,7 @@ def Lop(f, wrt, eval_points, consider_constant=None, warn_type=False,
# Gradient
#########################
def
grad
(
cost
,
wrt
,
g_cost
=
None
,
consider_constant
=
None
,
warn_type
=
False
,
def
grad
(
cost
,
wrt
,
g_cost
=
None
,
consider_constant
=
None
,
disconnected_inputs
=
'raise'
,
add_names
=
True
):
"""
:type cost: Scalar (0-dimensional) Variable.
...
...
@@ -396,9 +395,6 @@ def grad(cost, wrt, g_cost=None, consider_constant=None, warn_type=False,
:param consider_constant: a list of expressions not to backpropagate
through
:param warn_type: a value of True will cause warnings to be logged for any
Op that emits a gradient that does not match its input type.
:type disconnected_inputs: string
:param disconnected_inputs: Defines the behaviour if some of the variables
in ``wrt`` are not part of the computational graph computing ``cost``
...
...
@@ -675,9 +671,6 @@ def _populate_grad_dict(var_to_node_to_idx,
wrt: the minimal set of variables that must be included in grad_dict
warn_type: if True, log a warning when a gradient term for a variable
has a different type from that variable
cost_name: The name of the cost being differentiated, optional.
used to name the grad with respect to x as
(d<cost_name>/dx)
...
...
@@ -839,7 +832,7 @@ def _populate_grad_dict(var_to_node_to_idx,
raise
TypeError
(
msg
)
else
:
msg
+=
' You may want to implement a '
msg
+=
'
connection_pattern method for it.'
msg
+=
'connection_pattern method for it.'
warnings
.
warn
(
msg
)
#cache the result
...
...
@@ -1393,7 +1386,7 @@ Exception args: %s""" % (self.err_pos, self.arg,
verify_grad
.
E_grad
=
GradientError
def
jacobian
(
expression
,
wrt
,
consider_constant
=
None
,
warn_type
=
False
,
def
jacobian
(
expression
,
wrt
,
consider_constant
=
None
,
disconnected_inputs
=
'raise'
):
"""
:type expression: Vector (1-dimensional) Variable
...
...
@@ -1402,9 +1395,6 @@ def jacobian(expression, wrt, consider_constant=None, warn_type=False,
:param consider_constant: a list of expressions not to backpropagate
through
:param warn_type: a value of True will cause warnings to be logged for any
Op that emits a gradient that does not match its input type.
:type disconnected_inputs: string
:param disconnected_inputs: Defines the behaviour if some of the variables
in ``wrt`` are not part of the computational graph computing ``cost``
...
...
@@ -1448,7 +1438,6 @@ def jacobian(expression, wrt, consider_constant=None, warn_type=False,
rval
=
grad
(
expr
[
idx
],
inp
,
consider_constant
=
consider_constant
,
warn_type
=
warn_type
,
disconnected_inputs
=
disconnected_inputs
)
rvals
.
append
(
rval
)
return
rvals
...
...
@@ -1466,7 +1455,7 @@ def jacobian(expression, wrt, consider_constant=None, warn_type=False,
return
format_as
(
using_list
,
using_tuple
,
jacobs
)
def
hessian
(
cost
,
wrt
,
consider_constant
=
None
,
warn_type
=
False
,
def
hessian
(
cost
,
wrt
,
consider_constant
=
None
,
disconnected_inputs
=
'raise'
):
"""
:type cost: Scalar (0-dimensional) Variable.
...
...
@@ -1476,9 +1465,6 @@ def hessian(cost, wrt, consider_constant=None, warn_type=False,
:param consider_constant: a list of expressions not to backpropagate
through
:param warn_type: a value of True will cause warnings to be logged for any
Op that emits a gradient that does not match its input type.
:type disconnected_inputs: string
:param disconnected_inputs: Defines the behaviour if some of the variables
in ``wrt`` are not part of the computational graph computing ``cost``
...
...
@@ -1521,7 +1507,6 @@ def hessian(cost, wrt, consider_constant=None, warn_type=False,
y
[
i
],
x
,
consider_constant
=
consider_constant
,
warn_type
=
warn_type
,
disconnected_inputs
=
disconnected_inputs
),
sequences
=
arange
(
expr
.
shape
[
0
]),
non_sequences
=
[
expr
,
input
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论