From 65248147f44ce3512144e42c121743374d099f30 Mon Sep 17 00:00:00 2001 From: Chen Qian Date: Fri, 22 Jan 2021 14:01:33 -0800 Subject: [PATCH] #PRIVATE_TF_API_USAGE_CLEANUP Remove the definition of gather_trainable_weights(), as there is no reference in the codebase. PiperOrigin-RevId: 353314486 Change-Id: I81e6a1ade60bbcffe557092c7824baa2aa7c860d --- tensorflow/python/keras/utils/layer_utils.py | 23 ------------------- .../python/training/tracking/layer_utils.py | 23 ------------------- 2 files changed, 46 deletions(-) diff --git a/tensorflow/python/keras/utils/layer_utils.py b/tensorflow/python/keras/utils/layer_utils.py index 8722790b069..be435c01136 100644 --- a/tensorflow/python/keras/utils/layer_utils.py +++ b/tensorflow/python/keras/utils/layer_utils.py @@ -276,29 +276,6 @@ def print_summary(model, line_length=None, positions=None, print_fn=None): print_fn('_' * line_length) -def gather_trainable_weights(trainable, sub_layers, extra_variables): - """Lists the trainable weights for an object with sub-layers. - - Args: - trainable: Whether the object collecting the variables is trainable. - sub_layers: A flat list of Layer objects owned by this object, to collect - variables from. - extra_variables: Any extra variables to include. Their `.trainable` property - is used to categorize them. - - Returns: - A list of collected trainable weights/variables. - """ - if not trainable: - return [] - weights = [] - for layer in sub_layers: - weights += layer.trainable_weights - trainable_extra_variables = [ - v for v in extra_variables if v.trainable] - return weights + trainable_extra_variables - - def convert_dense_weights_data_format(dense, previous_feature_map_shape, target_data_format='channels_first'): diff --git a/tensorflow/python/training/tracking/layer_utils.py b/tensorflow/python/training/tracking/layer_utils.py index 17fb2756c31..b21ef5b65b7 100644 --- a/tensorflow/python/training/tracking/layer_utils.py +++ b/tensorflow/python/training/tracking/layer_utils.py @@ -156,26 +156,3 @@ def filter_empty_layer_containers(layer_list): # Trackable data structures will not show up in ".layers" lists, but # the layers they contain will. to_visit.extend(sub_layers[::-1]) - - -def gather_trainable_weights(trainable, sub_layers, extra_variables): - """Lists the trainable weights for an object with sub-layers. - - Args: - trainable: Whether the object collecting the variables is trainable. - sub_layers: A flat list of Layer objects owned by this object, to collect - variables from. - extra_variables: Any extra variables to include. Their `.trainable` property - is used to categorize them. - - Returns: - A list of collected trainable weights/variables. - """ - if not trainable: - return [] - weights = [] - for layer in sub_layers: - weights += layer.trainable_weights - trainable_extra_variables = [ - v for v in extra_variables if v.trainable] - return weights + trainable_extra_variables