Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MKL convolution throws exception for simple code #24650

@ppwwyyxx

Description

@ppwwyyxx

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:n/a
  • TensorFlow installed from (source or binary):source
  • TensorFlow version (use command below):b'v1.12.0-5324-g3ae375aa92' 1.12.0
  • Python version:3.6
  • Bazel version (if compiling from source):19.2
  • GCC/Compiler version (if compiling from source):5.3.0
  • CUDA/cuDNN version:n/a
  • GPU model and memory:n/a

Describe the current behavior

import numpy as np
import tensorflow as tf

x = tf.placeholder(tf.float32, shape=[1, 3, None, None])
xpad = tf.pad(x, [[0, 0], [0, 0], [2, 3], [2, 3]])
W = tf.random_normal([7, 7, 3, 64])
out = tf.nn.conv2d(xpad, W, [1, 1, 2, 2], padding="VALID", data_format='NCHW')

sess = tf.Session()
with sess.as_default():
    sess.run(out, feed_dict=
            {x: np.random.rand(1, 3, 600, 800)})

This simple code snippet is legal and runs well on a GPU. However, when run on a CPU with MKL build it throws:

2019-01-01 04:17:00.402605: W tensorflow/core/framework/op_kernel.cc:1412] OP_REQUIRES failed at mkl_conv_ops.cc:1128 : Aborted: Operation received an exception:Status: 3, message: could not create a dilated convolution forward descriptor, in file tensorflow/core/kernels/mkl_conv_ops.cc:1125
Traceback (most recent call last):
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
    return fn(*args)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.AbortedError: Operation received an exception:Status: 3, message: could not create a dilated convolution forward descriptor, in file tensorflow/core/kernels/mkl_conv_ops.cc:1125              
         [[{{node Conv2D}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "a.py", line 15, in <module>
    {x: np.random.rand(1, 3, 600, 800)})
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
    feed_dict_tensor, options, run_metadata)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
    run_metadata)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.AbortedError: Operation received an exception:Status: 3, message: could not create a dilated convolution forward descriptor, in file tensorflow/core/kernels/mkl_conv_ops.cc:1125              
         [[node Conv2D (defined at a.py:10) ]]

Errors may have originated from an input operation.
Input Source operations connected to node Conv2D:
 random_normal/stddev (defined at a.py:9)
 Placeholder (defined at a.py:7)
 Pad/paddings (defined at a.py:8)

Original stack trace for 'Conv2D':
  File "a.py", line 10, in <module>
    out = tf.nn.conv2d(xpad, W, [1, 1, 2, 2], padding="VALID", data_format='NCHW')
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 1026, in conv2d
    data_format=data_format, dilations=dilations, name=name)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 501, in new_func
    return func(*args, **kwargs)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
    op_def=op_def)
  File "/HOME/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in __init__
    self._traceback = tf_stack.extract_stack()

The code will not throw if the padding is [2, 2] instead of [2, 3].

Metadata

Metadata

Labels

comp:mklMKL related issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions