2017-02-27 5 views
0

x86とARMv7の両方で動作するTensorFlow(r1.0)用の新しいオペレーション(https://www.tensorflow.org/extend/adding_an_op)を作成しています。TensorFlow新しいOp:AttributeError: 'module'オブジェクトに 'custom_op'属性がありません

ARMv7でTensorFlowを実行するには、マイナーコードの変更が必要ですが、このガイドは多くの役に立ちます。 https://github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md

しかし私は、カスタム操作がTensorFlowの私のARMv7インストールで動作しないことに気付きました。

私はのARMv7上のPythonスクリプトで私のカスタム動作をテスト例えば

、:

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

私は、取得するには、次のエラー(つまり、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さらにその問題を調査したところ、.soライブラリファイルにカスタム操作がないようです。 x86での

$ 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 

>>> 

同じコマンドは、次のような出力を持っている:

>>> 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" 
    ... 
} 
>>> 

誰でも同様の問題を持っていますか?これをバグと見なすことはできますか?

答えて

0

明らかに、TFを再コンパイルして再インストールすると動作しました。

関連する問題