From 88847913620f5ea2ed832e55b8d0d4487696a936 Mon Sep 17 00:00:00 2001 From: Jedrzej Hajduczenia Date: Mon, 26 Oct 2020 18:36:00 +0100 Subject: [PATCH] [IE CLDNN] Improve LO rules for expected FQ format (#2790) --- .../thirdparty/clDNN/src/layout_optimizer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp index 7db5918f4a2..9fc8cea04b4 100644 --- a/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp +++ b/inference-engine/thirdparty/clDNN/src/layout_optimizer.cpp @@ -178,7 +178,8 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next, if (next.is_type() && fmt_prev == format::b_fs_yx_fsv16 && fmt_next == format::b_fs_yx_fsv4 && is_input_idx(0)) return true; - if (next.is_type() && fmt_prev == format::bfyx && prev.is_input() && prev_dt == data_types::u8) + if (next.is_type() && (fmt_prev == format::bfyx || fmt_prev == format::bfzyx) && + prev.is_input() && (prev_dt == data_types::u8 || prev_dt == data_types::i8)) return true; if (next.is_type() && @@ -202,8 +203,9 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next, (prev_output_layout.size.feature[0] == 3 || (prev_output_layout.size.feature[0] == 4 && (prev_dt == data_types::u8 || prev_dt == data_types::i8)))))) return true; - if (next.is_type() && fmt_prev == format::bfyx && (fmt_next == format::b_fs_yx_fsv16 || - fmt_next == format::bs_fs_yx_bsv16_fsv16 || fmt_next == format::b_fs_yx_fsv4)) + if (next.is_type() && (fmt_prev == format::bfyx || fmt_prev == format::bfzyx) && + (fmt_next == format::b_fs_yx_fsv16 || fmt_next == format::b_fs_zyx_fsv16 || + fmt_next == format::bs_fs_yx_bsv16_fsv16 || fmt_next == format::b_fs_yx_fsv4)) return true; if (next.is_type() && @@ -230,7 +232,7 @@ bool layout_optimizer::can_fuse_reorder_to_prev(program_node& prev, program_node if (prev.is_type() && (fmt_next == format::b_fs_yx_fsv4 || fmt_next == format::b_fs_yx_fsv32 || fmt_next == format::b_fs_zyx_fsv32 || - fmt_next == format::b_fs_yx_fsv16 || fmt_next == format::bs_fs_yx_bsv16_fsv16)) + fmt_next == format::b_fs_yx_fsv16 || fmt_next == format::b_fs_zyx_fsv16 || fmt_next == format::bs_fs_yx_bsv16_fsv16)) return true; return false; @@ -801,6 +803,8 @@ format layout_optimizer::get_preferred_format(program_node& node) { } else { expected = format::b_fs_yx_fsv4; } + } else if (layout.format.spatial_num() == 3 && (layout.data_type == data_types::i8 || layout.data_type == data_types::u8)) { + expected = format::b_fs_zyx_fsv16; } } else if (node.is_type() || node.is_type()) { expected = node.get_output_layout().format;