tensorflow: Unable to run model in iOS: dtype() == expected_dtype (9 vs. 4)

System information

  • iOS emulator
  • TensorFlow version v1.1.0rc2
  • compiler flag: -O3, -D__ANDROID_TYPES_SLIM__ replaced by -D__ANDROID_TYPES_FULL__ inside tensorflow/contrib/makefile/Makefile in order to fix a issue of missing kernel
  • modification made: tensorflow/core/kernels/cwise_op_floor_mod.cc added to tensorflow/contrib/makefile/tf_op_files.txt b/tensorflow/contrib/makefile/tf_op_files.txt in order to fix another issue of missing kernel

Describe the problem

I am trying to run the deeplab image segmentation on iOS. I have freezed the model, which can then be run on a python shell. But when I put it on to iOS, it crashes. Please see the log from xcode below. I am sure my build of tensorflow is working because I can run another model.

Source code / logs

The log comes from running a quantized model. running a non-quantized version lead to the same problem.

2017-05-11 18:57:16.053474: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 18:57:16.053595: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 18:57:16.053717: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 18:57:16.053830: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 18:57:16.053889: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2017-05-11 18:57:16.054 tf_ios_makefile_example[10355:45103643] Graph created.
[libprotobuf INFO google/protobuf/io/coded_stream.cc:610] Reading dangerously large protocol message.  If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons.  To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:81] The total number of bytes read was 45491214
2017-05-11 18:57:16.094 tf_ios_makefile_example[10355:45103643] Creating session.
2017-05-11 18:57:17.110386: F tensorflow/core/framework/tensor.cc:487] Check failed: dtype() == expected_dtype (9 vs. 4)

Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (17 by maintainers)

Most upvoted comments

types.pb.h enum DataType { DT_INVALID = 0, DT_FLOAT = 1, DT_DOUBLE = 2, DT_INT32 = 3, DT_UINT8 = 4, DT_INT16 = 5, DT_INT8 = 6, DT_STRING = 7, DT_COMPLEX64 = 8, DT_INT64 = 9,

it looks like a DT_INT64 and DT_UINT8 mismatch.

like this code: tensorflow::Tensor x(tensorflow::DT_FLOAT, tensorflow::TensorShape({ 1, 39, 2 })); auto input = x.tensor<double, 3>(); DT_FLOAT mismatch double <==> 1 vs. 2

the console log: 2017-11-10 15:22:10.168723: F tensorflow/core/framework/tensor.cc:487] Check failed: dtype() == expected_dtype (1 vs. 2)

Have the same issue with the NotEqual op on iOS. I manually registered it for float, int32 and int64

+REGISTER(BinaryOp, CPU, "NotEqual", functor::not_equal_to, float);
+REGISTER(BinaryOp, CPU, "NotEqual", functor::not_equal_to, int32);
+REGISTER(BinaryOp, CPU, "NotEqual", functor::not_equal_to, int64);

and this is what I get:

F tensorflow/core/framework/tensor.cc:622] Check failed: dtype() == expected_dtype (3 vs. 9)int64 expected, got int32