Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ def quantize_annotate_layer(to_annotate, quantize_config=None):
layer=to_annotate, quantize_config=quantize_config)


def _clone_model_with_weights(model_to_clone):
cloned_model = keras.models.clone_model(model_to_clone)
cloned_model.set_weights(model_to_clone.get_weights())

return cloned_model


@metrics.MonitorBoolGauge('quantize_apply_usage')
def quantize_apply(
model,
Expand Down Expand Up @@ -361,12 +368,6 @@ def quantize_apply(
'been built yet. Please call `model.build(input_shape)` '
'before quantizing your model.')

def _clone_model_with_weights(model_to_clone):
cloned_model = keras.models.clone_model(model_to_clone)
cloned_model.set_weights(model_to_clone.get_weights())

return cloned_model

def _extract_original_model(model_to_unwrap):
"""Extracts original model by removing wrappers."""
layer_quantize_map = {}
Expand Down