<p dir="auto">when I run :<br>
<code class="notranslate">bazel build --config=opt --config=cuda --verbose_failures //tensorflow/tools/pip_package:build_pip_package</code></p>
<p dir="auto">INFO: Found 1 target...<br>
ERROR: /home/qs/.cache/bazel/<em>bazel_qs/081cd1dbca77dcff65c775e7e860e873/external/farmhash_archive/BUILD.bazel:12:1: C++ compilation of rule '@farmhash_archive//:farmhash' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command<br>
(cd /home/qs/.cache/bazel/<em>bazel_qs/081cd1dbca77dcff65c775e7e860e873/execroot/tensorflow &amp;&amp; <br>
exec env - <br>
LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64/:/usr/lib32/:/usr/lib/x86_64-linux-gnu/::/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64 <br>
PATH=/bin:/usr/bin:/home/qs/mysoft/jdk1.8/bin <br>
external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -g0 '-std=c++11' -MD -MF bazel-out/host/bin/external/farmhash_archive/<em>objs/farmhash/external/farmhash_archive/src/farmhash.d '-frandom-seed=bazel-out/host/bin/external/farmhash_archive/<em>objs/farmhash/external/farmhash_archive/src/farmhash.o' -iquote external/farmhash_archive -iquote bazel-out/host/genfiles/external/farmhash_archive -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -isystem external/farmhash_archive/src -isystem bazel-out/host/genfiles/external/farmhash_archive/src -isystem external/bazel_tools/tools/cpp/gcc3 -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE</em></em>="redacted"' '-D__TIMESTAMP</em></em>="redacted"' '-D__TIME__="redacted"' -fno-canonical-system-headers -c external/farmhash_archive/src/farmhash.cc -o bazel-out/host/bin/external/farmhash_archive/_objs/farmhash/external/farmhash_archive/src/farmhash.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.<br>
gcc: error: unrecognized command line option '-fno-canonical-system-headers'<br>
Target //tensorflow/tools/pip_package:build_pip_package failed to build<br>
INFO: Elapsed time: 1.003s, Critical Path: 0.49s</p>
<p dir="auto">How to solve this problem?</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): macOS 10.13.6</li>
<li>TensorFlow installed from (source or binary): from pip install</li>
<li>TensorFlow version (use command below): v2.0.0-beta0-16-g1d91213fe7 2.0.0-beta1</li>
<li>Python version: v3.6.7:6ec5cf24b7, Oct 20 2018, 03:02:14</li>
</ul>
<p dir="auto"><strong>Describe the current behavior</strong></p>
<p dir="auto">Assume that I have already made a previous call of <code class="notranslate">tf.concat</code>. When calling again <code class="notranslate">tf.concat</code> with a <code class="notranslate">values</code> argument which is either a list of <code class="notranslate">Tensor</code> objects of length 1 or a single <code class="notranslate">Tensor</code> object, I get the following error:</p>
<p dir="auto"><code class="notranslate">Duplicate node name in graph: 'concat'</code></p>
<p dir="auto">It seems to be a naming conflict.</p>
<p dir="auto"><strong>Describe the expected behavior</strong></p>
<p dir="auto">From <a href="https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/concat?hl=en" rel="nofollow">tf.concat documentation</a>:</p>
<blockquote>
<p dir="auto"><code class="notranslate">values</code>: A list of <code class="notranslate">Tensor</code> objects or a single <code class="notranslate">Tensor</code>.</p>
</blockquote>
<p dir="auto"><code class="notranslate">tf.concat</code> should not throw an error when <code class="notranslate">values</code> is a list of length 1 or a single <code class="notranslate">Tensor</code> object and no naming conflict should rise.</p>
<p dir="auto"><strong>Code to reproduce the issue</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import tensorflow as tf
from tensorflow.keras import Input


print('Using Tensorflow version {} (git version {})'.format(tf.version.VERSION, tf.version.GIT_VERSION))

i = Input(shape=3)
j = Input(shape=4)
try:
    print(tf.concat([i, j], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat([i, j], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat([i], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat(i, axis=-1))
except Exception as e:
    print(type(e))
    print(e)"><pre class="notranslate"><code class="notranslate">import tensorflow as tf
from tensorflow.keras import Input


print('Using Tensorflow version {} (git version {})'.format(tf.version.VERSION, tf.version.GIT_VERSION))

i = Input(shape=3)
j = Input(shape=4)
try:
    print(tf.concat([i, j], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat([i, j], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat([i], axis=-1))
except Exception as e:
    print(type(e))
    print(e)
try:
    print(tf.concat(i, axis=-1))
except Exception as e:
    print(type(e))
    print(e)
</code></pre></div>
<p dir="auto">which outputs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Using Tensorflow version 2.0.0-beta1 (git version v2.0.0-beta0-16-g1d91213fe7)
Tensor(&quot;concat:0&quot;, shape=(None, 7), dtype=float32)
Tensor(&quot;concat_1:0&quot;, shape=(None, 7), dtype=float32)
&lt;class 'ValueError'&gt;
Duplicate node name in graph: 'concat'
&lt;class 'ValueError'&gt;
Duplicate node name in graph: 'concat'"><pre class="notranslate"><code class="notranslate">Using Tensorflow version 2.0.0-beta1 (git version v2.0.0-beta0-16-g1d91213fe7)
Tensor("concat:0", shape=(None, 7), dtype=float32)
Tensor("concat_1:0", shape=(None, 7), dtype=float32)
&lt;class 'ValueError'&gt;
Duplicate node name in graph: 'concat'
&lt;class 'ValueError'&gt;
Duplicate node name in graph: 'concat'
</code></pre></div>
<p dir="auto">If I comment both <code class="notranslate">print(tf.concat([i, j], axis=-1))</code> lines then <code class="notranslate">print(tf.concat([i], axis=-1))</code> does not fail, but <code class="notranslate">print(tf.concat(i, axis=-1))</code> do. If I also comment <code class="notranslate">print(tf.concat([i], axis=-1))</code> then <code class="notranslate">print(tf.concat(i, axis=-1))</code> resolves without error.</p>
<p dir="auto"><strong>Other info / logs</strong></p>
<p dir="auto">Full error log:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1550   try:
-&gt; 1551     c_op = c_api.TF_FinishOperation(op_desc)
   1552   except errors.InvalidArgumentError as e:

InvalidArgumentError: Duplicate node name in graph: 'concat'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
&lt;ipython-input-2-bd15a2b20363&gt; in &lt;module&gt;
----&gt; 1 print(tf.concat(i, axis=-1))

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    178     &quot;&quot;&quot;Call target, and fall back on dispatchers if there is a TypeError.&quot;&quot;&quot;
    179     try:
--&gt; 180       return target(*args, **kwargs)
    181     except (TypeError, ValueError):
    182       # Note: convert_to_eager_tensor currently raises a ValueError, not a

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py in concat(values, axis, name)
   1282           dtype=dtypes.int32).get_shape().assert_is_compatible_with(
   1283               tensor_shape.scalar())
-&gt; 1284       return identity(values[0], name=scope)
   1285   return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
   1286 

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    178     &quot;&quot;&quot;Call target, and fall back on dispatchers if there is a TypeError.&quot;&quot;&quot;
    179     try:
--&gt; 180       return target(*args, **kwargs)
    181     except (TypeError, ValueError):
    182       # Note: convert_to_eager_tensor currently raises a ValueError, not a

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py in identity(input, name)
     84       return copied
     85   else:
---&gt; 86     ret = gen_array_ops.identity(input, name=name)
     87     # Propagate handle data for happier shape inference for resource variables.
     88     if hasattr(input, &quot;_handle_data&quot;):

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py in identity(input, name)
   4251   # Add nodes to the TensorFlow graph.
   4252   _, _, _op = _op_def_lib._apply_op_helper(
-&gt; 4253         &quot;Identity&quot;, input=input, name=name)
   4254   _result = _op.outputs[:]
   4255   _inputs_flat = _op.inputs

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    786         op = g.create_op(op_type_name, inputs, dtypes=None, name=scope,
    787                          input_types=input_types, attrs=attr_protos,
--&gt; 788                          op_def=op_def)
    789       return output_structure, op_def.is_stateful, op
    790 

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py in create_op(***failed resolving arguments***)
    463     return super(FuncGraph, self).create_op(
    464         op_type, inputs, dtypes, input_types, name, attrs, op_def,
--&gt; 465         compute_device=compute_device)
    466 
    467   def capture(self, tensor, name=None):

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py in new_func(*args, **kwargs)
    505                 'in a future version' if date is None else ('after %s' % date),
    506                 instructions)
--&gt; 507       return func(*args, **kwargs)
    508 
    509     doc = _add_deprecated_arg_notice_to_docstring(

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in create_op(***failed resolving arguments***)
   3294           input_types=input_types,
   3295           original_op=self._default_original_op,
-&gt; 3296           op_def=op_def)
   3297       self._create_op_helper(ret, compute_device=compute_device)
   3298     return ret

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1712           op_def, inputs, node_def.attr)
   1713       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
-&gt; 1714                                 control_input_ops)
   1715 
   1716     # Initialize self._outputs.

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1552   except errors.InvalidArgumentError as e:
   1553     # Convert to ValueError for backwards compatibility.
-&gt; 1554     raise ValueError(str(e))
   1555 
   1556   return c_op

ValueError: Duplicate node name in graph: 'concat'"><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1550   try:
-&gt; 1551     c_op = c_api.TF_FinishOperation(op_desc)
   1552   except errors.InvalidArgumentError as e:

InvalidArgumentError: Duplicate node name in graph: 'concat'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
&lt;ipython-input-2-bd15a2b20363&gt; in &lt;module&gt;
----&gt; 1 print(tf.concat(i, axis=-1))

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    178     """Call target, and fall back on dispatchers if there is a TypeError."""
    179     try:
--&gt; 180       return target(*args, **kwargs)
    181     except (TypeError, ValueError):
    182       # Note: convert_to_eager_tensor currently raises a ValueError, not a

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py in concat(values, axis, name)
   1282           dtype=dtypes.int32).get_shape().assert_is_compatible_with(
   1283               tensor_shape.scalar())
-&gt; 1284       return identity(values[0], name=scope)
   1285   return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
   1286 

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
    178     """Call target, and fall back on dispatchers if there is a TypeError."""
    179     try:
--&gt; 180       return target(*args, **kwargs)
    181     except (TypeError, ValueError):
    182       # Note: convert_to_eager_tensor currently raises a ValueError, not a

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py in identity(input, name)
     84       return copied
     85   else:
---&gt; 86     ret = gen_array_ops.identity(input, name=name)
     87     # Propagate handle data for happier shape inference for resource variables.
     88     if hasattr(input, "_handle_data"):

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py in identity(input, name)
   4251   # Add nodes to the TensorFlow graph.
   4252   _, _, _op = _op_def_lib._apply_op_helper(
-&gt; 4253         "Identity", input=input, name=name)
   4254   _result = _op.outputs[:]
   4255   _inputs_flat = _op.inputs

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
    786         op = g.create_op(op_type_name, inputs, dtypes=None, name=scope,
    787                          input_types=input_types, attrs=attr_protos,
--&gt; 788                          op_def=op_def)
    789       return output_structure, op_def.is_stateful, op
    790 

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py in create_op(***failed resolving arguments***)
    463     return super(FuncGraph, self).create_op(
    464         op_type, inputs, dtypes, input_types, name, attrs, op_def,
--&gt; 465         compute_device=compute_device)
    466 
    467   def capture(self, tensor, name=None):

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py in new_func(*args, **kwargs)
    505                 'in a future version' if date is None else ('after %s' % date),
    506                 instructions)
--&gt; 507       return func(*args, **kwargs)
    508 
    509     doc = _add_deprecated_arg_notice_to_docstring(

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in create_op(***failed resolving arguments***)
   3294           input_types=input_types,
   3295           original_op=self._default_original_op,
-&gt; 3296           op_def=op_def)
   3297       self._create_op_helper(ret, compute_device=compute_device)
   3298     return ret

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def)
   1712           op_def, inputs, node_def.attr)
   1713       self._c_op = _create_c_op(self._graph, node_def, grouped_inputs,
-&gt; 1714                                 control_input_ops)
   1715 
   1716     # Initialize self._outputs.

~/Documents/beta1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1552   except errors.InvalidArgumentError as e:
   1553     # Convert to ValueError for backwards compatibility.
-&gt; 1554     raise ValueError(str(e))
   1555 
   1556   return c_op

ValueError: Duplicate node name in graph: 'concat'
</code></pre></div>