tensorflow / swift

Swift for TensorFlow
https://tensorflow.org/swift
Apache License 2.0
6.12k stars 608 forks source link

Prebuilt tensorflow library doesn't contain all symbols from C++ tensorflow API #436

Open ematejska opened 4 years ago

ematejska commented 4 years ago

Imported from JIRA: https://bugs.swift.org/browse/TF-1177

Type: Bug Priority: Minor
Reporter: Andrey Volodin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

I'm trying to implement a custom op with a S4TF. I'm successfully compile an .so file with custom kernel representation, but when I try to load it via TF_LoadLibrary, I get this message:


TF_Code(rawValue: 5)

dlopen(custom-op-master/tensorflow_zero_out/cc/zero_out.so, 6): Symbol not found: __ZN10tensorflow10DEVICE_CPUE

  Referenced from: custom-op-master/tensorflow_zero_out/cc/zero_out.so

  Expected in: flat namespace

 in custom-op-master/tensorflow_zero_out/cc/zero_out.so

After an investigation I think that prebuilt artifact that comes with toolchain simply doesn't contain that symbol which I think comes from Eigen. Is it possible to ship a broader binary with toolchain?

In order to compile a 3rd party I did the following:

Installed tensorflow with the version from Swift repo configuration json Obtain headers from there Compiled custom op example with both regular g++ and clang that comes with toolchain linked zero_out.so to libtensorflow that comes with toolchain