#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
This commit is contained in:
Chen Qian 2021-01-22 14:01:33 -08:00 committed by TensorFlower Gardener
parent 8d17c16328
commit 65248147f4
2 changed files with 0 additions and 46 deletions

View File

@ -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'):

View File

@ -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