无法加载模型:无效参数:没有注册OpKernel以支持使用这些attrs的Op'Prod'

时间:2017-11-06 06:59:37

标签: ios tensorflow

我正在尝试将Tensorflow Object Detection model zoo中的faster_rcnn_resnet101_coco模型加载到iOS相机示例中。我已经成功地从bazel为iOS构建了tensorflow(r.14)库。但是,在运行时,我无法获得传递错误:

2017-10-30 18:00:28.307769: E [path]/tensorflow_utils.mm:209] Could not create TensorFlow Graph: Invalid argument: No OpKernel was registered to support Op 'Prod' with these attrs.  Registered devices: [CPU], Registered kernels:
  <no registered kernels>

     [[Node: SecondStageBoxPredictor/Flatten/Prod = Prod[T=DT_INT32, Tidx=DT_INT32, keep_dims=false](SecondStageBoxPredictor/Flatten/Slice_1, SecondStageBoxPredictor/Flatten/Const)]]
2017-10-30 18:00:28.320101: F [path]CameraExampleViewController.mm:495] Couldn't load model: Invalid argument: No OpKernel was registered to support Op 'Prod' with these attrs.  Registered devices: [CPU], Registered kernels:
  <no registered kernels>

     [[Node: SecondStageBoxPredictor/Flatten/Prod = Prod[T=DT_INT32, Tidx=DT_INT32, keep_dims=false](SecondStageBoxPredictor/Flatten/Slice_1, SecondStageBoxPredictor/Flatten/Const)]]

据我了解,我需要在“ops_to_register.h”中构建tensorflow库时包含“Prod”操作。但是,这仍然失败,当我查看“tf_ops_files.txt”以查看哪些操作已注册时,我不确定“Prod”操作属于哪个内核库。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

我可以在使用

重新创建“op_to_register.h”文件后运行
bazel build tensorflow/python/tools:print_selective_registration_header 
  bazel-bin/tensorflow/python/tools/print_selective_registration_header \
    --graphs=path/to/graph.pb > ops_to_register.h

与“Prod”操作相关联的内核丢失原来是“reduction_prod_op.cc”的一部分。