layer.input = K.variable(np.ones((nb_samples, timesteps, input_dim)))
out1 = K.eval(layer.get_output(train))
assert(out.shape == (nb_samples, output_dim))
out2 = K.eval(layer.get_output(train))
// if the state is not reset, output should be different
assert(out1.max() != out2.max())
// check that output stays the same when state is reset
layer.reset_states()
After Change
// check that output changes after states are reset
// (even though the model itself didn"t change)
layer.reset_states()
out3 = model.predict(np.ones((nb_samples, timesteps, input_dim)))
assert(out2.max() != out3.max())
class TestRNNS(unittest.TestCase):