-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
We have ugly low-level exceptions from the TF Java API internals related to the appropriate tensor shape calculation. It makes the users crazy for not knowing what to do with it. I suggest adding early contracts via require/check in Kotlin to avoid TF exception and make the message to the user easy to read and understand and share some tips on how to fix the problem.
Exception in thread "main" java.lang.IllegalArgumentException: buffer with 10125000 elements is not compatible with a Tensor with shape [1, 224, 224, 3]
at org.tensorflow.Tensor.incompatibleBuffer(Tensor.java:580)
at org.tensorflow.Tensor.allocateForBuffer(Tensor.java:295)
at org.tensorflow.Tensor.create(Tensor.java:188)
at org.jetbrains.kotlinx.dl.api.core.GraphTrainableModel.internalPredict(GraphTrainableModel.kt:645)
at org.jetbrains.kotlinx.dl.api.core.GraphTrainableModel.predictSoftly(GraphTrainableModel.kt:624)
at org.jetbrains.kotlinx.dl.api.inference.InferenceModel.predictSoftly$default(InferenceModel.kt:36)
at org.jetbrains.kotlinx.dl.api.core.GraphTrainableModel.predict(GraphTrainableModel.kt:565)
at org.jetbrains.kotlinx.dl.api.inference.imagerecognition.ImageRecognitionModel.predictObject(ImageRecognitionModel.kt:92)
at resnet.Resnet50easyPrediction2Kt.resnet50easyPrediction2(resnet50easyPrediction2.kt:30)
at resnet.Resnet50easyPrediction2Kt.main(resnet50easyPrediction2.kt:40)
at resnet.Resnet50easyPrediction2Kt.main(resnet50easyPrediction2.kt)
Process finished with exit code 1
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers