message: In `rnn` in Keras backend, only propagate shape inference in valid cases (e.g. don't do it for variable instances).
diff: @@ -3593,6 +3593,7 @@ def rnn(step_function,
  flat_state = nest.flatten(states)
  flat_new_state = nest.flatten(new_states)
  for state, new_state in zip(flat_state, flat_new_state):
  + if hasattr(new_state, 'set_shape'):
  new_state.set_shape(state.shape)
  tiled_mask_t = tuple(_expand_mask(mask_t, s) for s in flat_state)
  flat_final_state = tuple(
  @@ -3631,6 +3632,7 @@ def rnn(step_function,
  flat_state = nest.flatten(states)
  flat_new_state = nest.flatten(new_states)
  for state, new_state in zip(flat_state, flat_new_state):
  + if hasattr(new_state, 'set_shape'):
  new_state.set_shape(state.shape)
  flat_output = nest.flatten(output)
  @@ -3655,6 +3657,7 @@ def rnn(step_function,
  # static shape inference
  def set_shape(output_):
  + if hasattr(output_, 'set_shape'):
  shape = output_.shape.as_list()
  shape[0] = time_steps
  shape[1] = batch
  