keras-js icon indicating copy to clipboard operation
keras-js copied to clipboard

Cannot read property 'tensor' of undefined

Open lemoustachiste opened this issue 6 years ago • 1 comments

Hi,

I've been struggling all morning with this issue, and I can't seem to figure out why it fails. I have a model of which the input is of Dense type. As I predict, I receive the error in the title, breaking on that line: https://github.com/transcranial/keras-js/blob/master/src/Model.js#L579

I looked in depth, I have 9 model layers defined, according to the original model I defined with the bin file. The last layer seems to be correctly set as the outputLayer.

If I inspect all my layers, only the first one (the input) has an output key. The rests do not, including obviously the outputLayer.

I am a bit at a loss here, since I have limited knowledge of ML in general and Keras in particular. Is there anything that has been done wrong in my initial definition of layers? Or something else that I'd be missing in a configuration?

Thanks for the help

lemoustachiste avatar Feb 02 '18 12:02 lemoustachiste

Maybe you run your prediction too early. You can bind "initProgress" event to see whether the model is initialized or not. If the model is not fully initialized, it would throw this error.

hepesu avatar Mar 26 '18 07:03 hepesu