code: def rnn_predict(params, inputs):
      def update_rnn(input, hiddens):
          return np.tanh(
              concat_and_multiply(params["change"], input, hiddens)
          )
  
      def hiddens_to_output_probs(hiddens):
          output = concat_and_multiply(params["predict"], hiddens)
          return output - logsumexp(
              output, axis=1, keepdims=True
          )  # Normalize log-probs.
  
      num_sequences = inputs.shape[1]
      hiddens = np.repeat(params["init hiddens"], num_sequences, axis=0)
      output = [hiddens_to_output_probs(hiddens)]
  
      for input in inputs:  # Iterate over time steps.
          hiddens = update_rnn(input, hiddens)
          output.append(hiddens_to_output_probs(hiddens))
      return output
  
file_path: autograd/examples/rnn.py
imports: from __future__ import absolute_import
  from __future__ import print_function
  from builtins import range
  import autograd.numpy
  import autograd.numpy.random
  from autograd import grad
  from autograd.scipy.special import logsumexp
  from os.path import dirname, join
  from autograd.misc.optimizers import adam
label_desc: Use image node_id 4 for calling a global function with example usage: rnn_predict(params, inputs) and returns: output, np, unknown