tensorflow-windows-build-script icon indicating copy to clipboard operation
tensorflow-windows-build-script copied to clipboard

How to load custom op dll using c++?

Open 7oud opened this issue 5 years ago • 0 comments

@guikarist I wrote a very simple op zero_out, and compile it to zero_out.dll using bazel. It worked well when using python tf.load_op_library('./zero_out.dll'), Now I want to use this op(dll) in c++, how to load the dll, I try to use TF_LoadLibrary in c/c_api.h, but TF_NOT_FOUND = 5 is returned, zero_out.dll is not found? May some dependency are needed? I placed built tensorflow_cc.dll with zero_out.dll in the same directory. Could you give some advice?

TF_Status* status_load = TF_NewStatus();
TF_Library* lib_handle = TF_LoadLibrary("C:\\test_cc\\test_cc\\zero_out.dll", status_load);
TF_Code code = TF_GetCode(status_load); // code is 5

7oud avatar Sep 09 '19 09:09 7oud