code: def tf_baseline_lstm():
      import tensorflow as tf
      import cntk.contrib.crosstalk.crosstalk_tensorflow as crtf
  
      ci = crtf.instance
  
      tf.reset_default_graph()
  
      with tf.variable_scope("rnn"):
          x = tf.placeholder(
              tf.float32, [batch_size, max_seq_len, in_dim]
          )
          l = tf.placeholder(tf.int32, [batch_size])
  
          if tf.VERSION.startswith("0.12"):
              cell = tf.nn.rnn_cell.BasicLSTMCell(dim)
              (fw, bw), _ = tf.nn.bidirectional_dynamic_rnn(
                  cell, cell, x, l, dtype=tf.float32
              )
              scope = "rnn/BiRNN"
          elif tf.VERSION.startswith("1"):
              (fw, bw), _ = tf.nn.bidirectional_dynamic_rnn(
                  tf.contrib.rnn.BasicLSTMCell(dim),
                  tf.contrib.rnn.BasicLSTMCell(dim),
                  x,
                  l,
                  dtype=tf.float32,
              )
              scope = "rnn/bidirectional_rnn"
          else:
              raise Exception("only supports 0.12.* and 1.*")
  
          ci.watch(
              scope,
              "birnn",
              var_type=cstk.RnnAttr,
              attr=cstk.RnnAttr(
                  bidirectional=True,
                  op_type="lstm",
                  input_dim=in_dim,
                  hidden_dim=dim,
                  forget_bias=1,
              ),
          )  # tf default forget_bias==1
  
          if tf.VERSION.startswith("0.12"):
              output = tf.concat(2, [fw, bw])
          elif tf.VERSION.startswith("1"):
              output = tf.concat([fw, bw], 2)
          else:
              raise Exception("only supports 0.12.* and 1.*")
  
          ci.watch(output, "birnn_out", var_type=crtf.VariableType)
  
      with tf.Session() as sess:
          sess.run(tf.global_variables_initializer())
          data = {x: data_tf, l: data_tf_len}
          ci.set_workdir(workdir)
          ci.set_data(sess, data)
          ci.fetch("birnn", save=True)
          ci.fetch("birnn_out", save=True)
          ci.reset()
          sess.close()
  
imports: import numpy
  from cntk.contrib import crosstalk
  import tempfile
label_desc: Use image node_id 2 for calling a global function with example usage: tf_baseline_lstm() without return types