From 251d5952ec2ab0a0fbeef508ab0cdc2d908ff813 Mon Sep 17 00:00:00 2001 From: aziz bahri Date: Mon, 16 Dec 2024 14:10:11 +0000 Subject: [PATCH] DynMM: use inner dim as MW and MH Signed-off-by: aziz bahri --- .../fpgadataflow/convert_to_hw_layers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/finn/transformation/fpgadataflow/convert_to_hw_layers.py b/src/finn/transformation/fpgadataflow/convert_to_hw_layers.py index 17ea52083..6bd545e63 100644 --- a/src/finn/transformation/fpgadataflow/convert_to_hw_layers.py +++ b/src/finn/transformation/fpgadataflow/convert_to_hw_layers.py @@ -1495,13 +1495,13 @@ def apply(self, model): wdt = model.get_tensor_datatype(mm_weight) if idt.is_integer() and wdt.is_integer(): mm_output = n.output[0] - # if mm_weight is not constant, skip node + # if mm_weight is not constant, skip node if model.get_initializer(mm_weight) is None: # TODO: AB: Hack for dynamic MM # Assume that the weight tensor is the same as the input tensor B inp_B = model.get_tensor_shape(mm_weight) - mh = int(inp_B[2]) - mw = int(inp_B[1]) + mh = int(inp_B[-1]) + mw = int(inp_B[-2]) else: W = model.get_initializer(mm_weight) # extract weight shape, note that ONNX and finn-hlslib @@ -1594,7 +1594,9 @@ def apply(self, model): MW=mw, MH=mh, SIMD=simd, - N_VECTORS=mm_in_shape[1], # Height of the input tensor A for dynamic MVAU + N_VECTORS=mm_in_shape[ + 1 + ], # Height of the input tensor A for dynamic MVAU PE=pe, inputDataType=idt.name, weightDataType=wdt.name,