File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
tensorflow_model_optimization/python/core/sparsity/keras Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff 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,
Original file line number Diff line number Diff line change 1717import tempfile
1818import numpy as np
1919
20+ import tensorflow as tf
21+
2022from tensorflow .python import keras
2123from tensorflow .python .keras import backend as K
22- from tensorflow .python .keras .saving import saved_model_experimental
2324from tensorflow_model_optimization .python .core .sparsity .keras import prune
2425from tensorflow_model_optimization .python .core .sparsity .keras import pruning_wrapper
2526
@@ -109,10 +110,10 @@ def _save_restore_keras_model(model):
109110
110111def _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' ])
You can’t perform that action at this time.
0 commit comments