From a4ade2fd8c0c426d5d31c9b3931b48e27bb232d8 Mon Sep 17 00:00:00 2001 From: TensorFlow Hub Authors Date: Thu, 8 Aug 2019 10:19:19 +0200 Subject: [PATCH] Replace set with ObjectIdentitySet to prepare for eq change in TF PiperOrigin-RevId: 262303233 --- tensorflow_hub/keras_layer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow_hub/keras_layer.py b/tensorflow_hub/keras_layer.py index 9ed6bb1ce..78bdc8d3c 100644 --- a/tensorflow_hub/keras_layer.py +++ b/tensorflow_hub/keras_layer.py @@ -116,12 +116,12 @@ def __init__(self, handle, trainable=False, arguments=None, **kwargs): if hasattr(self._func, "trainable_variables"): for v in self._func.trainable_variables: self._add_existing_weight(v, trainable=True) - trainable_variables = set(self._func.trainable_variables) + trainable_variables = {id(v) for v in self._func.trainable_variables} else: - trainable_variables = set() + trainable_variables = {} if hasattr(self._func, "variables"): for v in self._func.variables: - if v not in trainable_variables: + if id(v) not in trainable_variables: self._add_existing_weight(v, trainable=False) # Forward the callable's regularization losses (if any).