[IE CLDNN] Prefer bf(wz)yx format for reshape (#691)
authorJedrzej Hajduczenia <jedrzej.hajduczenia@intel.com>
Mon, 1 Jun 2020 07:38:33 +0000 (09:38 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Jun 2020 07:38:33 +0000 (10:38 +0300)
Performance improvement for icnet-camvid model

inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp

index 71fc7e4..afbd846 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "data_inst.h"
 #include "reorder_inst.h"
+#include "reshape_inst.h"
 #include "generic_layer.hpp"
 #include <sstream>
 
@@ -776,6 +777,14 @@ format layout_optimizer::get_preferred_format(program_node& node) {
             layout{ data_types::f32, format::bfyx, tensor{} }).format;
     } else if (node.is_type<reorder>() || node.is_type<input_layout>()) {
         expected = node.get_output_layout().format;
+    } else if (node.is_type<reshape>()) {
+        if (node.get_output_layout().format.dimension() == 6) {
+            expected = format::bfwzyx;
+        } else if (node.get_output_layout().format.dimension() == 5) {
+            expected = format::bfzyx;
+        } else if (node.get_output_layout().format.dimension() == 4) {
+            expected = format::bfyx;
+        }
     } else if (node.is_type<deconvolution>()) {
         auto& deconv_node = node.as<deconvolution>();
         auto weights_layout = deconv_node.weights(0).get_output_layout();