sru icon indicating copy to clipboard operation
sru copied to clipboard

Nan in output from example code

Open hoagy-davis-digges opened this issue 2 years ago • 2 comments

I have run the example code in the readme on both 2.6.0 and 3.0.0-dev and both have nan values in both the output and state objects using pytorch 1.9, I've tried this on my computer using a Titan X and also with a fresh install on a cloud T4, this doesn't seem to relate to the other nan issue raised here https://github.com/asappresearch/sru/issues/185 because this problem appears immediately.

hoagy-davis-digges avatar Nov 02 '21 13:11 hoagy-davis-digges

hi @hoagy-davis-digges , did you mean you tried the following example and got NaN?

import torch
from sru import SRU, SRUCell

# input has length 20, batch size 32 and dimension 128
x = torch.FloatTensor(20, 32, 128).cuda()

input_size, hidden_size = 128, 128

rnn = SRU(input_size, hidden_size,
    num_layers = 2,          # number of stacking RNN layers
    dropout = 0.0,           # dropout applied between RNN layers
    bidirectional = False,   # bidirectional RNN
    layer_norm = False,      # apply layer normalization on the output of each layer
    highway_bias = -2,        # initial bias of highway gate (<= 0)
)
rnn.cuda()

output_states, c_states = rnn(x)      # forward pass

taolei87 avatar Nov 05 '21 21:11 taolei87

Exactly

hoagy-davis-digges avatar Nov 06 '21 11:11 hoagy-davis-digges

Same problem here.

xinyi-li7 avatar May 19 '22 02:05 xinyi-li7