UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
145 Views
Registered: ‎08-04-2017

incompatible with expected float

Jump to solution

I am trying to quantize a MobileNetV2 model and I get the error below.  I have tried adding the following option to decent_q, but it has no effect.

--ignore_nodes 'MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1'

How do I fix this error?

 

Best Regards,
Joseph

 

(base) jchang@Joseph-Linux:~/envision/i2i/iconsoftware/FPGA$ source ./quant.sh | tee quant.log
#####################################
QUANTIZE
#####################################
2019-07-10 17:52:17.907889: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/add (op: Add, T: 3)
2019-07-10 17:52:17.907933: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/add_1 (op: Add, T: 3)
2019-07-10 17:52:17.907962: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/add_2 (op: Add, T: 3)
2019-07-10 17:52:17.907984: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/add (op: Add, T: 3)
2019-07-10 17:52:17.908006: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/add_1 (op: Add, T: 3)
2019-07-10 17:52:17.908027: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/add_2 (op: Add, T: 3)
2019-07-10 17:52:17.908055: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/add (op: Add, T: 3)
2019-07-10 17:52:17.908066: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/add_1 (op: Add, T: 3)
2019-07-10 17:52:17.908076: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:91] Found node with non-quantizable T: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/add_2 (op: Add, T: 3)
2019-07-10 17:52:17.909435: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1(Pack)
2019-07-10 17:52:17.909451: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/strided_slice/_0__cf__0(Const)
2019-07-10 17:52:17.909473: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/add(Add)
2019-07-10 17:52:17.909479: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/strided_slice_1/_1__cf__1(Const)
2019-07-10 17:52:17.909489: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_14/depthwise/depthwise/required_space_to_batch_paddings/mod_1(FloorMod)
2019-07-10 17:52:17.909514: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_15/depthwise/depthwise/stack_1(Pack)
2019-07-10 17:52:17.909521: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/strided_slice/_4__cf__4(Const)
2019-07-10 17:52:17.909532: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/add(Add)
2019-07-10 17:52:17.909537: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/strided_slice_1/_5__cf__5(Const)
2019-07-10 17:52:17.909555: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_15/depthwise/depthwise/required_space_to_batch_paddings/mod_1(FloorMod)
2019-07-10 17:52:17.909588: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_16/depthwise/depthwise/stack_1(Pack)
2019-07-10 17:52:17.909604: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/strided_slice/_8__cf__8(Const)
2019-07-10 17:52:17.909614: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/add(Add)
2019-07-10 17:52:17.909620: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/strided_slice_1/_9__cf__9(Const)
2019-07-10 17:52:17.909637: W tensorflow/contrib/decent_q/utils/graph_quantizer.cc:615] Found unquantized input node: MobilenetV2/expanded_conv_16/depthwise/depthwise/required_space_to_batch_paddings/mod_1(FloorMod)
Traceback (most recent call last):
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 418, in import_graph_def
    graph._c_graph, serialized, options)  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1/aquant was passed int32 from MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1:0 incompatible with expected float.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jchang/anaconda3/envs/decent_q3_copy/bin/decent_q", line 11, in <module>
    sys.exit(run_main())
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 565, in run_main
    app.run(main=my_main, argv=[sys.argv[0]] + unparsed)
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 564, in <lambda>
    my_main = lambda unused_args: main(unused_args, FLAGS)
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 357, in main
    s_config)
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 329, in quantize
    return quantize_with_config(input_graph_def, q_config, i_config, s_config)
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/contrib/decent_q/python/decent_q.py", line 204, in quantize_with_config
    tf.import_graph_def(calib_graph_def, name='')
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
    return func(*args, **kwargs)
  File "/home/jchang/anaconda3/envs/decent_q3_copy/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 422, in import_graph_def
    raise ValueError(str(e))
ValueError: Input 0 of node MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1/aquant was passed int32 from MobilenetV2/expanded_conv_14/depthwise/depthwise/stack_1:0 incompatible with expected float.
#####################################
QUANTIZATION COMPLETED
#####################################
0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
83 Views
Registered: ‎05-24-2019

Re: incompatible with expected float

Jump to solution

@jchang_endiagAhhh...you know, I should have noticed this before.  The operator that is causing the error looks to be a TF.stack operator which is not a supported operator for DNNDK.  I will follow-up with you via email....

--Quenton

4 Replies
Xilinx Employee
Xilinx Employee
141 Views
Registered: ‎05-24-2019

Re: incompatible with expected float

Jump to solution

@jchang_endiag @nwillard Hi Joseph,

I hope that all is well my friend.

This might not be the brightest answer you receive from someone here, but my first thought is to ask you if you see the same result if you quantize the Xilinx TF model.

https://www.xilinx.com/bin/public/openDownload?filename=tf_mobilenet_v2_20190528.zip

--Quenton

 

 

 

Adventurer
Adventurer
101 Views
Registered: ‎08-04-2017

Re: incompatible with expected float

Jump to solution

@quentonh,

It's good to hear from you.

Thanks for the suggestion.  I was able to quantize the Xilinx TF model you provided (see attached log).  Any other ideas?

Best Regards,

Joseph

0 Kudos
Xilinx Employee
Xilinx Employee
84 Views
Registered: ‎05-24-2019

Re: incompatible with expected float

Jump to solution

@jchang_endiagAhhh...you know, I should have noticed this before.  The operator that is causing the error looks to be a TF.stack operator which is not a supported operator for DNNDK.  I will follow-up with you via email....

--Quenton

Adventurer
Adventurer
72 Views
Registered: ‎08-04-2017

Re: incompatible with expected float

Jump to solution

Hi @quentonh,

We were able to solve the problem by specifying the input size when generating the frozen model.  We didn't understand why this fixed the problem before reading your reply.  Specifying the input size removes the TF.stack operator which allows decent_q to complete and generate quantized results.

Best Regards,

Joseph

0 Kudos