-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
218990b
commit 3f45c87
Showing
10 changed files
with
118 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pip install -U keras | ||
pip install -U keras==2.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
https://github.com/keras-team/keras.git | ||
2.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ============================================================================== | ||
# Copyright 2019 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""Pytest for a simple run on model testing framework | ||
""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import pytest | ||
import platform | ||
import os | ||
|
||
import tensorflow as tf | ||
import numpy as np | ||
import re | ||
|
||
from common import NgraphTest | ||
import ngraph_bridge | ||
|
||
|
||
class TestNgraphSerialize(NgraphTest): | ||
|
||
def test_ng_serialize_to_json(self): | ||
initial_contents = set(os.listdir()) | ||
xshape = (3, 4, 5) | ||
x = tf.placeholder(tf.float32, shape=xshape) | ||
out = tf.nn.l2_loss(tf.abs(x)) | ||
values = np.random.rand(*xshape) | ||
|
||
config = ngraph_bridge.update_config(tf.ConfigProto()) | ||
ngraph_enable_serialize = os.environ.pop('NGRAPH_ENABLE_SERIALIZE', | ||
None) | ||
os.environ['NGRAPH_ENABLE_SERIALIZE'] = '1' | ||
ngraph_bridge.enable() | ||
with tf.Session(config=config) as sess: | ||
out = sess.run((out), feed_dict={x: values}) | ||
os.environ.pop('NGRAPH_ENABLE_SERIALIZE', None) | ||
if ngraph_enable_serialize is not None: | ||
os.environ['NGRAPH_ENABLE_SERIALIZE'] = \ | ||
ngraph_enable_serialize | ||
|
||
final_contents = set(os.listdir()) | ||
assert (len(final_contents) - len(initial_contents) == 1) | ||
new_files = final_contents.difference(initial_contents) | ||
flname = new_files.pop() | ||
assert (flname.startswith('tf_function_') and flname.endswith('json')) | ||
os.remove(flname) |