Linked Questions

Popular Questions

Depthwise Conv Tensor Allocation Failure

Asked by At

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS Mojave Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A TensorFlow installed from (source or binary): binary TensorFlow version (use command below): 1.12 Python version: 3.6.4 Bazel version (if compiling from source): N/A GCC/Compiler version (if compiling from source): N/A CUDA/cuDNN version: N/A GPU model and memory: N/A Describe the current behavior

java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/contrib/lite/kernels/ NumDimensions(input) != 4 (0 != 4)Node number 0 (DEPTHWISE_CONV_2D) failed to prepare.

I construct the model with:

interpreter = Interpreter(loadModelFile("model.tflite"), object: Interpreter.Options() { override fun setAllowFp16PrecisionForFp32(allow: Boolean): Interpreter.Options { return super.setAllowFp16PrecisionForFp32(true) } override fun setUseNNAPI(useNNAPI: Boolean): Interpreter.Options { return super.setUseNNAPI(true) } })

and invoke it with:

imgData = ByteBuffer.allocateDirect(4 * 100 * 100).apply { order(nativeOrder()) }.asFloatBuffer() labelProbArray = IntArray(1), labelProbArray as Any)

Describe the expected behavior Expected behavior is that the byte buffer would be converted to tensors of float32 under the hood as per the placeholder op.

Related Questions