Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_dir = "parallel_win_10_40_conv_3l_rnn"
- input_file = "parallel_win_10_40_conv_3l_rnn"
- saver = tf.train.import_meta_graph("./result/cnn_rnn_parallel/tune_rnn_layer/"+input_dir+"/model_"+input_file+".meta")
- # # Method 1
- # all_placeholders = [x for x in tf.get_default_graph().get_operations() if x.type == "Placeholder"]
- # cnn_in, rnn_in, Y = all_placeholders[0], all_placeholders[1], all_placeholders[2]
- # keep_prob, phase_train = all_placeholders[3], all_placeholders[4]
- # Method 2
- cnn_in = tf.placeholder(tf.float32, shape=[None, input_height, input_width, input_channel_num], name='cnn_in')
- rnn_in = tf.placeholder(tf.float32, shape=[None, n_time_step, n_input_ele], name='rnn_in')
- Y = tf.placeholder(tf.float32, shape=[None, n_labels], name = 'Y')
- keep_prob = tf.placeholder(tf.float32, name='keep_prob')
- phase_train = tf.placeholder(tf.bool, name='phase_train')
- with tf.Session() as session:
- saver.restore(session, "./result/cnn_rnn_parallel/tune_rnn_layer/"+input_dir+"/model_"+input_file)
- test_cnn_batch = np.zeros(shape=[accuracy_batch_size], dtype=float)
- test_rnn_batch = np.zeros(shape=[accuracy_batch_size], dtype=float)
- offset = (accuracy_batch_size) % (test_y.shape[0] - accuracy_batch_size)
- test_cnn_batch = cnn_test_x[offset:(offset + accuracy_batch_size), :, :, :, :]
- test_cnn_batch = test_cnn_batch.reshape(len(test_cnn_batch) * window_size, input_height, input_width, 1)
- test_rnn_batch = rnn_test_x[offset:(offset + accuracy_batch_size), :, :]
- test_batch_y = test_y[offset:(offset + accuracy_batch_size), :]
- print(session.run('fin_m:0', feed_dict={cnn_in: test_cnn_batch, rnn_in: test_rnn_batch,
- Y: test_batch_y, keep_prob: 1.0, phase_train: False}))
Add Comment
Please, Sign In to add comment