<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>
<p dir="auto">Have I written custom code (as opposed to using a stock example script provided in TensorFlow):<br>
Yes I have written code which takes an image from a OpenFX framework and passes it as input to a Tensorflow session in C++, runs the feed forward and returns the result to a pixel buffer</p>
</li>
<li>
<p dir="auto">OS Platform and Distribution (e.g., Linux Ubuntu 16.04):<br>
Linux CentOS 6.10, using gcc/4.8.5 and bazel 0.11.0 with CUDA 9.1 and cuDNN 7.1.2</p>
</li>
<li>
<p dir="auto">Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:</p>
</li>
<li>
<p dir="auto">TensorFlow installed from (source or binary):<br>
from source v1.6.0 zip here:<br>
<a href="https://github.com/tensorflow/tensorflow/archive/v1.6.0.zip">https://github.com/tensorflow/tensorflow/archive/v1.6.0.zip</a></p>
</li>
<li>
<p dir="auto">TensorFlow version (use command below):<br>
NA</p>
</li>
<li>
<p dir="auto">Python version:<br>
2.7.13 NA</p>
</li>
<li>
<p dir="auto">Bazel version (if compiling from source):<br>
0.11.0</p>
</li>
<li>
<p dir="auto">GCC/Compiler version (if compiling from source):<br>
gcc 4.8.5</p>
</li>
<li>
<p dir="auto">CUDA/cuDNN version:<br>
CUDA 9.1 with 3 updates, cuDNN 7.1.3</p>
</li>
<li>
<p dir="auto">GPU model and memory:<br>
GTX 1060 6Gb</p>
</li>
</ul>
<p dir="auto">You can collect some of this information using our environment capture <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<br>
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"</p>
<p dir="auto"><strong>Describe the current behavior</strong><br>
the code will no longer compile when I moved to a machine with a GPU</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
  CXX      Linux-64-debug/rotobot.o
rotobot.cpp: In function ‘void drawMasks(OpenImageIO::v1_6::ImageBuf&amp;, std::unique_ptr&lt;tensorflow::Session&gt;&amp;, OpenImageIO::v1_6::ImageBuf&amp;, std::string&amp;, bool, const bool*, const bool*, const bool*, double, double, double, double, double, double, bool)’:
rotobot.cpp:435:68: error: ‘inputTensor2’ was not declared in this scope
  tensorflow::Status run_status = tfSession-&gt;Run({ { &quot;input_image&quot;, inputTensor2 },{ &quot;input_image_meta&quot;, inputMetadataTensor } },
                                                                    ^
rotobot.cpp:439:11: error: no matching function for call to ‘tensorflow::Session::Run(&lt;brace-enclosed initializer list&gt;, &lt;brace-enclosed initializer list&gt;, &lt;brace-enclosed initializer list&gt;, std::vector&lt;tensorflow::Tensor&gt;*)’
   &amp;outputs);
           ^
