Questions tagged [lstm]

Long Short Term Memory. A neural network architecture that contains recurrent NN blocks that can remember a value for an arbitrary length of time. A very popular building block for deep NN.

0
votes
0answers
7 views

(hidden state) h0 and (cell state) c0 at t=0 for LSTM are all-zero? Do we update h0 and c0?

I am having trouble understanding the initialization of the hidden state (h0) and cell state (c0) for LSTM. I know we need to have the initialization for us to feed forward the calculation.I know we ...
0
votes
0answers
11 views

Estimator API: How to use stateful RNNs?

I am trying to the tensorflow Estimator-API (https://www.tensorflow.org/guide/estimators) for RNN based neural networks. A simple RNN would look something like this:lstm_cell=tf.nn.rnn_cell....
0
votes
0answers
22 views

How to dynamically gather from LSTM results in keras

I'm Ingoo Lee, studying bioinformatics.I wanna query from LSTM dinamically in batch but I don't know how to doLet's suppose that LSTM layer in keras which takes sequence of embeddings and returns ...
0
votes
0answers
16 views

Multiplying custom trainable parameter to hidden units

I want to take square of the difference between the tensors/output after the LSTM layer and multiply it with the trainable parameter.I saw this how could i get both the final hidden state and ...
-1
votes
0answers
15 views

How to implement ST + LSTM in TF?

I try to implement ST + LSTM in TF and 6 LSTMs have been instantiated. Obviously it's wrong.How to implement ST + LSTM as time-squence?
0
votes
0answers
10 views

tensorflow dynamic_rnn how to save and feed hidden states

I've got a tensorflow multiple layer rnn cell like this:def MakeLSTMCell(self):cells=[]for n in self.numUnits:cell=tf.nn.rnn_cell.LSTMCell(n)dropout=tf.nn.rnn_cell....
0
votes
0answers
23 views

ValueError: Operands could not be broadcast together with shapes (None, 128) (300,)

Whenever the encoder-decoder function is called, it produces an error in line after the flatten function in the Multiply function: ValueError: Operands could not be broadcast together with shapes (...
0
votes
1answer
25 views

TimeDistributed in Keras/Tensorflow

I am trying to implement a simple many to many LSTM for Sequence Prediction. The problem is very easy. The input is a sequence of 0s and 1s. The output at each time step is the count of ones in the ...
1
vote
0answers
21 views

Tensorflow sequence to sequence with LSTM

I am new to python. When I try to run the below program I get the following error.ValueError: Variable model/embedding/seq2seq/seq2seq_encode/rnn/multi_rnn_cell/cell_0/lstm_cell/kernel does not ...
-4
votes
1answer
23 views

My LSTM code give flat prediction and don't know what is wrong..Anyone can help take a look?

Here is the code. I think the class mylstm has problem but I can not find it... The input is simple, which is just 7 columns data.I tried to print out all the tensors but did not find what was wrong....
0
votes
0answers
16 views

Error when checking model input: the list of Numpy arrays that you are passing to your model Keras

I am writing a LSTM in keras that can detect how toxic are comments. I train my model on X. Operations that i did on X1.max_features=2000tokenizer=Tokenizer(num_words=max_features)tokenizer....
0
votes
1answer
13 views

Error when checking target: expected dense_2 to have 2 dimensions, but got array with shape (1, 1226, 2)

Here is the code that I am trying to run: y=Df[['label']]y_train=np.column_stack((y_train['label']))y_test=np.column_stack((y_test['label']))data_dim=18timesteps=1num_classes=2...
-2
votes
0answers
11 views

How implement attention layer in Keras?

I want to implement model in Python like in this article - https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1868-5. The main problem for me is that I don't now how build ...
0
votes
0answers
24 views

How to bundle nearby features inside keras model?

I have model with character embedding and word embedding pre-trained before model. The structure of model is below:# input and embeddings for characterschar_in=Input(shape=(50, 20,))emb_char=...
0
votes
0answers
13 views

Is it okay to RNN/LSTM/GRU has negative input

I was looking for an explanation in the web, but failed to find one. Let's talk about a specific time step of a RNN. Assume we have a negative input at that point say, x(t)=(-2,4,-4) and we also ...
1
vote
1answer
30 views

Slice a 3D tensor, based on the given sequence length array in tensorflow

I want a tensorflow function, which accepts a 3D matrix and an array ( shape of the array is similar to the first dimension of a 3D matrix ) and I want to slice the elements from each 2D matrix inside ...
2
votes
0answers
34 views

Complicated LSTM in Keras

I followed keras lstm examples and can understand those. I understand the single lstm layer networks. Now, I am trying to have something similar to the following,I am confused as to how to get the ...
0
votes
1answer
20 views

Error 'Input 0 is incompatible with layer conv1d_48: expected ndim=3, found ndim=2' when adding Conv1D layer

I am trying to construct the following model:model=Sequential()model.add(Embedding(input_dim=num_top_words, output_dim=64, input_length=input_length))model.add(LSTM(100, activation='relu'...
0
votes
2answers
39 views

Keras multi-step LSTM batch train classification at each step

QuestionHow to batch train a multi-step LSTM in Keras for single-label multi-class classificaiton, at each time-step for > 2 classes?Current ErrorEach target batch is a 3-dimensional array with ...
0
votes
1answer
21 views

“Merge” replacement Keras/Tensorflow/Python3

Merge is not running with Keras/Tensorflow/Python3 version. With previous versions, Merge was running.But now, it is not running. So I think I should convert this code with replacement "Merge". "...
1
vote
1answer
43 views

Keras fit model: TypeError: unhashable type: 'numpy.ndarray'

I implement following code. It successfully works in previous version of Keras:max_sequence=56input_dim=26 print("Build model..1")first_input=Input(shape=(max_sequence,input_dim))...
0
votes
1answer
12 views

Tensorflow RNN how to create zero state with various batch size?

In this question How do I set TensorFlow RNN state when state_is_tuple=True?: the accepted answer initialize the initial state like this:state_placeholder=tf.placeholder(tf.float32, [num_layers, 2,...
0
votes
0answers
16 views

How can I run pytorch bi-LSTM+CRF pytorch model on GPU?

I'm learning NN with pytorch. I want to run Pytorch Example on GPU. I've tried using .to(device) and .cuda. But it occurs error. Can anyone suggest me where should I change? I've separated model ...
0
votes
0answers
12 views

Keras layer for downside the time steps after masking

I face with a problem when conducting sequences of varied time steps using LSTM layer. I want to restore the original time-step for each sequence in my model which is like this:model=Sequential()...
1
vote
0answers
13 views

How to apply the dimension to tensorflow lstm cells?

I am a bit confused of how tensorflow lstm cells dimensions. Let's say I have this design:N number of sequences with the same length T.Each sequence is a series of 1-D array with length MThe ...
0
votes
0answers
20 views

keras GRU model “ You must feed a value for placeholder tensor”

I'm working with this model :def controller(Cin,Cout,Ein,Eout,batch=1,load=1):inc1=Input(batch_shape=(batch,Cin))h1=Reshape(target_shape=[1,Cin])(inc1)h1=GRU(activation='relu',units=8,...
0
votes
0answers
13 views

Window Rolling Aggregation for categorical Data

I have one column Dataframe of size 5 milliom rows. I want reduce it to 25k rows by aggregating each 200 rows into one (25k x 200=5 000 000 ). This row value should take to class label that is most ...
0
votes
0answers
18 views

Analyzing the keywords or the words that decides the sentence sentiment [closed]

Sentence: My mobile is best because it has large screen and good speakers. This sentence is a positive. I'm getting the sentiment of the sentence by using RNN and LSTM.But i want to know why that ...
0
votes
1answer
31 views

Keras Graph disconnects when combining a LSTM with a CNN

The idea is to train a CNN on a cosine similarity matrix of the hidden states of two bilstms. I try to get the following code working, but it is failing giving the error message:Graph disconnected: ...
0
votes
1answer
20 views

early stopping in lstm with Python

How to do early stopping in lstm.I am using python tensorflow but not keras.I would appreciate if you can provide a sample python code.Regards

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,