<p dir="auto"><em>Please make sure that this is a feature request. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>TensorFlow version (you are using):1.12.0</li>
<li>Are you willing to contribute it (Yes/No):Yes</li>
</ul>
<p dir="auto"><strong>Describe the feature and the current behavior/state.</strong><br>
Deformable Convolutional Network(<a href="https://arxiv.org/pdf/1703.06211.pdf,https://arxiv.org/pdf/1703.06211.pdf" rel="nofollow">https://arxiv.org/pdf/1703.06211.pdf,https://arxiv.org/pdf/1703.06211.pdf</a>) has achieved good results in the du detection task.But the current version of Tensorflow (1.12)does not seem to implement deformable convolution operations.The efficiency of some third-party implementations of deformable convolution operations is lower than that of the mxnet version(<a href="https://github.com/msracver/Deformable-ConvNets).I">https://github.com/msracver/Deformable-ConvNets).I</a> hope that Tensorflow can add native deformable convolution operations in future versions.<br>
Thanks.<br>
<strong>Will this change the current api? How?</strong><br>
Yes,Add a new API<br>
<strong>Who will benefit with this feature?</strong><br>
Anyone who wants to use Tensorflow for object detection</p>
<p dir="auto"><strong>Any Other info.</strong><br>
N/A</p>
<p dir="auto"><em>Please make sure that this is a bug. As per our <a href="https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md">GitHub Policy</a>, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No</li>
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS 7</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No</li>
<li>TensorFlow installed from (source or binary): source with tag v1.13.2</li>
<li>TensorFlow version (use command below): b'v1.13.2-0-g04256c89d8' 1.13.2</li>
<li>Python version:3.6.5</li>
<li>Bazel version (if compiling from source): 0.20.0</li>
<li>GCC/Compiler version (if compiling from source): 4.9.2</li>
<li>CUDA/cuDNN version: N/A</li>
<li>GPU model and memory: N/A</li>
</ul>
<p dir="auto">You can collect some of this information using our environment capture<br>
<a href="https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh">script</a><br>
You can also obtain the TensorFlow version with: 1. TF 1.0: <code class="notranslate">python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"</code> 2. TF 2.0: <code class="notranslate">python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"</code></p>
<p dir="auto"><strong>Describe the current behavior</strong><br>
The following error happened when I was convert my model to tf.lite. It's quite similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="393705009" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/24525" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/24525/hovercard" href="https://github.com/tensorflow/tensorflow/issues/24525">#24525</a> .</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;tfconvert.py&quot;, line 18, in &lt;module&gt;
    tflite_quantized_model = converter.convert()
  File &quot;/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/lite.py&quot;, line 455, in convert
    **converter_kwargs)
  File &quot;/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/convert.py&quot;, line 442, in toco_convert_impl
    input_data.SerializeToString())
  File &quot;/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/convert.py&quot;, line 205, in toco_convert_protos
    &quot;TOCO failed. See console for info.\n%s\n%s\n&quot; % (stdout, stderr))
tensorflow.lite.python.convert.ConverterError: TOCO failed. See console for info.
2019-10-10 10:12:14.730948: F tensorflow/core/framework/function.cc:1626] Check failed: GetOpGradFactory()-&gt;insert({op, func}).second Duplicated gradient for MapAccumulate"><pre class="notranslate"><span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"tfconvert.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">18</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">tflite_quantized_model</span> <span class="pl-c1">=</span> <span class="pl-s1">converter</span>.<span class="pl-en">convert</span>()
  <span class="pl-v">File</span> <span class="pl-s">"/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/lite.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">455</span>, <span class="pl-s1">in</span> <span class="pl-s1">convert</span>
    <span class="pl-c1">**</span><span class="pl-s1">converter_kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/convert.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">442</span>, <span class="pl-s1">in</span> <span class="pl-s1">toco_convert_impl</span>
    <span class="pl-s1">input_data</span>.<span class="pl-v">SerializeToString</span>())
  <span class="pl-v">File</span> <span class="pl-s">"/home/user/.local/lib/python3.6/site-packages/tensorflow/lite/python/convert.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">205</span>, <span class="pl-s1">in</span> <span class="pl-s1">toco_convert_protos</span>
    <span class="pl-s">"TOCO failed. See console for info.<span class="pl-cce">\n</span>%s<span class="pl-cce">\n</span>%s<span class="pl-cce">\n</span>"</span> <span class="pl-c1">%</span> (<span class="pl-s1">stdout</span>, <span class="pl-s1">stderr</span>))
