Thanks for the code. Unfortunately, I cannot reproduce this issue using random input data, since the used file is undefined.
Are you only seeing the error using the weights loaded from the file or could you post an executable code snippet?