lstm

InvalidArgumentError in restore: Assign requires shapes of both tensors to match

我的梦境 提交于 2020-01-04 07:11:12
问题 First I would like to mention I am new to Tensorflow, I am working on OCR project using CTC ( Connectionist Temporal Classification ) and LSTM ( Long Short Term Memory ). I have done the training and when i am trying to restore session I found an error that is commonly posted on the internet but different analysis has been provided. Error is :- 2018-01-10 13:42:43.179534: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1),

Using Subtract layer in Keras

孤人 提交于 2020-01-02 15:54:56
问题 I'm implementing in Keras the LSTM architecture described here. I think I am really close, though I still have a problem with the combination of the shared and language-specific layers. Here is the formula (approximately): y = g * y^s + (1 - g) * y^u And here is the code I tried: ### Linear Layers ### univ_linear = Dense(50, activation=None, name='univ_linear') univ_linear_en = univ_linear(en_encoded) univ_linear_es = univ_linear(es_encoded) print(univ_linear_en) # Gate >> g gate_en = Dense

TensorFlow LSTM Generative Model

孤街醉人 提交于 2020-01-02 06:08:14
问题 I'm working off the LSTM language model tutorial discussed here. With language models, it's common to use the model to generate a new sentence from scratch after training (i.e. sample from the model). I'm new to TensorFlow but I'm trying to use my trained model to generate new words until the end-of-sentence marker. My initial attempt: x = tf.zeros_like(m.input_data) state = m.initial_state.eval() for step in xrange(m.num_steps): state = session.run(m.final_state, {m.input_data: x, m.initial

Why my LSTM model is repeating the previous values?

纵饮孤独 提交于 2020-01-02 05:33:10
问题 I build a simple LSTM model in Keras as below: model = Sequential() model.add(keras.layers.LSTM(hidden_nodes, input_dim=num_features, input_length=window, consume_less="mem")) model.add(keras.layers.Dense(num_features, activation='sigmoid')) optimizer = keras.optimizers.SGD(lr=learning_rate, decay=1e-6, momentum=0.9, nesterov=True) When I apply the model on some data I have this particular behaviour: Where the orange line represents the predicted values and the blue one the grand truth. As

Keras - Restore LSTM hidden state for a specific time stamp

萝らか妹 提交于 2020-01-01 19:34:49
问题 This question is in continue to (LSTM - Making predictions on partial sequence). As described in the previous question I've trained a stateful LSTM model for binary classification with batches of 100 samples/labels like so: [Feature 1,Feature 2, .... ,Feature 3][Label 1] [Feature 1,Feature 2, .... ,Feature 3][Label 2] ... [Feature 1,Feature 2, .... ,Feature 3][Label 100] Model Code: def build_model(num_samples, num_features, is_training): model = Sequential() opt = optimizers.Adam(lr=0.0005,

Tensorflow Grid LSTM RNN TypeError

倾然丶 夕夏残阳落幕 提交于 2020-01-01 18:16:31
问题 I'm trying to build a LSTM RNN that handles 3D data in Tensorflow. From this paper, Grid LSTM RNN's can be n-dimensional. The idea for my network is a have a 3D volume [depth, x, y] and the network should be [depth, x, y, n_hidden] where n_hidden is the number of LSTM cell recursive calls. The idea is that each pixel gets its own "string" of LSTM recursive calls. The output should be [depth, x, y, n_classes] . I'm doing a binary segmentation -- think foreground and background, so the number

How LSTM deal with variable length sequence

雨燕双飞 提交于 2020-01-01 12:16:12
问题 I found a piece of code in Chapter 7,Section 1 of deep Deep Learning with Python as follow: from keras.models import Model from keras import layers from keras import Input text_vocabulary_size = 10000 question_vocabulary_size = 10000 answer_vocabulary_size = 500 # Our text input is a variable-length sequence of integers. # Note that we can optionally name our inputs! text_input = Input(shape=(None,), dtype='int32', name='text') # Which we embed into a sequence of vectors of size 64 embedded

Batch-major vs time-major LSTM

倖福魔咒の 提交于 2020-01-01 05:01:28
问题 Do RNNs learn different dependency patterns when the input is batch-major as opposed to time-major? 回答1: (Edit: sorry my initial argument was why it makes sense but I realized that it doesn't so this is a little OT.) I haven't found the TF-groups reasoning behind this but it does does not make computational sense as ops are written in C++. Intuitively, we want to mash up (multiply/add etc) different features from the same sequence on the same timestep. Different timesteps can’t be done in

stock prediction : GRU model predicting same given values instead of future stock price

穿精又带淫゛_ 提交于 2019-12-31 03:06:10
问题 i was just testing this model from kaggle post this model suppose to predict 1 day ahead from given set of last stocks . After tweaking few parameters i got surprisingly good result, as you can see. mean squared error was 5.193.so overall it looks good at predicting future stocks right? well it turned out to be horrible when i take a look closely on the results. as you can see that this model is predicting last value of the given stocks which is our current last stock. so i did adjusted

Getting error while adding embedding layer to lstm autoencoder

江枫思渺然 提交于 2019-12-31 01:52:10
问题 I have a seq2seq model which is working fine. I want to add an embedding layer in this network which I faced with an error. this is my architecture using pretrained word embedding which is working fine(Actually the code is almost the same code available here, but I want to include the Embedding layer in the model rather than using the pretrained embedding vectors): LATENT_SIZE = 20 inputs = Input(shape=(SEQUENCE_LEN, EMBED_SIZE), name="input") encoded = Bidirectional(LSTM(LATENT_SIZE), merge