'I don't know how to solve Default MaxPoolingOp only supports NHWC on device type CPU

Default MaxPoolingOp only supports NHWC on device type CPU

Python = 3.6.6 Tensorflow = 1.9.0

The error code is:


Default MaxPoolingOp only supports NHWC on device type CPU
\[\[Node: hourglass/hg_1/depth1/pool/MaxPool = MaxPool\[T=DT_FLOAT, \_class=\["loc:@hourglass/hg_1/depth1/low1_1/conv1/BatchNorm/cond/FusedBatchNorm_1/Switch"\], data_format="NCHW", ksize=\[1, 1, 2, 2\], padding="SAME", strides=\[1, 1, 2, 2\], \_device="/job:localhost/replica:0/task:0/device:CPU:0"\](hourglass/pre/res2/add)\]\]

Caused by op 'hourglass/hg_1/depth1/pool/MaxPool', defined at:
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\runpy.py", line 193, in \_run_module_as_main
"__main__", mod_spec)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\runpy.py", line 85, in _run_code_
exec(code, run_globals)
File "c:\\Users\\MSI.vscode\\extensions\\ms-python.python-2022.4.0\\pythonFiles\\lib\\python\\debugpy\__main_.py", line 45, in \<module\>
cli.main()
File "c:\\Users\\MSI.vscode\\extensions\\ms-python.python-2022.4.0\\pythonFiles\\lib\\python\\debugpy/..\\debugpy\\server\\cli.py", line 444, in main
run()
File "c:\\Users\\MSI.vscode\\extensions\\ms-python.python-2022.4.0\\pythonFiles\\lib\\python\\debugpy/..\\debugpy\\server\\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\runpy.py", line 96, in \_run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\runpy.py", line 85, in \_run_code
exec(code, run_globals)
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\elg_train.py", line 96, in \<module\>
train_data={'synthetic': unityeyes},
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\models\\elg.py", line 27, in __init__
super().__init__(tensorflow_session, \*\*kwargs)
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\core\\model.py", line 101, in __init__
self.\_build_all_models()
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\core\\model.py", line 184, in \_build_all_models
\_build_train_or_test(mode='train')
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\core\\model.py", line 167, in \_build_train_or_test
output_tensors, loss_terms, metrics = self.build_model(data_sources, mode=mode)
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\models\\elg.py", line 99, in build_model
x = self.\_build_hourglass(x, steps_to_go=4, num_features=self.\_hg_num_feature_maps)
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\models\\elg.py", line 216, in \_build_hourglass
low1 = self.\_apply_pool(x, kernel_size=2, stride=2)
File "c:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\models\\elg.py", line 172, in \_apply_pool
name='pool',
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\layers\\pooling.py", line 302, in max_pooling2d
return layer.apply(inputs)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\base_layer.py", line 774, in apply
return self.__call__(inputs, \*args, \*\*kwargs)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\layers\\base.py", line 329, in __call__
outputs = super(Layer, self).__call__(inputs, \*args, \*\*kwargs)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\base_layer.py", line 703, in __call__
outputs = self.call(inputs, \*args, \*\*kwargs)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\keras\\layers\\pooling.py", line 223, in call
data_format=conv_utils.convert_data_format(self.data_format, 4))
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\ops\\nn_ops.py", line 2153, in max_pool
name=name)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\ops\\gen_nn_ops.py", line 5081, in max_pool
data_format=data_format, name=name)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py", line 787, in \_apply_op_helper
op_def=op_def)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py", line 3414, in create_op
op_def=op_def)
File "C:\\Users\\MSI\\anaconda3\\envs\\test\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py", line 1740, in __init__
self.\_traceback = self.\_graph.\_extract_stack()  # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Default MaxPoolingOp only supports NHWC on device type CPU
\[\[Node: hourglass/hg_1/depth1/pool/MaxPool = MaxPool\[T=DT_FLOAT, \_class=\["loc:@hourglass/hg_1/depth1/low1_1/conv1/BatchNorm/cond/FusedBatchNorm_1/Switch"\], data_format="NCHW", ksize=\[1, 1, 2, 2\], padding="SAME", strides=\[1, 1, 2, 2\], \_device="/job:localhost/replica:0/task:0/device:CPU:0"\](hourglass/pre/res2/add)\]\]

During handling of the above exception, another exception occurred:

File "C:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\core\\model.py", line 327, in train
self.use_batch_statistics: True,
File "C:\\Users\\MSI\\Desktop\\학습\\전공종합설계\\원본\\arto_eye-master (2)\\arto_eye-master\\src\\elg_train.py", line 101, in \<module\>
num_epochs=100,

I'm trying to run this open source training, but I got a data format error. I think NHWC, NCHW conversion is necessary. However, I don't know how to solve it.

I'm trying to run this open source(https://github.com/swook/GazeML) elg_train, but I got a data format error. I think NHWC, NCHW conversion is necessary. However, I don't know how to solve it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source