A Gated Recurrent Unit (GRU) is a type of unit in a recurrent neural network.
Questions tagged [gated-recurrent-unit]
80 questions
4
votes
2 answers
stock prediction : GRU model predicting same given values instead of future stock price
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…

Kartik Garasia
- 1,324
- 1
- 18
- 27
4
votes
1 answer
Tensorflow GRU cell error when fetching activations with variable sequence length
I want to run a GRU cell on some time series data to cluster them according to the activations in the last layer. I made one small change to the GRU cell implementation
def __call__(self, inputs, state, scope=None):
"""Gated recurrent unit (GRU)…

Ushnish
- 81
- 3
3
votes
1 answer
How to apply a different dense layer for each timestep in Keras
I know that applying a TimeDistributed(Dense()) applies the same dense layer over all the timesteps but I wanted to know how to apply different dense layers for each timestep. The number of timesteps is not variable.
P.S.: I have seen the following…

Atif Hassan
- 932
- 6
- 12
3
votes
1 answer
Keras GRUCell missing 1 required positional argument: 'states'
I try to build a 3-layer RNN with Keras. Part of the code is here:
model = Sequential()
model.add(Embedding(input_dim = 91, output_dim = 128, input_length =max_length))
model.add(GRUCell(units = self.neurons, dropout = self.dropval, …

beepretty
- 1,075
- 3
- 14
- 20
3
votes
1 answer
Converting sparse IndexedSlices to a dense Tensor
I got the following warning:
94: UserWarning: Converting sparse IndexedSlices to a dense Tensor with 1200012120 elements. This may consume a large amount of memory.
For the following code:
from wordbatch.extractors import WordSeq
import…

william007
- 17,375
- 25
- 118
- 194
3
votes
1 answer
Creating multi-layer recurrent neural network in tensorflow
I am trying to create a multi-layer recurrent neural network with GRU units (as well be LSTM units) in tensorflow. I have looked at multiple sources, including the official tutorial. But I keep seeing the following pattern for multi-layer RNNs…

pavan
- 41
- 1
- 6
3
votes
1 answer
GRU implementation in Theano
Based on the LSTM code provided in the official Theano tutorial (http://deeplearning.net/tutorial/code/lstm.py), I changed the LSTM layer code (i.e. the functions lstm_layer() and param_init_lstm()) to perform a GRU instead.
The provided LSTM code…

Franck Dernoncourt
- 77,520
- 72
- 342
- 501
2
votes
1 answer
How does calculation in a GRU layer take place
So I want to understand exactly how the outputs and hidden state of a GRU cell are calculated.
I obtained the pre-trained model from here and the GRU layer has been defined as nn.GRU(96, 96, bias=True).
I looked at the the PyTorch Documentation and…

void
- 23
- 4
2
votes
0 answers
Implementing custom GRU equations in keras
I have the above equation that I am trying to implement in my keras custom GRU cell. I have tried to look for online guides but didn't find anything useful. it's the first time for me to implement a custom GRU out of the existing one in keras.…

John C.
- 405
- 5
- 19
2
votes
2 answers
AttributeError: 'tuple' object has no attribute 'size'
UPDATE: after looking back on this question, most of the code was unnecessary. In summary, the hidden layer of a Pytorch RNN needs to be a torch tensor. When I posted the question, the hidden layer was a tuple.
Below is my data loader.
from…

Mattpats
- 414
- 2
- 9
- 21
2
votes
0 answers
Why does my function get good values for LSTM but not for GRU?
I'm trying to implement a program that compares LSTM's performance vs GRU's performance for word prediction. I am using the same parameters for both of them, however while I am getting good perplexity values for the LSTM, the GRU values I'm getting…

Guy
- 155
- 11
2
votes
2 answers
Input and hidden tensors are not at the same device, found input tensor at cuda:0 and hidden tensor at cpu
here is my code for lstm network, I instantiated it and passed to Cuda device but still getting the error that hidden and inputs are not in same device
class LSTM_net(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
…

ashwin
- 25
- 1
- 8
2
votes
1 answer
what is the inputs to a torch.nn.gru function in pytorch?
I am using a gru function to implement a RNN. This RNN (GRU) is used after some CNN layers. Can someone please tell me what is the input to a GRU function here? Especially, is the hidden size fixed?
self.gru = torch.nn.GRU(
…

tolearntoseek
- 55
- 1
- 5
2
votes
0 answers
How to freeze tensorflow variables inside tf.keras framework on eager execution mode?
I'm trying to fine tune the input weights in a recurrent cell without letting the backpropagation affect previous states (kind of truncated backpropagation with n = 1). I'm using tf.keras and eager execution in tensorflow.
I cannot find the way to…

Pablo Brusco
- 21
- 5
2
votes
0 answers
Stateful Recurrent Neural Networks with fit_generator()
Context
I read some blogs about the implementation of stateful recurrent neural networks in Keras (for example here and here).
There are also several questions regarding stateful RNNs on stackoverflow, whereby this question comes close to mine.
The…

Markus
- 2,265
- 5
- 28
- 54