From f96bae80e1a4fc36ebf4b89ee81ce37932e5d1e2 Mon Sep 17 00:00:00 2001 From: Xiaowen_Qi Date: Mon, 8 Jul 2024 16:02:40 -0400 Subject: [PATCH 1/4] add the type of 5 dimension video input into the data_layout --- src/qonnx/core/data_layout.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qonnx/core/data_layout.py b/src/qonnx/core/data_layout.py index 4a5d87a4..0e1fef3e 100644 --- a/src/qonnx/core/data_layout.py +++ b/src/qonnx/core/data_layout.py @@ -34,16 +34,18 @@ NCW = ["N", "C", "W"] NWC = ["N", "W", "C"] NC = ["N", "C"] +# 5-dimension video input, D for sequence depth +NCDHW = ["N", "C", "D", "H", "W"] UNKNOWN = [] def is_channels_last(layout): return layout[-1] == "C" - def get_channels_last_layout_for_ndims(ndims): - return {4: NHWC, 3: NWC, 2: NC}[ndims] + return {5: NCDHW, 4: NHWC, 3: NWC, 2: NC}[ndims] def get_channels_first_layout_for_ndims(ndims): - return {4: NCHW, 3: NCW, 2: NC}[ndims] + return {5: NCDHW, 4: NCHW, 3: NCW, 2: NC}[ndims] + From 4f765927c976b50175db79b0a503c9f47a7f047f Mon Sep 17 00:00:00 2001 From: Xiaowen_Qi Date: Mon, 8 Jul 2024 16:06:14 -0400 Subject: [PATCH 2/4] adding the additional type in infere_data_layouts --- src/qonnx/.DS_Store | Bin 0 -> 6148 bytes src/qonnx/transformation/.DS_Store | Bin 0 -> 6148 bytes src/qonnx/transformation/infer_data_layouts.py | 11 +++++++++++ 3 files changed, 11 insertions(+) create mode 100644 src/qonnx/.DS_Store create mode 100644 src/qonnx/transformation/.DS_Store diff --git a/src/qonnx/.DS_Store b/src/qonnx/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7a4daa13d8e9ac3e2861a5c1076b057338ccc5a7 GIT binary patch literal 6148 zcmeHK!Ab)$5S`R&w}{e%g5CmN3vSiYgO{b&A8|KAzAMtyf zNm5a&UIdXc1CuwI%p~Mx$!q{Xv`4)LKn(yqRKijfn=gdMN#~^GJcPo`k--gU7{UWY zbJ6Vhj||Y+twWAy7J-6~=a)l*XQ|?GHi%OlW86zTNRur0{Z~<1Dle~8yo$H#U4?gg z9Oh9z%G%NJf_kS~r}4~=;Gd(>@;p&JJ#Oof>SZQ3v;$t% zt9EPKlgYl{Xx3%3Ijze{!}nWt+1fjpPOIML&hFt!_db14`pGgY@FO&`=5PkjX#BXz z$8e}pt!^=HHpeWNkr`kHn1Kakz+H9T>H_YKx5NxE1HWT{?gxoV7&t5}nyUjF`hBGF zG9d}t^p+r$4g-gUMI1p9HWksP3ireiHXZ%a#RU!vi#8pESsCYXD+~8R5oUGtOA`(v zu*fYlzzlq5V99oCRR52^fB%0@;vO@=3@j7_qTC5PZQPQpt#g~BS}RenQAsGSu=t*W jhAG7uOQm=V)d>0}8HjH1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Mon, 8 Jul 2024 16:15:14 -0400 Subject: [PATCH 3/4] adds 5D channel last NDHWC --- src/qonnx/.DS_Store | Bin 6148 -> 6148 bytes src/qonnx/core/data_layout.py | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qonnx/.DS_Store b/src/qonnx/.DS_Store index 7a4daa13d8e9ac3e2861a5c1076b057338ccc5a7..605cb96ad54b7d3f890b614127ef4a114cfc24de 100644 GIT binary patch delta 61 zcmZoMXfc@J&&kZdz`)4BAi%I$ka;tsB#6txkj#+JP{fd07F?8 Date: Mon, 8 Jul 2024 16:17:48 -0400 Subject: [PATCH 4/4] infer 5D channel last NDHWC --- src/qonnx/transformation/infer_data_layouts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qonnx/transformation/infer_data_layouts.py b/src/qonnx/transformation/infer_data_layouts.py index 8b990a57..8b9c2f77 100644 --- a/src/qonnx/transformation/infer_data_layouts.py +++ b/src/qonnx/transformation/infer_data_layouts.py @@ -53,6 +53,8 @@ def _dims_to_layout(model, node, ndims): # 5D elif layout == "NCDHW" and ndims == 5: return DataLayout.NCDHW + elif layout == "NDHWC" and ndims == 5: + return DataLayout.NDHWC else: return DataLayout.UNKNOWN else: