mihahauke / deep_rl_vizdoom

Deep reinforcement learning in ViZDoom (using Tensorflow)
18 stars 8 forks source link

How to solve "Conv2DCustomBackpropInputOp only supports NHWC." #8

Closed ouyangzhuzhu closed 6 years ago

ouyangzhuzhu commented 6 years ago

Is there any settings I can do to slove the problom? Need I change every place in the code where it uses NCHW.....BUT so many places....... Here is the detail info : Training, epoch 1: 0%| | 0/5000 [00:00<?, ?it/s]2018-06-06 12:09:36.214385: E tensorflow/core/common_runtime/executor.cc:660] Executor failed to create kernel. Invalid argument: Conv2DCustomBackpropInputOp only supports NHWC. [[Node: gradients/dueling_dqn/conv1/Conv2D_grad/Conv2DBackpropInput = Conv2DBackpropInput[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/dueling_dqn/conv1/Conv2D_grad/ShapeN, dueling_dqn/conv1/weights/read, gradients/dueling_dqn/conv1/BiasAdd_grad/tuple/control_dependency)]] Traceback (most recent call last): File "/home/lab/wsy/deep_rl_vizdoom/venvpython3/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/lab/wsy/deep_rl_vizdoom/venvpython3/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/lab/wsy/deep_rl_vizdoom/venvpython3/local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Conv2DCustomBackpropInputOp only supports NHWC. [[Node: gradients/dueling_dqn/conv1/Conv2D_grad/Conv2DBackpropInput = Conv2DBackpropInput[T=DT_FLOAT, data_format="NCHW", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](gradients/dueling_dqn/conv1/Conv2D_grad/ShapeN, dueling_dqn/conv1/weights/read, gradients/dueling_dqn/conv1/BiasAdd_grad/tuple/control_dependency)]]

During handling of the above exception, another exception occurred:

Miffyli commented 6 years ago

There is no other way around this than changing all the NCHWs to NHWC. There are several of them in the code but not too many for a quick fix :)

mihahauke commented 6 years ago

Yep. I assumed it would be run on a gpu so didn't bother to parametrize it.

ouyangzhuzhu commented 6 years ago

3ks Miffyli for your guid! I will try it right now!

ouyangzhuzhu commented 6 years ago

the problem soved by thins way.....3ks friends~~~:

    # with arg_scope([layers.conv2d], activation_fn=self.activation_fn, data_format="NCHW"), \
        # arg_scope([layers.fully_connected], activation_fn=self.activation_fn):
    with arg_scope([layers.conv2d], activation_fn=self.activation_fn, data_format="NHWC"), \
        arg_scope([layers.fully_connected], activation_fn=self.activation_fn):