Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "step" argument necessary when predicting using data tensors? what does this error mean?

I am trying to predict() the output for a single data point d, using my trained Keras model loaded from a file. But I get a ValueError If predicting from data tensors, you should specify the 'step' argument. What does that mean?

I tried setting step=1, but then I get a different error ValueError: Cannot feed value of shape () for Tensor u'input_1:0', which has shape '(?, 600)'.

Here is my code:

d = np.concatenate((hidden[p[i]], hidden[x[i]])).resize((1,600))
hidden[p[i]] = autoencoder.predict(d,steps=)

The model is expecting (?,600) as input. I have concatenated two numpy arrays of shape (300,) each to get (600,), which is resized to (1,600). This (1,600) is my input to predict().

like image 679
Jeena KK Avatar asked Feb 06 '19 06:02

Jeena KK


2 Answers

In my case, the input to predict was None (because I had a bug in another part of the code).

like image 70
nbro Avatar answered Sep 18 '22 22:09

nbro


-> Define value of steps argument,

d = np.concatenate((hidden[p[i]], 
hidden[x[i]])).resize((1,600))
hidden[p[i]] = autoencoder.predict(d,steps=1)
like image 39
darshakpranpariya Avatar answered Sep 20 '22 22:09

darshakpranpariya