【问题标题】:TensorFlow C++ on Windows: Executor failed to create kernelWindows 上的 TensorFlow C++:执行程序无法创建内核
【发布时间】:2018-06-20 18:13:06
【问题描述】:

我已经使用 CMake 为 Windows 构建了 TensorFlow C++,并且能够运行一些示例。但是,当尝试对我自己的模型执行预测时,我收到以下错误消息:

执行程序未能创建内核。无效参数:NodeDef 提及 attr 'dilations' 不在 Op 中

检查您的 GraphDef 解释二进制文件是否与您的 GraphDef 生成二进制文件是最新的。

我已经使用 Keras 和 tf 1.5 训练了我的模型。该模型使用 adam 作为优化器,是一个简单的基于 ResNet50 的模型。我使用this 脚本将 Keras 模型转换为 TensorFlow,它在 TensorFlow for Python 上运行良好。

有什么想法吗?

这是完整的日志:

2018-02-23 08:32:39.588610: E C:\Visual Studio 2015\Projects\tensorflow\tensorflow\core\common_runtime\executor.cc:643] Executor failed to create kernel. Invalid argument: NodeDef mentions attr 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: conv1/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](zeropadding2d_1/Pad, conv1/kernel). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
         [[Node: conv1/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](zeropadding2d_1/Pad, conv1/kernel)]]
2018-02-23 08:32:39.637876: E matmul.cpp:357] Running model failed: Invalid argument: NodeDef mentions attr 'dilations' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: conv1/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](zeropadding2d_1/Pad, conv1/kernel). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
         [[Node: conv1/convolution = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/cpu:0"](zeropadding2d_1/Pad, conv1/kernel)]]

我正在使用 Windows 10 x64 和使用 CMake 构建的 TensorFlow 和 Visual Studio 2015。

谢谢!

【问题讨论】:

    标签: c++ tensorflow


    【解决方案1】:

    解决方案是将 TensorFlow 更新到更新版本。我使用的版本不支持 Keras 中实现的一些操作。

    【讨论】:

      【解决方案2】:

      我也遇到了同样的问题。这是由于训练和目标系统中不同的 Tensorflow 版本。

      首先我认为这可能是因为训练和目标平台操作系统的差异。因为我在 Mac OSX 上训练了模型,但在 Linux 上使用了模型。但后来发现它是由于 TensorFlow 版本差异而发生的。我在 Tensorflow 1.6.0 中训练了模型,但在我的 Linux 服务器上,Tensorflow 版本 1.4.0 可用。我在 Mac 上将 tensorflow 降级到 1.4.0,重新训练模型,它在 Linux 上运行良好。

      【讨论】:

        猜你喜欢
        • 2019-08-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-13
        • 2020-08-09
        • 1970-01-01
        • 2023-01-11
        • 2012-01-23
        相关资源
        最近更新 更多