2

I am creating new ops (https://www.tensorflow.org/extend/adding_an_op) for TensorFlow (r1.0) running both on x86 and ARMv7.

Minor code modifications are necessary to run TensorFlow on ARMv7, but this guide helps a lot: https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md.

But I noticed that the custom operations do not work on my ARMv7 installation of TensorFlow.

For example, when I test my custom operation in a Python script on ARMv7:

import tensorflow as tf
_custom_op_module = tf.load_op_library('custom_op.so')
custom_op = _custom_op_module.add_stub

I get the following error (that does not show up on x86):

$ python test_custom_op.py 
  Traceback (most recent call last):
  File "custom_op.py", line 3, in <module>
    add_stub = _custom_op_module.add_stub
  AttributeError: 'module' object has no attribute 'custom_op'

I further investigated the issue, and apparently there is not my custom operation in the .so library file.

$ python
>>> import tensorflow as tf
>>> _custom_op_module = tf.load_op_library('custom_op.so')
>>> dir(_custom_op_module)
>>> ['LIB_HANDLE', 'OP_LIST', '_InitOpDefLibrary', '__builtins__', '__doc__', '__name__', '__package__', '_collections', '_common_shapes', '_op_def_lib', '_op_def_library', '_op_def_pb2', '_op_def_registry', '_ops', '_text_format']
>>> _custom_op_module.OP_LIST

>>>

The same commands on x86 have the following output:

>>> import tensorflow as tf
>>> _custom_op_module = tf.load_op_library('custom_op.so')
>>> dir(_custom_op_module)
>>> ['LIB_HANDLE', 'OP_LIST', '_InitOpDefLibrary', '__builtins__', '__doc__', '__name__', '__package__', '_add_stub_outputs', '_collections', '_common_shapes', '_op_def_lib', '_op_def_library', '_op_def_pb2', '_op_def_registry', '_ops', '_text_format', 'custom_op']
>>> _custom_op_module.OP_LIST
op {
  name: "CustomOp"
  ...
}
>>>

Does anybody have similar issue? Can we consider this a bug?

2 Answers 2

1

I hit a similar issue with a similar error message when I tried to load my new op, however, my problem was I tried to register a customized op that had the same op name as tensorflow, and that led to a name collision. Changing the name fixed it without recompiling TF.

The error message I encountered: AttributeError: module '6e237d88703da016805889179d3f5baa' has no attribute 'custom_op'

Sign up to request clarification or add additional context in comments.

Comments

0

Apparently, recompiling and re-installing the TF made it works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.