Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_38905368
tensorflow
提交
d4ea993c
T
tensorflow
项目概览
qq_38905368
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d4ea993c
编写于
10月 03, 2017
作者:
A
Alexandre Passos
提交者:
TensorFlower Gardener
10月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removes unnecessary eager-mode call to convert_to_tensor in record_gradient.
PiperOrigin-RevId: 170944265
上级
add6d2d0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
6 deletion
+4
-6
tensorflow/python/eager/backprop.py
tensorflow/python/eager/backprop.py
+1
-3
tensorflow/python/eager/execute.py
tensorflow/python/eager/execute.py
+1
-1
tensorflow/python/eager/python_eager_op_gen.cc
tensorflow/python/eager/python_eager_op_gen.cc
+2
-2
未找到文件。
tensorflow/python/eager/backprop.py
浏览文件 @
d4ea993c
...
...
@@ -524,7 +524,7 @@ _grad_fn_accepts_none_for_indices = {
}
def
_record_gradient
(
op_name
,
inputs
,
attrs
,
results
,
ctx
,
name
):
def
_record_gradient
(
op_name
,
inputs
,
attrs
,
results
,
name
):
"""Records gradients for a TensorFlow operation.
Args:
...
...
@@ -534,7 +534,6 @@ def _record_gradient(op_name, inputs, attrs, results, ctx, name):
attrs: A tuple with alternating string attr names and attr values for this
operation.
results: The results of the operation (as a flat list).
ctx: The value of context.context().
name: Customized name for the operation.
Returns:
...
...
@@ -572,7 +571,6 @@ def _record_gradient(op_name, inputs, attrs, results, ctx, name):
"output_grads"
,
orig_outputs
,
"gradients"
,
result
)
return
result
inputs
=
[
ops
.
internal_convert_to_tensor
(
x
,
ctx
=
ctx
)
for
x
in
inputs
]
tape
.
record_operation
(
op_name
,
results
,
inputs
,
[],
grad_fn
)
if
_tracing
:
print
(
"Computed op"
,
(
name
if
name
else
op_name
),
"inputs"
,
inputs
,
...
...
tensorflow/python/eager/execute.py
浏览文件 @
d4ea993c
...
...
@@ -84,7 +84,7 @@ def execute(op_name, num_outputs, inputs, attrs, ctx, name=None):
def
record_gradient
(
unused_op_name
,
unused_inputs
,
unused_attrs
,
unused_results
,
unused_
ctx
,
unused_
name
):
unused_name
):
"""Import backprop if you want gradients recorded."""
pass
...
...
tensorflow/python/eager/python_eager_op_gen.cc
浏览文件 @
d4ea993c
...
...
@@ -412,7 +412,7 @@ string GenEagerPythonOp::Code() {
" if not _result:
\n
"
" return _op
\n
"
);
}
strings
::
StrAppend
(
&
result_
,
" _inputs_flat =
"
,
inputs
,
"
\n
"
);
strings
::
StrAppend
(
&
result_
,
" _inputs_flat =
_op.inputs
\n
"
);
// Compute graph-mode attrs.
if
(
op_def_
.
attr_size
()
>
0
)
{
...
...
@@ -511,7 +511,7 @@ string GenEagerPythonOp::Code() {
if
(
num_outs_
>
0
)
{
strings
::
StrAppend
(
&
result_
,
" _execute.record_gradient(
\n
"
,
"
\"
"
,
op_def_
.
name
(),
"
\"
, _inputs_flat, _attrs, _result,
_ctx,
name)
\n
"
);
"
\"
, _inputs_flat, _attrs, _result, name)
\n
"
);
if
(
num_outs_
==
1
&&
!
output_sizes
[
0
].
empty
())
{
// Single list result.
}
else
if
(
num_outs_
==
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录