code: def main():
      tf.set_random_seed(10)
      with tf.Session() as sess:
          rnn_cell = tf.nn.rnn_cell.GRUCell(10)
  
          # defining initial state
          initial_state = rnn_cell.zero_state(4, dtype=tf.float32)
  
          inputs = tf.Variable(
              tf.random_uniform(shape=(4, 30, 100)), name="input"
          )
          inputs = tf.identity(inputs, "input_node")
  
          # 'state' is a tensor of shape [batch_size, cell_state_size]
          outputs, state = tf.nn.dynamic_rnn(
              rnn_cell,
              inputs,
              initial_state=initial_state,
              dtype=tf.float32,
          )
  
          y1 = tf.identity(outputs, "outputs")
          y2 = tf.identity(state, "state")
  
          t1 = tf.ones([4, 30, 10])
          t2 = tf.ones([4, 10])
  
          loss = tf.reduce_sum((y1 - t1) * (y1 - t1)) + tf.reduce_sum(
              (y2 - t2) * (y2 - t2)
          )
          tf.identity(loss, name="gru_loss")
          grad = tf.identity(
              tf.gradients(loss, inputs), name="gradOutput"
          )
          # tf.summary.FileWriter('/tmp/log', tf.get_default_graph())
  
          net_outputs = map(
              lambda x: tf.get_default_graph().get_tensor_by_name(x),
              argv[2].split(","),
          )
          run_model(net_outputs, argv[1], None, argv[3] == "True")
  
imports: import tensorflow
  import numpy
  from sys import argv
  from util import run_model
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types