message: Bug fix for layer weight check in python3.
diff: @@ -33,9 +33,15 @@ def is_layer(obj):
  def has_weights(obj):
  """Implicit check for Layer-like objects."""
  # TODO(b/110718070): Replace with isinstance(obj, base_layer.Layer).
  - return (hasattr(obj, "trainable_weights")
  - and hasattr(obj, "non_trainable_weights")
  - and not isinstance(obj, type))
  + try:
  + has_weight = (hasattr(obj, "trainable_weights")
  + and hasattr(obj, "non_trainable_weights"))
  + except ValueError:
  + # Ignore the ValueError here since the model/layer might not be built yet.
  + # In that case, the obj is actual a instance with weights.
  + has_weight = True
  +
  + return has_weight and not isinstance(obj, type)
  def filter_empty_layer_containers(layer_list):
  