<span class="pl-s1">tensorflow</span>.<span class="pl-s1">lite</span>.<span class="pl-s1">python</span>.<span class="pl-s1">convert</span>.<span class="pl-v">ConverterError</span>: <span class="pl-v">TOCO</span> <span class="pl-s1">failed</span>. <span class="pl-v">See</span> <span class="pl-s1">console</span> <span class="pl-k">for</span> <span class="pl-s1">info</span>.
<span class="pl-c1">2019</span><span class="pl-c1">-</span><span class="pl-c1">10</span><span class="pl-c1">-</span><span class="pl-c1">10</span> <span class="pl-c1">10</span>:<span class="pl-c1">12</span>:<span class="pl-c1">14.730948</span>: <span class="pl-v">F</span> <span class="pl-s1">tensorflow</span><span class="pl-c1">/</span><span class="pl-s1">core</span><span class="pl-c1">/</span><span class="pl-s1">framework</span><span class="pl-c1">/</span><span class="pl-s1">function</span>.<span class="pl-s1">cc</span>:<span class="pl-c1">1626</span>] <span class="pl-v">Check</span> <span class="pl-s1">failed</span>: <span class="pl-v">GetOpGradFactory</span>()<span class="pl-c1">-</span><span class="pl-c1">&gt;</span><span class="pl-en">insert</span>({<span class="pl-s1">op</span>, <span class="pl-s1">func</span>}).<span class="pl-s1">second</span> <span class="pl-v">Duplicated</span> <span class="pl-s1">gradient</span> <span class="pl-s1">for</span> <span class="pl-v">MapAccumulate</span></pre></div>
<p dir="auto"><strong>Code to reproduce the issue</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="converter = tf.lite.TFLiteConverter.from_saved_model(
    model_path, input_arrays=input_arrays, output_arrays=output_arrays, input_shapes=input_shapes)
converter.post_training_quantize=True
converter.target_ops = [
    # tf.lite.OpsSet.TFLITE_BUILTINS,
    tf.lite.OpsSet.SELECT_TF_OPS
]
tflite_quantized_model = converter.convert()
open(&quot;quantized_model.tflite&quot;, &quot;wb&quot;).write(tflite_quantized_model)"><pre class="notranslate"><span class="pl-s1">converter</span> <span class="pl-c1">=</span> <span class="pl-s1">tf</span>.<span class="pl-s1">lite</span>.<span class="pl-v">TFLiteConverter</span>.<span class="pl-en">from_saved_model</span>(
    <span class="pl-s1">model_path</span>, <span class="pl-s1">input_arrays</span><span class="pl-c1">=</span><span class="pl-s1">input_arrays</span>, <span class="pl-s1">output_arrays</span><span class="pl-c1">=</span><span class="pl-s1">output_arrays</span>, <span class="pl-s1">input_shapes</span><span class="pl-c1">=</span><span class="pl-s1">input_shapes</span>)
<span class="pl-s1">converter</span>.<span class="pl-s1">post_training_quantize</span><span class="pl-c1">=</span><span class="pl-c1">True</span>
<span class="pl-s1">converter</span>.<span class="pl-s1">target_ops</span> <span class="pl-c1">=</span> [
    <span class="pl-c"># tf.lite.OpsSet.TFLITE_BUILTINS,</span>
    <span class="pl-s1">tf</span>.<span class="pl-s1">lite</span>.<span class="pl-v">OpsSet</span>.<span class="pl-v">SELECT_TF_OPS</span>
]
<span class="pl-s1">tflite_quantized_model</span> <span class="pl-c1">=</span> <span class="pl-s1">converter</span>.<span class="pl-en">convert</span>()
<span class="pl-en">open</span>(<span class="pl-s">"quantized_model.tflite"</span>, <span class="pl-s">"wb"</span>).<span class="pl-en">write</span>(<span class="pl-s1">tflite_quantized_model</span>)</pre></div>
<p dir="auto">Any help will be appreciated! Thanks in advance.</p>