title: Get output layer Tensorflow 1.14
body: <p>I want to create an multi-modal machine learning model using TLSTM for time-variant data.
  In order to concatinate time-variant with time-invariant data I need to get the output vector of the TLSTM.<br />
  I´m using this TLSTM Model: <a href="https://github.com/illidanlab/T-LSTM" rel="nofollow noreferrer">https://github.com/illidanlab/T-LSTM</a><br />
  I updated the repo to be compatible with Tensorflow 1.14 and Python 3.7.12.</p>
  <p>I assume you can exreact the output vector at the get_output function:</p>
  <pre><code>    def get_output(self, state):
          output = tf.nn.relu(tf.matmul(state, self.Wo) + self.bo)
          output = tf.nn.dropout(output, self.keep_prob)
          output = tf.matmul(output, self.W_softmax) + self.b_softmax
          return output
  </code></pre>
  <p>If I print the output I get an tensor:</p>
  <pre><code>output = tf.nn.relu(tf.matmul(state, self.Wo) + self.bo)
  print(output)
  -&gt; Tensor(&quot;map_5/while/Relu:0&quot;, shape=(?, 64), dtype=float32)
  print(output[0])
  -&gt; Tensor(&quot;map_5/while/strided_slice:0&quot;, shape=(64,), dtype=float32)
  print(output[0, 0])
  -&gt; Tensor(&quot;map_5/while/strided_slice_1:0&quot;, shape=(), dtype=float32)
  </code></pre>
  <p>The 64 dimension seems to be the output I´m looking for, how can I access it?</p>
  <p><strong>Solution: tf.print()</strong></p>
  <p>Note that inside of a session it must be called as control_dependence:</p>
  <pre><code>    def get_output(self, state):
          output = tf.nn.relu(tf.matmul(state, self.Wo) + self.bo)
          print_op = tf.print(
              output,
              summarize=-1,
              output_stream=&quot;file://C:/Users/my_path/T-LSTM-master/features/foo.out&quot;)
          with tf.control_dependencies([print_op]):
              output = tf.nn.dropout(output, self.keep_prob)
              output = tf.matmul(output, self.W_softmax) + self.b_softmax
              return output
  </code></pre>
  <p>This example directly saves the feature as a file. Summarize=-1 to save/print the entire tensor.</p>