Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbol error when using tensorflow addons image transform

I am trying to use tensorflow addons to do image affine transformation and I'm getting strange errors.

I installed tensorflow 2.1 using anaconda, then pip install tensorflow addons in the same environment as it is not yet available on conda. The error might come from that fact...

So here is the code, can anyone try it?

some_image_path = '/path/to/an/image'
with open(some_image_path, 'rb') as f:
    image = tf.io.decode_image(f.read())

ops = tfa.image.transform_ops.angles_to_projective_transforms(90, image.shape[0], image.shape[1])
image = tfa.image.transform(image, ops)

Here the log trace:

Traceback (most recent call last):
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-24-2e958d55097f>", line 1, in <module>
    tfa.image.transform(image, ops)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 568, in __call__
    result = self._call(*args, **kwds)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 615, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 497, in _initialize
    *args, **kwds))
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2389, in _get_concrete_function_internal_garbage_collected
    graph_function, _, _ = self._maybe_define_function(args, kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2703, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2593, in _create_graph_function
    capture_by_value=self._capture_by_value),
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 978, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 439, in wrapped_fn
    return weak_wrapped_fn().__wrapped__(*args, **kwds)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 968, in wrapper
    raise e.ag_error_metadata.to_exception(e)
tensorflow.python.framework.errors_impl.NotFoundError: in converted code:
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/image/transform_ops.py:110 transform  *
        output = _image_so.ops.addons_image_projective_transform_v2(
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/utils/resource_loader.py:49 ops
        self._ops = tf.load_op_library(get_path_to_datafile(self.relative_path))
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/load_library.py:57 load_op_library
        lib_handle = py_tf.TF_LoadLibrary(library_filename)
    NotFoundError: /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol: _ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv
like image 341
Nick Skywalker Avatar asked Sep 05 '25 02:09

Nick Skywalker


1 Answers

Ok, sorry it was actually an error of mixing pip package with conda.

So the solution is to use pip instead of conda until tensorflow addons get released on conda!

like image 117
Nick Skywalker Avatar answered Sep 07 '25 16:09

Nick Skywalker