You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on May 28, 2024. It is now read-only.
Hi there!
Is there any example where Custom OP written using C API was compiled successfully and executed after tf_load_library()?
I have referred the entire kernels.h ,ops.h and c_api.h files of the official github tf repo but I am not able to figure it out.
Could someone give the command to execute a C API custom op file along with the code?
To compile this custom op, you will need to build it as a shared library. One way to do this is to use the TensorFlow C++ library and build the op as part of a TensorFlow binary. Here is an example of how you might do this using bazel:
Create a file named BUILD in the same directory as your custom op code, with the following contents:
Activity
Rashed-MM commentedon Dec 28, 2022
@YogaVicky
Sure! Here is an example of a custom op written using the C API that can be compiled and executed after being loaded with tf.load_op_library():
Rashed-MM commentedon Dec 28, 2022
To compile this custom op, you will need to build it as a shared library. One way to do this is to use the TensorFlow C++ library and build the op as part of a TensorFlow binary. Here is an example of how you might do this using bazel:
Create a file named BUILD in the same directory as your custom op code, with the following contents:
Rashed-MM commentedon Dec 28, 2022
Run the following command to build the shared library:
bazel build -c opt //path/to/custom/op:my_add_opThis will build a shared library named libmy_add_op.so in the bazel-bin directory.
To execute the custom op after loading it with `tf.load_