message: Split legacy layers `add_update` logic out of Keras.
diff: @@ -541,6 +541,32 @@ class Layer(base_layer.Layer):
  _add_elements_to_collection(self.updates, ops.GraphKeys.UPDATE_OPS)
  return outputs
  + def add_update(self, updates, inputs=None):
  + if callable(updates):
  + updates = updates()
  +
  + if context.executing_eagerly():
  + return # Updates already applied when in eager mode.
  +
  + def process_update(x):
  + if isinstance(x, ops.Operation):
  + return x
  + elif hasattr(x, 'op'):
  + return x.op
  + else:
  + return ops.convert_to_tensor(x)
  +
  + if not isinstance(updates, list):
  + updates = [updates]
  + updates = [process_update(x) for x in updates]
  + self._updates += updates
  + if inputs is None:
  + for u in updates:
  + u._unconditional_update = True # pylint: disable=protected-access
  + else:
  + for u in updates:
  + u._unconditional_update = False # pylint: disable=protected-access
  +
  def __deepcopy__(self, memo):
  no_copy = set(['_graph'])
  shallow_copy = set(['_scope', '_always_reuse_variable_scope'])
  