title: How to include the .so of custom ops in the pip wheel and organize the sources of custom ops?
body: <p>Following <a href="https://www.tensorflow.org/how_tos/adding_an_op/" rel="nofollow noreferrer">the documentation</a>, I put <code>my_op.cc</code> and <code>my_op.cu.cc</code> under <code>tensorflow/core/user_ops</code>, and created <code>tensorflow/core/user_ops/BUILD</code> which contains</p>
  
  <pre><code>load("//tensorflow:tensorflow.bzl", "tf_custom_op_library")
  
  tf_custom_op_library(
      name = "my_op.so",
      srcs = ["my_op.cc"],
      gpu_srcs = ["my_op.cu.cc"],
  )
  </code></pre>
  
  <p>Then I run the following commands under the root of tensorflow:</p>
  
  <pre><code>bazel build -c opt //tensorflow/core/user_ops:all
  bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
  </code></pre>
  
  <p>After building and installing the pip wheel, I want to use <code>my_op</code> in the project <em><code>my_project</code></em>.</p>
  
  <p>I think I should create something like <code>my_project/tf_op/__init__.py</code> and <code>my_project/tf_op/my_op.py</code>, which calls <code>tf.load_op_library</code> like <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/how_tos/adding_an_op/cuda_op.py" rel="nofollow noreferrer">the example cuda_op.py</a>. However, the <code>my_op.so</code> is not included in the installed pip wheel. How can I generate the input (the path of <code>my_op.so</code>) for <code>tf.load_op_library</code>?</p>
  
  <p>Is there any better way to organized <code>my_op.cc</code>, <code>my_op.cu.cc</code>, <code>my_op.py</code> with <em><code>my_project</code></em>?</p>