【发布时间】:2018-05-26 08:29:46
【问题描述】:
我有一个冻结的 tensorflow 图(.pb 格式),其中包含对 tensorflow.contrib.resampler 的调用,必须使用 c_api.h 在 C 应用程序中加载和执行。
如果我调用,我可以从 python 成功加载和执行这个图:
import tensorflow as tf
tf.contrib.resampler
在我加载图表之前。
但是,我找不到如何使用 C api 执行相同操作,这会导致失败并显示以下消息:
Failed to process frame with No OpKernel was registered to support Op 'Resampler'
with these attrs. Registered devices: [CPU,GPU], Registered kernels:
<no registered kernels>
如何使用 C api 指示 tensorflow 存在此操作?
【问题讨论】:
-
看代码,好像操作位于一个separate binary called
_resampler_ops.so。难怪它找不到它——你需要先加载这个库。 -
令人惊讶的是,这个二进制文件在我的安装中不存在(通过 Windows 上的 pip 安装的 tensorflow-gpu 1.8.0),但 python 版本能够加载和运行图形。这意味着该操作存在并且可以加载,前提是我可以弄清楚如何在 C 中执行此操作。
标签: c tensorflow