In [2]:
import tensorflow as tf
In [3]:
import numpy as np
In [7]:
n_neurons = 5
In [8]:
n_steps = 5
In [10]:
n_inputs = 3
In [11]:
X = tf.placeholder(tf.float32, [None, n_steps, n_inputs])
In [12]:
X_seqs = tf.unpack(tf.transpose(X, perm = [1, 0, 2]))
In [13]:
with tf.variable_scope('s1'):
cell1 = tf.nn.rnn_cell.BasicRNNCell(num_units = n_neurons)
output_seqs, states = tf.nn.rnn(cell1, X_seqs, dtype=tf.float32)
outputs = tf.transpose(tf.pack(output_seqs), perm = [1, 0, 2])
In [ ]:
X_batch = np.array([
# t = 0 t = 1
[[0, 1, 2], [9, 8, 7]], # instance 0
[[3, 4, 5], [0, 0, 0]], # instance 1
])