rotobot.cpp:439:11: note: candidates are:
In file included from rotobot.cpp:32:0:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:121:18: note: virtual tensorflow::Status tensorflow::Session::Run(const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;tensorflow::Tensor&gt;*)
   virtual Status Run(const std::vector&lt;std::pair&lt;string, Tensor&gt; &gt;&amp; inputs,
                  ^
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:121:18: note:   no known conversion for argument 1 from ‘&lt;brace-enclosed initializer list&gt;’ to ‘const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;’
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:150:18: note: virtual tensorflow::Status tensorflow::Session::Run(const tensorflow::RunOptions&amp;, const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;tensorflow::Tensor&gt;*, tensorflow::RunMetadata*)
   virtual Status Run(const RunOptions&amp; run_options,
                  ^
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:150:18: note:   candidate expects 6 arguments, 4 provided
In file included from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:23:0,
                 from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:24,
                 from rotobot.cpp:32:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long int&gt;’:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:566:46:   required from ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = long int; long unsigned int NDIMS = 3ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;long int, 3, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’
rotobot.cpp:1743:53:   required from here
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, &quot;Specified Data Type not supported&quot;);
   ^
In file included from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:24:0,
                 from rotobot.cpp:32:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h: In instantiation of ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = long int; long unsigned int NDIMS = 3ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;long int, 3, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’:
rotobot.cpp:1743:53:   required from here
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:566:46: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long int&gt;’
"><pre class="notranslate"><code class="notranslate">
  CXX      Linux-64-debug/rotobot.o
rotobot.cpp: In function ‘void drawMasks(OpenImageIO::v1_6::ImageBuf&amp;, std::unique_ptr&lt;tensorflow::Session&gt;&amp;, OpenImageIO::v1_6::ImageBuf&amp;, std::string&amp;, bool, const bool*, const bool*, const bool*, double, double, double, double, double, double, bool)’:
rotobot.cpp:435:68: error: ‘inputTensor2’ was not declared in this scope
  tensorflow::Status run_status = tfSession-&gt;Run({ { "input_image", inputTensor2 },{ "input_image_meta", inputMetadataTensor } },
                                                                    ^
rotobot.cpp:439:11: error: no matching function for call to ‘tensorflow::Session::Run(&lt;brace-enclosed initializer list&gt;, &lt;brace-enclosed initializer list&gt;, &lt;brace-enclosed initializer list&gt;, std::vector&lt;tensorflow::Tensor&gt;*)’
   &amp;outputs);
           ^
rotobot.cpp:439:11: note: candidates are:
In file included from rotobot.cpp:32:0:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:121:18: note: virtual tensorflow::Status tensorflow::Session::Run(const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;tensorflow::Tensor&gt;*)
   virtual Status Run(const std::vector&lt;std::pair&lt;string, Tensor&gt; &gt;&amp; inputs,
                  ^
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:121:18: note:   no known conversion for argument 1 from ‘&lt;brace-enclosed initializer list&gt;’ to ‘const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;’
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:150:18: note: virtual tensorflow::Status tensorflow::Session::Run(const tensorflow::RunOptions&amp;, const std::vector&lt;std::pair&lt;std::basic_string&lt;char&gt;, tensorflow::Tensor&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, const std::vector&lt;std::basic_string&lt;char&gt; &gt;&amp;, std::vector&lt;tensorflow::Tensor&gt;*, tensorflow::RunMetadata*)
   virtual Status Run(const RunOptions&amp; run_options,
                  ^
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:150:18: note:   candidate expects 6 arguments, 4 provided
In file included from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:23:0,
                 from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:24,
                 from rotobot.cpp:32:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long int&gt;’:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:566:46:   required from ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = long int; long unsigned int NDIMS = 3ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;long int, 3, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’
rotobot.cpp:1743:53:   required from here
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, "Specified Data Type not supported");
   ^
In file included from /home/sam/dev/tensorflow-1.6.0/tensorflow/core/public/session.h:24:0,
                 from rotobot.cpp:32:
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h: In instantiation of ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = long int; long unsigned int NDIMS = 3ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;long int, 3, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’:
rotobot.cpp:1743:53:   required from here
/home/sam/dev/tensorflow-1.6.0/tensorflow/core/framework/tensor.h:566:46: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long int&gt;’

</code></pre></div>
<p dir="auto"><strong>Describe the expected behavior</strong><br>
The code was compiling previously</p>
<p dir="auto">The previous build environment was v1.6.0.2-gcbc6580</p>
<p dir="auto">But was built without CUDA options.</p>
<p dir="auto">I am linking against<br>
<code class="notranslate"> -ltensorflow -ltensorflow_cc and -ltensorflow_framework -lnsync</code></p>
<p dir="auto">and a few more</p>
<p dir="auto">but I am not compiling yet.</p>
<p dir="auto">lines 31,32,33 respectively are:</p>
<p dir="auto">#include &lt;tensorflow/core/platform/init_main.h&gt;<br>
#include &lt;tensorflow/core/public/session.h&gt;<br>
#include &lt;tensorflow/core/framework/tensor_shape.h&gt;</p>
<p dir="auto"><strong>Code to reproduce the issue</strong><br>
Provide a reproducible test case that is the bare minimum necessary to generate the problem.</p>
<p dir="auto">lines 31,32,33 respectively are:</p>
<p dir="auto">#include &lt;tensorflow/core/platform/init_main.h&gt;<br>
#include &lt;tensorflow/core/public/session.h&gt;<br>
#include &lt;tensorflow/core/framework/tensor_shape.h&gt;</p>
<p dir="auto"><strong>Other info / logs</strong><br>
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.</p>
<p dir="auto">see:<br>
<a href="https://stackoverflow.com/questions/54033100/tensorflow-1-6-0-with-cuda-support-on-centos-6-10-c-linking-against-libtensorf" rel="nofollow">https://stackoverflow.com/questions/54033100/tensorflow-1-6-0-with-cuda-support-on-centos-6-10-c-linking-against-libtensorf</a></p>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: Yes</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Linux Mint 18.2 Sonya (based on Ubuntu 16.04)</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: Source</li>
<li><strong>TensorFlow version (use command below)</strong>: latest master (last commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tensorflow/tensorflow/commit/b2fe2a874bade4782aaca5c44bf29e7ff6c39200/hovercard" href="https://github.com/tensorflow/tensorflow/commit/b2fe2a874bade4782aaca5c44bf29e7ff6c39200"><tt>b2fe2a8</tt></a>)</li>
<li><strong>Python version</strong>: 3.5.2</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.15.0</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: 7.3.0</li>
<li><strong>CUDA/cuDNN version</strong>: 9.2/7.1</li>
<li><strong>GPU model and memory</strong>: GX1080Ti 11GB</li>
<li><strong>Exact command to reproduce</strong>: N/A</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">When writing a custom op and registering a kernel builder using <code class="notranslate">REGISTER_KERNEL_BUILDER</code>, specifying a type constraint of int64_t will fail on some machines. This also fails for unsigned types too (as you would expect).</p>
<p dir="auto">The problem occurs due to lines 381-403 in <code class="notranslate">tensorflow/core/framework/types.h</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="MATCH_TYPE_AND_ENUM(float, DT_FLOAT);
MATCH_TYPE_AND_ENUM(double, DT_DOUBLE);
MATCH_TYPE_AND_ENUM(int32, DT_INT32);
MATCH_TYPE_AND_ENUM(uint32, DT_UINT32);
MATCH_TYPE_AND_ENUM(uint16, DT_UINT16);
MATCH_TYPE_AND_ENUM(uint8, DT_UINT8);
MATCH_TYPE_AND_ENUM(int16, DT_INT16);
MATCH_TYPE_AND_ENUM(int8, DT_INT8);
MATCH_TYPE_AND_ENUM(string, DT_STRING);
MATCH_TYPE_AND_ENUM(complex64, DT_COMPLEX64);
MATCH_TYPE_AND_ENUM(complex128, DT_COMPLEX128);
MATCH_TYPE_AND_ENUM(int64, DT_INT64);
MATCH_TYPE_AND_ENUM(uint64, DT_UINT64);
MATCH_TYPE_AND_ENUM(bool, DT_BOOL);
MATCH_TYPE_AND_ENUM(qint8, DT_QINT8);
MATCH_TYPE_AND_ENUM(quint8, DT_QUINT8);
MATCH_TYPE_AND_ENUM(qint16, DT_QINT16);
MATCH_TYPE_AND_ENUM(quint16, DT_QUINT16);
MATCH_TYPE_AND_ENUM(qint32, DT_QINT32);
MATCH_TYPE_AND_ENUM(bfloat16, DT_BFLOAT16);
MATCH_TYPE_AND_ENUM(Eigen::half, DT_HALF);
MATCH_TYPE_AND_ENUM(ResourceHandle, DT_RESOURCE);
MATCH_TYPE_AND_ENUM(Variant, DT_VARIANT);"><pre class="notranslate"><code class="notranslate">MATCH_TYPE_AND_ENUM(float, DT_FLOAT);
MATCH_TYPE_AND_ENUM(double, DT_DOUBLE);
MATCH_TYPE_AND_ENUM(int32, DT_INT32);
MATCH_TYPE_AND_ENUM(uint32, DT_UINT32);
MATCH_TYPE_AND_ENUM(uint16, DT_UINT16);
MATCH_TYPE_AND_ENUM(uint8, DT_UINT8);
MATCH_TYPE_AND_ENUM(int16, DT_INT16);
MATCH_TYPE_AND_ENUM(int8, DT_INT8);
MATCH_TYPE_AND_ENUM(string, DT_STRING);
MATCH_TYPE_AND_ENUM(complex64, DT_COMPLEX64);
MATCH_TYPE_AND_ENUM(complex128, DT_COMPLEX128);
MATCH_TYPE_AND_ENUM(int64, DT_INT64);
MATCH_TYPE_AND_ENUM(uint64, DT_UINT64);
MATCH_TYPE_AND_ENUM(bool, DT_BOOL);
MATCH_TYPE_AND_ENUM(qint8, DT_QINT8);
MATCH_TYPE_AND_ENUM(quint8, DT_QUINT8);
MATCH_TYPE_AND_ENUM(qint16, DT_QINT16);
MATCH_TYPE_AND_ENUM(quint16, DT_QUINT16);
MATCH_TYPE_AND_ENUM(qint32, DT_QINT32);
MATCH_TYPE_AND_ENUM(bfloat16, DT_BFLOAT16);
MATCH_TYPE_AND_ENUM(Eigen::half, DT_HALF);
MATCH_TYPE_AND_ENUM(ResourceHandle, DT_RESOURCE);
MATCH_TYPE_AND_ENUM(Variant, DT_VARIANT);
</code></pre></div>
<p dir="auto">In this case, <code class="notranslate">int64</code> is being <code class="notranslate">typedef</code>'d to <code class="notranslate">long long</code> (<code class="notranslate">tensorflow/core/platform/default/integral_types.h</code>), however on some systems <code class="notranslate">int64_t</code> is <code class="notranslate">typedef</code>'d as <code class="notranslate">__int64</code> (or potentially some other variation that results in a 64-bit signed type). Because of this <code class="notranslate">int64_t != to int64</code> and the type constraint check fails.</p>
<p dir="auto">On my system in particular, this code</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &lt;cstdint&gt;
#include &lt;iostream&gt;

int main(void) {
    std::cout &lt;&lt; &quot;int64_t...............: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(int64_t).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(int64_t) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;long..................: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(long).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(long) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;long int..............: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(long int).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;long long int.........: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(long long int).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(long long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;long long.............: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(long long).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(long long) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;uint64_t..............: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(uint64_t).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(int64_t) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;unsigned long.........: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(unsigned long).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(unsigned long) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;unsigned long int.....: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(unsigned long int).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(unsigned long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;unsigned long long int: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(unsigned long long int).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(unsigned long long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;unsigned long long....: &quot;
              &lt;&lt; &quot;(&quot; &lt;&lt; typeid(unsigned long long).name() &lt;&lt; &quot;) &quot; &lt;&lt; sizeof(unsigned long long) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;long long == int64_t? &quot; &lt;&lt; (std::is_same&lt;long long, int64_t&gt;::value ? &quot;yes&quot; : &quot;no&quot;) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? &quot;
              &lt;&lt; ((sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value ? &quot;yes&quot; : &quot;no&quot;) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? &quot;
              &lt;&lt; ((sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value ? &quot;yes&quot; : &quot;no&quot;) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;unsigned long long == uint64_t? &quot;
              &lt;&lt; (std::is_same&lt;unsigned long long, uint64_t&gt;::value ? &quot;yes&quot; : &quot;no&quot;) &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? &quot;
              &lt;&lt; ((sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value ? &quot;yes&quot; : &quot;no&quot;)
              &lt;&lt; std::endl;
    std::cout &lt;&lt; &quot;(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? &quot;
              &lt;&lt; ((sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value ? &quot;yes&quot; : &quot;no&quot;) &lt;&lt; std::endl;
    return 0;
}
"><pre class="notranslate"><code class="notranslate">#include &lt;cstdint&gt;
#include &lt;iostream&gt;

int main(void) {
    std::cout &lt;&lt; "int64_t...............: "
              &lt;&lt; "(" &lt;&lt; typeid(int64_t).name() &lt;&lt; ") " &lt;&lt; sizeof(int64_t) &lt;&lt; std::endl;
    std::cout &lt;&lt; "long..................: "
              &lt;&lt; "(" &lt;&lt; typeid(long).name() &lt;&lt; ") " &lt;&lt; sizeof(long) &lt;&lt; std::endl;
    std::cout &lt;&lt; "long int..............: "
              &lt;&lt; "(" &lt;&lt; typeid(long int).name() &lt;&lt; ") " &lt;&lt; sizeof(long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; "long long int.........: "
              &lt;&lt; "(" &lt;&lt; typeid(long long int).name() &lt;&lt; ") " &lt;&lt; sizeof(long long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; "long long.............: "
              &lt;&lt; "(" &lt;&lt; typeid(long long).name() &lt;&lt; ") " &lt;&lt; sizeof(long long) &lt;&lt; std::endl;
    std::cout &lt;&lt; "uint64_t..............: "
              &lt;&lt; "(" &lt;&lt; typeid(uint64_t).name() &lt;&lt; ") " &lt;&lt; sizeof(int64_t) &lt;&lt; std::endl;
    std::cout &lt;&lt; "unsigned long.........: "
              &lt;&lt; "(" &lt;&lt; typeid(unsigned long).name() &lt;&lt; ") " &lt;&lt; sizeof(unsigned long) &lt;&lt; std::endl;
    std::cout &lt;&lt; "unsigned long int.....: "
              &lt;&lt; "(" &lt;&lt; typeid(unsigned long int).name() &lt;&lt; ") " &lt;&lt; sizeof(unsigned long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; "unsigned long long int: "
              &lt;&lt; "(" &lt;&lt; typeid(unsigned long long int).name() &lt;&lt; ") " &lt;&lt; sizeof(unsigned long long int) &lt;&lt; std::endl;
    std::cout &lt;&lt; "unsigned long long....: "
              &lt;&lt; "(" &lt;&lt; typeid(unsigned long long).name() &lt;&lt; ") " &lt;&lt; sizeof(unsigned long long) &lt;&lt; std::endl;
    std::cout &lt;&lt; "long long == int64_t? " &lt;&lt; (std::is_same&lt;long long, int64_t&gt;::value ? "yes" : "no") &lt;&lt; std::endl;
    std::cout &lt;&lt; "(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? "
              &lt;&lt; ((sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value ? "yes" : "no") &lt;&lt; std::endl;
    std::cout &lt;&lt; "(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? "
              &lt;&lt; ((sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value ? "yes" : "no") &lt;&lt; std::endl;
    std::cout &lt;&lt; "unsigned long long == uint64_t? "
              &lt;&lt; (std::is_same&lt;unsigned long long, uint64_t&gt;::value ? "yes" : "no") &lt;&lt; std::endl;
    std::cout &lt;&lt; "(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? "
              &lt;&lt; ((sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value ? "yes" : "no")
              &lt;&lt; std::endl;
    std::cout &lt;&lt; "(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? "
              &lt;&lt; ((sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value ? "yes" : "no") &lt;&lt; std::endl;
    return 0;
}

</code></pre></div>
<p dir="auto">produces this output</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="int64_t...............: (l) 8
long..................: (l) 8
long int..............: (l) 8
long long int.........: (x) 8
long long.............: (x) 8
uint64_t..............: (m) 8
unsigned long.........: (m) 8
unsigned long int.....: (m) 8
unsigned long long int: (y) 8
unsigned long long....: (y) 8
long long == int64_t? no
(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? yes
(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? yes
unsigned long long == uint64_t? no
(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? yes
(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? yes
"><pre class="notranslate"><code class="notranslate">int64_t...............: (l) 8
long..................: (l) 8
long int..............: (l) 8
long long int.........: (x) 8
long long.............: (x) 8
uint64_t..............: (m) 8
unsigned long.........: (m) 8
unsigned long int.....: (m) 8
unsigned long long int: (y) 8
unsigned long long....: (y) 8
long long == int64_t? no
(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? yes
(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? yes
unsigned long long == uint64_t? no
(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? yes
(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? yes

</code></pre></div>
<p dir="auto">On a system where the current type constraint check works, the same code outputs this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="int64_t...............: (x) 8
long..................: (l) 8
long int..............: (l) 8
long long int.........: (x) 8
long long.............: (x) 8
uint64_t..............: (y) 8
unsigned long.........: (m) 8
unsigned long int.....: (m) 8
unsigned long long int: (y) 8
unsigned long long....: (y) 8
long long == int64_t? yes
(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? yes
(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? yes
unsigned long long == uint64_t? yes
(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? yes
(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? yes"><pre class="notranslate"><code class="notranslate">int64_t...............: (x) 8
long..................: (l) 8
long int..............: (l) 8
long long int.........: (x) 8
long long.............: (x) 8
uint64_t..............: (y) 8
unsigned long.........: (m) 8
unsigned long int.....: (m) 8
unsigned long long int: (y) 8
unsigned long long....: (y) 8
long long == int64_t? yes
(sizeof(long long) == 8) &amp;&amp; std::is_signed&lt;long long&gt;::value? yes
(sizeof(int64_t) == 8) &amp;&amp; std::is_signed&lt;int64_t&gt;::value? yes
unsigned long long == uint64_t? yes
(sizeof(unsigned long long) == 8) &amp;&amp; !std::is_signed&lt;unsigned long long&gt;::value? yes
(sizeof(uint64_t) == 8) &amp;&amp; !std::is_signed&lt;uint64_t&gt;::value? yes
</code></pre></div>
<p dir="auto">Since using an <code class="notranslate">int64_t</code> should be supported (as it is equivalent to <code class="notranslate">long long</code>), I propose that the code be modified to either use the integral types defined in <code class="notranslate">cstdint</code> (<code class="notranslate">int8_t</code>, <code class="notranslate">int16_t</code>, <code class="notranslate">int32_t</code>, <code class="notranslate">int64_t</code>), or the check should be changed to look for a 64-bit type that is signed using a combination of <code class="notranslate">sizeof</code> and <code class="notranslate">std::is_signed</code></p>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">The following example produces the error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#include &lt;tensorflow/core/framework/op.h&gt;
#include &lt;tensorflow/core/framework/op_kernel.h&gt;

REGISTER_OP(&quot;ExampleOp&quot;).Attr(&quot;T: {int32, int64, uint32, uint64}&quot;);

template &lt;typename T&gt;
class ExampleOp : public tensorflow::OpKernel {
public:
  explicit ExampleOp(tensorflow::OpKernelConstruction* context) : OpKernel(context) {}

  void Compute(tensorflow::OpKernelContext* context) override {}
};

REGISTER_KERNEL_BUILDER(Name(&quot;ExampleOp&quot;).Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;int32_t&gt;(&quot;T&quot;), ExampleOp&lt;int32_t&gt;);
REGISTER_KERNEL_BUILDER(Name(&quot;ExampleOp&quot;).Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;int64_t&gt;(&quot;T&quot;), ExampleOp&lt;int64_t&gt;);
REGISTER_KERNEL_BUILDER(Name(&quot;ExampleOp&quot;).Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;uint32_t&gt;(&quot;T&quot;), ExampleOp&lt;uint32_t&gt;);
REGISTER_KERNEL_BUILDER(Name(&quot;ExampleOp&quot;).Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;uint64_t&gt;(&quot;T&quot;), ExampleOp&lt;uint64_t&gt;);"><pre class="notranslate"><code class="notranslate">#include &lt;tensorflow/core/framework/op.h&gt;
#include &lt;tensorflow/core/framework/op_kernel.h&gt;

REGISTER_OP("ExampleOp").Attr("T: {int32, int64, uint32, uint64}");

template &lt;typename T&gt;
class ExampleOp : public tensorflow::OpKernel {
public:
  explicit ExampleOp(tensorflow::OpKernelConstruction* context) : OpKernel(context) {}

  void Compute(tensorflow::OpKernelContext* context) override {}
};

REGISTER_KERNEL_BUILDER(Name("ExampleOp").Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;int32_t&gt;("T"), ExampleOp&lt;int32_t&gt;);
REGISTER_KERNEL_BUILDER(Name("ExampleOp").Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;int64_t&gt;("T"), ExampleOp&lt;int64_t&gt;);
REGISTER_KERNEL_BUILDER(Name("ExampleOp").Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;uint32_t&gt;("T"), ExampleOp&lt;uint32_t&gt;);
REGISTER_KERNEL_BUILDER(Name("ExampleOp").Device(tensorflow::DEVICE_CPU).TypeConstraint&lt;uint64_t&gt;("T"), ExampleOp&lt;uint64_t&gt;);
</code></pre></div>
<p dir="auto">Here is the resulting compilation log</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/usr/bin/c++  -Dmwe_EXPORTS -isystem /usr/local/lib/python3.5/dist-packages/tensorflow/include -I../src -march=native -mtune=native -fPIC -O3 -DNDEBUG -fPIC   -march=native -mtune=native -MD -MT CMakeFiles/mwe.dir/mwe.cpp.o -MF CMakeFiles/mwe.dir/mwe.cpp.o.d -o CMakeFiles/mwe.dir/mwe.cpp.o -c ../mwe.cpp
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/tensor.h:23:0,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/device_base.h:23,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:26,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long int&gt;’:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62:   required from ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long int]’
../mwe.cpp:16:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, &quot;Specified Data Type not supported&quot;);
   ^~~~~~~~~~~~~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:28:0,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h: In instantiation of ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long int]’:
../mwe.cpp:16:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long int&gt;’
   return this-&gt;TypeConstraint(attr_name, DataTypeToEnum&lt;T&gt;::v());
                                          ~~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/tensor.h:23:0,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/device_base.h:23,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:26,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long unsigned int&gt;’:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62:   required from ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long unsigned int]’
../mwe.cpp:20:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, &quot;Specified Data Type not supported&quot;);
   ^~~~~~~~~~~~~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:28:0,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h: In instantiation of ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long unsigned int]’:
../mwe.cpp:20:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long unsigned int&gt;’
   return this-&gt;TypeConstraint(attr_name, DataTypeToEnum&lt;T&gt;::v());
                                          ~~~~~~~~~~~~~~~~~~~~^~"><pre class="notranslate"><code class="notranslate">/usr/bin/c++  -Dmwe_EXPORTS -isystem /usr/local/lib/python3.5/dist-packages/tensorflow/include -I../src -march=native -mtune=native -fPIC -O3 -DNDEBUG -fPIC   -march=native -mtune=native -MD -MT CMakeFiles/mwe.dir/mwe.cpp.o -MF CMakeFiles/mwe.dir/mwe.cpp.o.d -o CMakeFiles/mwe.dir/mwe.cpp.o -c ../mwe.cpp
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/tensor.h:23:0,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/device_base.h:23,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:26,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long int&gt;’:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62:   required from ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long int]’
../mwe.cpp:16:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, "Specified Data Type not supported");
   ^~~~~~~~~~~~~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:28:0,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h: In instantiation of ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long int]’:
../mwe.cpp:16:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long int&gt;’
   return this-&gt;TypeConstraint(attr_name, DataTypeToEnum&lt;T&gt;::v());
                                          ~~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/tensor.h:23:0,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/device_base.h:23,
                 from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:26,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;long unsigned int&gt;’:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62:   required from ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long unsigned int]’
../mwe.cpp:20:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/types.h:356:3: error: static assertion failed: Specified Data Type not supported
   static_assert(IsValidDataType&lt;T&gt;::value, "Specified Data Type not supported");
   ^~~~~~~~~~~~~
In file included from /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/op_kernel.h:28:0,
                 from ../mwe.cpp:2:
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h: In instantiation of ‘tensorflow::KernelDefBuilder&amp; tensorflow::KernelDefBuilder::TypeConstraint(const char*) [with T = long unsigned int]’:
../mwe.cpp:20:1:   required from here
/usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/core/framework/kernel_def_builder.h:82:62: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;long unsigned int&gt;’
   return this-&gt;TypeConstraint(attr_name, DataTypeToEnum&lt;T&gt;::v());
                                          ~~~~~~~~~~~~~~~~~~~~^~
</code></pre></div>
<p dir="auto">EDIT: Added a minimal working example</p>