In [1]:
import tensorflow as tf
import numpy as np
from tensorflow.contrib import rnn
sess = tf.InteractiveSession()

In [2]:
h = [1,0,0,0]
e = [0,1,0,0]
l = [0,0,1,0]
o = [0,0,0,1]

In [3]:
with tf.variable_scope("one_variable") as scope:
    
    hidden_size = 2
    cell = tf.contrib.rnn.BasicRNNCell(num_units = hidden_size)
    print(cell.output_size, cell.state_size)
    print(cell)
    x = np.array([[h, h],
                  [e, e],
                  [l, l],
                 ], dtype = np.float32)
    print(x)
    output, _state = tf.nn.dynamic_rnn(cell, x, dtype = tf.float32)
    sess.run(tf.global_variables_initializer())
    
    print(sess.run(output))
    print(sess.run(_state))


2 2
<tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicRNNCell object at 0x7fe9d1d76198>
[[[ 1.  0.  0.  0.]
  [ 1.  0.  0.  0.]
  [ 0.  1.  0.  0.]
  [ 0.  0.  1.  0.]
  [ 0.  0.  0.  1.]
  [ 0.  0.  0.  1.]]]
[[[-0.35967419 -0.37205574]
  [-0.53727889 -0.31120852]
  [-0.61436874  0.12294892]
  [-0.53126252 -0.64174759]
  [ 0.20022123 -0.4964678 ]
  [ 0.19977252 -0.51354784]]]
[[ 0.19977252 -0.51354784]]

In [ ]: