headlines icon indicating copy to clipboard operation
headlines copied to clipboard

beamsearch(): index 0 is out of bounds for axis 1 with size 0?

Open saitaiky opened this issue 7 years ago • 2 comments

The network can train smoothly by calling gensamples(batch_size=batch_size) , but I am just wodering why the function beamsearch() doesn't work when it is called from this line

gensamples(skips=2, batch_size=batch_size, k=10, temperature=1.)

def beamsearch(): ... cand_scores[:,empty] = 1e20 ...

The error is IndexError: index 0 is out of bounds for axis 1 with size 0. I am new in ML, could you please give me some advice to fix it? thank you

saitaiky avatar Mar 25 '17 17:03 saitaiky

are you using python3?

if so change the statement sample_lengths = map(len, samples) in keras_rnn_predict function as below: sample_lengths = list(map(len, samples))

imranshaikmuma avatar Jun 03 '17 22:06 imranshaikmuma

Thank you. This was helpful.

JC-B avatar Oct 08 '17 22:10 JC-B