code: def lstm_predict(params, inputs):
      def update_lstm(input, hiddens, cells):
          change = np.tanh(
              concat_and_multiply(params["change"], input, hiddens)
          )
          forget = sigmoid(
              concat_and_multiply(params["forget"], input, hiddens)
          )
          ingate = sigmoid(
              concat_and_multiply(params["ingate"], input, hiddens)
          )
          outgate = sigmoid(
              concat_and_multiply(params["outgate"], input, hiddens)
          )
          cells = cells * forget + ingate * change
          hiddens = outgate * np.tanh(cells)
          return hiddens, cells
  
      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)
      cells = np.repeat(params["init cells"], num_sequences, axis=0)
  
      output = [hiddens_to_output_probs(hiddens)]
      for input in inputs:  # Iterate over time steps.
          hiddens, cells = update_lstm(input, hiddens, cells)
          output.append(hiddens_to_output_probs(hiddens))
      return output
  
file_path: autograd/examples/lstm.py
imports: from __future__ import absolute_import
  from __future__ import print_function
  from builtins import range
  from os.path import dirname, join
  import autograd.numpy
  import autograd.numpy.random
  from autograd import grad
  from autograd.scipy.special import logsumexp
  from autograd.misc.optimizers import adam
  from rnn import string_to_one_hot, one_hot_to_string, build_dataset, sigmoid, concat_and_multiply
label_desc: Use image node_id 2 for calling a global function with example usage: lstm_predict(params, inputs) and returns: output, hiddens,  cells, unknown