Last active
February 26, 2019 08:39
-
-
Save hccho2/547c567ece72fe1a1e07ea7d520608b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import tensorflow as tf | |
import numpy as np | |
tf.reset_default_graph() | |
batch_size=2 | |
T=3 | |
input_dim=4 | |
hidden_dim=50 | |
#a = np.arange(batch_size*T*input_dim).reshape(batch_size,T,input_dim).astype(np.float32) | |
a=np.random.randn(batch_size,T,input_dim) | |
x = tf.convert_to_tensor(a,tf.float32) | |
cell = tf.contrib.rnn.GRUCell(num_units=hidden_dim) | |
initial_state = cell.zero_state(batch_size, tf.float32) | |
outputs, states = tf.nn.dynamic_rnn(cell,x,initial_state=initial_state,dtype=tf.float32) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment