<p dir="auto">Running <code class="notranslate">build_all_ios.sh</code> produces a <code class="notranslate">libtensorflow-core.a</code> that contains a symbol twice. When linking on iOS the error is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="duplicate symbol __ZN10tensorflow15CreateGPUTracerEv in:
    &lt;PROJDIR&gt;/.../libtensorflow-core.a(gpu_tracer.o)
ld: 1 duplicate symbol for architecture x86_64"><pre class="notranslate"><code class="notranslate">duplicate symbol __ZN10tensorflow15CreateGPUTracerEv in:
    &lt;PROJDIR&gt;/.../libtensorflow-core.a(gpu_tracer.o)
ld: 1 duplicate symbol for architecture x86_64
</code></pre></div>
<p dir="auto">I checked with <code class="notranslate">nm</code> just to be sure</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ nm libtensorflow-core.a | grep CreateGPUTracerEv
---------------- T __ZN10tensorflow15CreateGPUTracerEv
---------------- T __ZN10tensorflow15CreateGPUTracerEv"><pre class="notranslate"><code class="notranslate">$ nm libtensorflow-core.a | grep CreateGPUTracerEv
---------------- T __ZN10tensorflow15CreateGPUTracerEv
---------------- T __ZN10tensorflow15CreateGPUTracerEv
</code></pre></div>
<p dir="auto">Branch <code class="notranslate">master</code><br>
MacOS Sierra 10.12.6 (16G29)<br>
Xcode Version 8.3.3 (8E3004b)</p>
<p dir="auto">I'm running Tensorflow 1.0, and I'm encountering a segfault in tensorflow, with the following output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" F tensorflow/core/common_runtime/executor.cc:484] Check failed: e-&gt;src_output() &lt; 32768 (38774 vs. 32768)
 Aborted (core dumped)"><pre class="notranslate"><code class="notranslate"> F tensorflow/core/common_runtime/executor.cc:484] Check failed: e-&gt;src_output() &lt; 32768 (38774 vs. 32768)
 Aborted (core dumped)
</code></pre></div>
<p dir="auto">My program loads a fairly large sparse matrix (1879549 samples, 556926 features, 0.000038 of the entries in the matrix are nonzero) into memory. I then create a <code class="notranslate">tf.SparseTensor</code> out of it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# x_indices and x.data are the data for the sparse matrix in the correct format
x_ind = tf.Variable(initial_value=x_indices.astype(np.int64), trainable=False)
x_val = tf.Variable(initial_value=x.data, dtype=tf.float32, trainable=False)
return tf.SparseTensor(x_ind, x_val, dense_shape=x_sparse.shape)"><pre class="notranslate"><code class="notranslate"># x_indices and x.data are the data for the sparse matrix in the correct format
x_ind = tf.Variable(initial_value=x_indices.astype(np.int64), trainable=False)
x_val = tf.Variable(initial_value=x.data, dtype=tf.float32, trainable=False)
return tf.SparseTensor(x_ind, x_val, dense_shape=x_sparse.shape)
</code></pre></div>
<p dir="auto">I then split this SparseTensor into minibatch-sized splits. I have several queue-runners feed that feed a Queue by taking a minibatch, transforming it to dense and putting it into the queue.</p>
<p dir="auto">In code, the process looks like this (where <code class="notranslate">self._input_x_sp</code> is the SparseTensor):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    self.x_shape = self._input_x_sp.get_shape().as_list()
    self.y_shape = self._input_y.get_shape().as_list()
    n_batches = self.x_shape[0] // self.batch_size
    self._x_split = tf.sparse_split(sp_input=self._input_x_sp, num_split=n_batches, axis=0)
    self._y_split = tf.split(self._input_y, num_or_size_splits=n_batches, axis=0, name=&quot;y_batch&quot;)

    #   ...  creating a Queue

    # build a list of all possible enqueue OPs.
    # We need to do this here while we're still single-threaded, as the
    # Graph creation is not thread-safe
    # Later in the different threads we can just run the OPs
    self._op_list = []
    for i in range(n_batches):
        x_batch = tf.sparse_tensor_to_dense(self._x_split[i], name=&quot;x_batch&quot;)
        y_batch = self._y_split[i]
        self._op_list.append(self._queue.enqueue_many([x_batch, y_batch]))"><pre class="notranslate"><code class="notranslate">    self.x_shape = self._input_x_sp.get_shape().as_list()
    self.y_shape = self._input_y.get_shape().as_list()
    n_batches = self.x_shape[0] // self.batch_size
    self._x_split = tf.sparse_split(sp_input=self._input_x_sp, num_split=n_batches, axis=0)
    self._y_split = tf.split(self._input_y, num_or_size_splits=n_batches, axis=0, name="y_batch")

    #   ...  creating a Queue

    # build a list of all possible enqueue OPs.
    # We need to do this here while we're still single-threaded, as the
    # Graph creation is not thread-safe
    # Later in the different threads we can just run the OPs
    self._op_list = []
    for i in range(n_batches):
        x_batch = tf.sparse_tensor_to_dense(self._x_split[i], name="x_batch")
        y_batch = self._y_split[i]
        self._op_list.append(self._queue.enqueue_many([x_batch, y_batch]))
</code></pre></div>
<p dir="auto">The queue-runners randomly pick an operation from <code class="notranslate">self._op_list</code> and execute it, in a loop.</p>
<p dir="auto">I am confident that my code is not to blame, as the program runs just fine on smaller input sizes (a sparse matrix of 206208 samples and 133515 features of which 0.000135 nonzero entries), but encounters the segfault on the larger matrix.</p>
<p dir="auto">Looking at the TF code where the error is generated (<a href="https://github.com/tensorflow/tensorflow/blob/r1.0/tensorflow/core/common_runtime/executor.cc#L484">here</a>) it seems like the cause is a variable in tensorflow that is an unsigned short when it probably should be something larger than that.</p>