new_contents: # Predict time series w/o using OutputProjectWrapper
  
  import tensorflow as tf
  import numpy as np
  import matplotlib.pyplot as plt
  
  # Create time series
  t_min, t_max = 0, 30
  resolution = 0.1
  
  def time_series(t):
      return t * np.sin(t) / 3 + 2 * np.sin(t * 5)
  
  def next_batch(batch_size, n_steps):
      t0 = np.random.rand(batch_size, 1) * (t_max - t_min - n_steps * resolution)
      Ts = t0 + np.arange(0., n_steps + 1) * resolution
      ys = time_series(Ts)
      return ys[:,:-1].reshape(-1, n_steps, 1), ys[:,1:].reshape(-1, n_steps, 1)
  
  t = np.linspace(t_min, t_max, (t_max - t_min) // resolution)
  
  n_steps = 20
  t_instance = np.linspace(12.2, 12.2 + resolution * (n_steps + 1), n_steps + 1)
  
  n_inputs = 1
  n_neurons = 100
  n_outputs = 1
  
  X = tf.placeholder(tf.float32, [None, n_steps, n_inputs])
  y = tf.placeholder(tf.float32, [None, n_steps, n_outputs])
  
  basic_cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons,
      activation=tf.nn.relu)
  rnn_outputs, states = tf.nn.dynamic_rnn(basic_cell, X,
      dtype=tf.float32)
  
  learning_rate = 0.001
  
  stacked_rnn_outputs = tf.reshape(rnn_outputs, [-1, n_neurons])
  stacked_outputs = tf.layers.dense(stacked_rnn_outputs, n_outputs)
  outputs = tf.reshape(stacked_outputs, [-1, n_steps, n_outputs])
  
  loss = tf.reduce_sum(tf.square(outputs - y))
  optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate)
  training_op = optimizer.minimize(loss)
  
  init = tf.global_variables_initializer()
  
  n_iterations = 1000
  batch_size = 50
  
  with tf.Session() as sess:
      init.run()
      for k in range(n_iterations):
          X_batch, y_batch = next_batch(batch_size, n_steps)
          sess.run(training_op, feed_dict={X: X_batch, y: y_batch})
          if k % 100 == 0:
              mse = loss.eval(feed_dict={X: X_batch, y: y_batch})
              print(k, "\tMSE: ", mse)
  
      X_new = time_series(np.array(t_instance[:-1].reshape(-1, n_steps, n_inputs)))
      y_pred = sess.run(outputs, feed_dict={X: X_new})
      print(y_pred)
  
  # Generat a creative new seq
  n_iterations = 2000
  batch_size = 50
  with tf.Session() as sess:
      init.run()
      for k in range(n_iterations):
          X_batch, y_batch = next_batch(batch_size, n_steps)
          sess.run(training_op, feed_dict={X: X_batch, y: y_batch})
          if k % 100 == 0:
              mse = loss.eval(feed_dict={X: X_batch, y: y_batch})
              print(k, "\tMSE: ", mse)
      
      sequence1 = [0. for j in range(n_steps)]
      for k in range(len(t) - n_steps):
          X_batch = np.array(sequence1[-n_steps:]).reshape(1, n_steps, 1)
          y_pred = sess.run(outputs, feed_dict={X: X_batch})
          sequence1.append(y_pred[0, -1, 0])
      
      sequence2 = [time_series(i * resolution + t_min + (t_max-t_min/3)) for i in range(n_steps)]
      for j in range(len(t) - n_steps):
          X_batch = np.array(sequence2[-n_steps:]).reshape(1, n_steps, 1)
          y_pred = sess.run(outputs, feed_dict={X: X_batch})
          sequence2.append(y_pred[0, -1, 0])
  
  plt.figure(figsize=(11,4))
  plt.subplot(121)
  plt.plot(t, sequence1, 'b-')
  plt.plot(t[:n_steps],sequence1[:n_steps], 'b-', linewidth=3)
  plt.xlabel('Time')
  plt.ylabel('Value')
  
  plt.subplot(122)
  plt.plot(t, sequence2, 'b-')
  plt.plot(t[:n_steps], sequence2[:n_steps], 'b-', linewidth=3)
  plt.xlabel('Time')
  plt.show()
subject: Add code for faster time series RNN