'Returns the `updates` from all layers that are stateful.
This is useful for separating training updates and
state updates, e.g. when we need to update a layer\'s internal state
during prediction.
# Returns
A list of update ops.'

@property
def state_updates(self):

    state_updates = []
    for layer in self.layers:
        if getattr(layer, 'stateful', False):
            if hasattr(layer, 'updates'):
                state_updates += layer.updates
    return state_updates
