Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_38905368
tensorflow
提交
662053a4
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,发现更多精彩内容 >>
提交
662053a4
编写于
12月 10, 2018
作者:
K
Katherine Wu
提交者:
TensorFlower Gardener
12月 10, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix kokoro tests by removing dependency on save_test.
PiperOrigin-RevId: 224913339
上级
c136aa82
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
4 deletion
+26
-4
tensorflow/python/keras/BUILD
tensorflow/python/keras/BUILD
+0
-1
tensorflow/python/keras/engine/training_utils_test.py
tensorflow/python/keras/engine/training_utils_test.py
+26
-3
未找到文件。
tensorflow/python/keras/BUILD
浏览文件 @
662053a4
...
@@ -848,7 +848,6 @@ py_test(
...
@@ -848,7 +848,6 @@ py_test(
deps
=
[
deps
=
[
":keras"
,
":keras"
,
"//tensorflow/python:client_testlib"
,
"//tensorflow/python:client_testlib"
,
"//tensorflow/python/saved_model:save_test"
,
"//third_party/py/numpy"
,
"//third_party/py/numpy"
,
"@absl_py//absl/testing:parameterized"
,
"@absl_py//absl/testing:parameterized"
,
],
],
...
...
tensorflow/python/keras/engine/training_utils_test.py
浏览文件 @
662053a4
...
@@ -22,10 +22,13 @@ import os
...
@@ -22,10 +22,13 @@ import os
import
numpy
as
np
import
numpy
as
np
from
tensorflow.python.client
import
session
as
session_lib
from
tensorflow.python
import
keras
from
tensorflow.python
import
keras
from
tensorflow.python.eager
import
context
from
tensorflow.python.eager
import
context
from
tensorflow.python.eager
import
def_function
from
tensorflow.python.eager
import
def_function
from
tensorflow.python.framework
import
dtypes
from
tensorflow.python.framework
import
dtypes
from
tensorflow.python.framework
import
ops
from
tensorflow.python.framework
import
tensor_spec
from
tensorflow.python.framework
import
tensor_spec
from
tensorflow.python.framework
import
tensor_util
from
tensorflow.python.framework
import
tensor_util
from
tensorflow.python.keras
import
backend
as
K
from
tensorflow.python.keras
import
backend
as
K
...
@@ -35,8 +38,10 @@ from tensorflow.python.keras.engine import training_utils
...
@@ -35,8 +38,10 @@ from tensorflow.python.keras.engine import training_utils
from
tensorflow.python.keras.utils
import
tf_utils
from
tensorflow.python.keras.utils
import
tf_utils
from
tensorflow.python.ops
import
array_ops
from
tensorflow.python.ops
import
array_ops
from
tensorflow.python.platform
import
test
from
tensorflow.python.platform
import
test
from
tensorflow.python.saved_model
import
loader
from
tensorflow.python.saved_model
import
save
as
save_lib
from
tensorflow.python.saved_model
import
save
as
save_lib
from
tensorflow.python.saved_model
import
save_test
from
tensorflow.python.saved_model
import
signature_constants
from
tensorflow.python.saved_model
import
tag_constants
class
ModelInputsTest
(
test
.
TestCase
):
class
ModelInputsTest
(
test
.
TestCase
):
...
@@ -222,6 +227,25 @@ class TraceModelCallTest(keras_parameterized.TestCase):
...
@@ -222,6 +227,25 @@ class TraceModelCallTest(keras_parameterized.TestCase):
self
.
_assert_all_close
(
expected_outputs
,
signature_outputs
)
self
.
_assert_all_close
(
expected_outputs
,
signature_outputs
)
def
_import_and_infer
(
save_dir
,
inputs
):
"""Import a SavedModel into a TF 1.x-style graph and run `signature_key`."""
graph
=
ops
.
Graph
()
with
graph
.
as_default
(),
session_lib
.
Session
()
as
session
:
model
=
loader
.
load
(
session
,
[
tag_constants
.
SERVING
],
save_dir
)
signature
=
model
.
signature_def
[
signature_constants
.
DEFAULT_SERVING_SIGNATURE_DEF_KEY
]
assert
set
(
inputs
.
keys
())
==
set
(
signature
.
inputs
.
keys
())
feed_dict
=
{}
for
arg_name
in
inputs
.
keys
():
feed_dict
[
graph
.
get_tensor_by_name
(
signature
.
inputs
[
arg_name
].
name
)]
=
(
inputs
[
arg_name
])
output_dict
=
{}
for
output_name
,
output_tensor_info
in
signature
.
outputs
.
items
():
output_dict
[
output_name
]
=
graph
.
get_tensor_by_name
(
output_tensor_info
.
name
)
return
session
.
run
(
output_dict
,
feed_dict
=
feed_dict
)
class
ModelSaveTest
(
keras_parameterized
.
TestCase
):
class
ModelSaveTest
(
keras_parameterized
.
TestCase
):
@
keras_parameterized
.
run_with_all_model_types
@
keras_parameterized
.
run_with_all_model_types
...
@@ -239,8 +263,7 @@ class ModelSaveTest(keras_parameterized.TestCase):
...
@@ -239,8 +263,7 @@ class ModelSaveTest(keras_parameterized.TestCase):
self
.
assertAllClose
(
self
.
assertAllClose
(
{
model
.
output_names
[
0
]:
model
.
predict_on_batch
(
inputs
)},
{
model
.
output_names
[
0
]:
model
.
predict_on_batch
(
inputs
)},
save_test
.
_import_and_infer
(
save_dir
,
_import_and_infer
(
save_dir
,
{
model
.
input_names
[
0
]:
np
.
ones
((
8
,
5
))}))
{
model
.
input_names
[
0
]:
np
.
ones
((
8
,
5
))}))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test
.
main
()
test
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录