Skip to content

Commit f07adcc

Browse files
alanchiaotensorflower-gardener
authored andcommitted
Update private API usage to public API usage to make open source tests pass on 1.14, nightly (1.XX and 2.XX).
PiperOrigin-RevId: 265138315
1 parent 94f8988 commit f07adcc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tensorflow_model_optimization/python/core/sparsity/keras/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ py_library(
199199
":prune",
200200
":pruning_wrapper",
201201
# numpy dep1,
202+
# tensorflow dep1,
202203
# python/keras tensorflow dep2,
203204
# python/keras:backend tensorflow dep2,
204205
# python/keras:saving tensorflow dep2,

tensorflow_model_optimization/python/core/sparsity/keras/test_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
import tempfile
1818
import numpy as np
1919

20+
import tensorflow as tf
21+
2022
from tensorflow.python import keras
2123
from tensorflow.python.keras import backend as K
22-
from tensorflow.python.keras.saving import saved_model_experimental
2324
from tensorflow_model_optimization.python.core.sparsity.keras import prune
2425
from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
2526

@@ -109,10 +110,10 @@ def _save_restore_keras_model(model):
109110

110111
def _save_restore_saved_model(model):
111112
tmpdir = tempfile.mkdtemp()
112-
saved_model_experimental.export_saved_model(model, tmpdir)
113+
tf.keras.experimental.export_saved_model(model, tmpdir)
113114

114115
with prune.prune_scope():
115-
loaded_model = saved_model_experimental.load_from_saved_model(tmpdir)
116+
loaded_model = tf.keras.experimental.load_from_saved_model(tmpdir)
116117

117118
loaded_model.compile(
118119
loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])

0 commit comments

Comments
 (0)