recurrent-neural-network

Reuse Reusing Variable of LSTM in Tensorflow

£可爱£侵袭症+ 提交于 2019-12-01 12:02:16
I'm trying to make RNN using LSTM . I made LSTM model, and after it, there is two DNN network, and one regression output layer. I trained my data, and the final training loss become about 0.009 . However, when i applied the model to test data, the loss become about 0.5 . The 1th epoch training loss is about 0.5 . So, I think the trained variable do not used in test model. The only difference between training and test model is batch size. Trainning Batch = 100~200 , Test Batch Size = 1 . in main function i made LSTM instance. In LSTM innitializer, the model is made. def __init__(self,config

ValueError: The two structures don't have the same number of elements

会有一股神秘感。 提交于 2019-11-30 18:39:13
with tf.variable_scope('forward'): cell_img_fwd = tf.nn.rnn_cell.GRUCell(hidden_state_size, hidden_state_size) img_init_state_fwd = rnn_img_mapped[:, 0, :] img_init_state_fwd = tf.multiply( img_init_state_fwd, tf.zeros([batch_size, hidden_state_size])) rnn_outputs2, final_state2 = tf.nn.dynamic_rnn( cell_img_fwd, rnn_img_mapped, initial_state=img_init_state_fwd, dtype=tf.float32) This is my code for a GRU for input of dimension 100x196x50, it should be unpacked along the second dimension (that is 196). hidden_state_size is 50, batch_size is 100. However I get the following error: ValueError:

TensorFlow dynamic_rnn state

最后都变了- 提交于 2019-11-30 16:07:37
My question is about the TensorFlow method tf.nn.dynamic_rnn . It returns the output of every time step and the final state. I would like to know if the returned final state is the state of the cell at the maximum sequence length or if it is determined individually by the sequence_length argument. For better understanding an example: I have 3 sequences with length [10,20,30] and getting back the final state [3,512] (if the hidden state of the cell has the length 512). Are the three returned hidden states for the three sequences the state of the cell at time step 30 or am I getting back the

TensorFlow dynamic_rnn state

心不动则不痛 提交于 2019-11-30 16:03:12
问题 My question is about the TensorFlow method tf.nn.dynamic_rnn . It returns the output of every time step and the final state. I would like to know if the returned final state is the state of the cell at the maximum sequence length or if it is determined individually by the sequence_length argument. For better understanding an example: I have 3 sequences with length [10,20,30] and getting back the final state [3,512] (if the hidden state of the cell has the length 512). Are the three returned

LSTM Followed by Mean Pooling

我只是一个虾纸丫 提交于 2019-11-30 15:24:10
问题 I'm using Keras 1.0. My problem is identical to this one (How to implement a Mean Pooling layer in Keras), but the answer there does not seem to be sufficient for me. I want to implement this network: The following code does not work: sequence = Input(shape=(max_sent_len,), dtype='int32') embedded = Embedding(vocab_size, word_embedding_size)(sequence) lstm = LSTM(hidden_state_size, activation='sigmoid', inner_activation='hard_sigmoid', return_sequences=True)(embedded) pool = AveragePooling1D(

What is a “cell class” in Keras?

不羁的心 提交于 2019-11-30 12:46:04
Or, more specific: what is the difference between ConvLSTM2D and ConvLSTM2DCell ? What is the difference between SimpleRNN and SimpleRNNCell ? Same question for GRU and GRUCell Keras manuals are not very verbose here. I can see from RTFS (reading those fine sources) that these classes are descendants of different base classes. Those, with names, ending with Cell , are subclasses of Layer . In my task I need to classify video sequences. That is, my classifier's input is a sequence of video frames, and the output is a single label (one-hot encoded vector). What class should I use? The difference

Keras : How should I prepare input data for RNN?

£可爱£侵袭症+ 提交于 2019-11-30 10:49:56
问题 I'm having trouble with preparing input data for RNN on Keras. Currently, my training data dimension is: (6752, 600, 13) 6752: number of training data 600: number of time steps 13: size of feature vectors (the vector is in float) X_train and Y_train are both in this dimension. I want to prepare this data to be fed into SimpleRNN on Keras. Suppose that we're going through time steps, from step #0 to step #599. Let's say I want to use input_length = 5 , which means that I want to use recent 5

ValueError: Tensor must be from the same graph as Tensor with Bidirectinal RNN in Tensorflow

烂漫一生 提交于 2019-11-30 07:56:55
问题 I'm doing text tagger using Bidirectional dynamic RNN in tensorflow. After maching input's dimension, I tried to run a Session. this is blstm setting parts: fw_lstm_cell = BasicLSTMCell(LSTM_DIMS) bw_lstm_cell = BasicLSTMCell(LSTM_DIMS) (fw_outputs, bw_outputs), _ = bidirectional_dynamic_rnn(fw_lstm_cell, bw_lstm_cell, x_place, sequence_length=SEQLEN, dtype='float32') and this is runing part: with tf.Graph().as_default(): # Placehoder Settings x_place, y_place = set_placeholder(BATCH_SIZE, EM

Time Series Prediction via Neural Networks

倾然丶 夕夏残阳落幕 提交于 2019-11-30 06:18:48
问题 I have been working on Neural Networks for various purposes lately. I have had great success in digit recognition, XOR, and various other easy/hello world'ish applications. I would like to tackle the domain of time series estimation. I do not have a University account at the moment to read all the IEEE/ACM papers on the topic (for free), nor can I find many resources detailing using ANN for time series forcasting. I would like to know if anyone has any suggestions or can recommend any

What is num_units in tensorflow BasicLSTMCell?

梦想的初衷 提交于 2019-11-30 06:11:29
问题 In MNIST LSTM examples, I don't understand what "hidden layer" means. Is it the imaginary-layer formed when you represent an unrolled RNN over time? Why is the num_units = 128 in most cases ? I know I should read colah's blog in detail to understand this, but, before that, I just want to get some code working with a sample time series data I have. 回答1: The number of hidden units is a direct representation of the learning capacity of a neural network -- it reflects the number of learned