From ac40bd12192b6d41afa5d969578766e050c44398 Mon Sep 17 00:00:00 2001 From: Jack Frankland Date: Tue, 21 Nov 2023 17:08:37 +0000 Subject: Correct Fully Connected Validation Logic The bias operand of the fully connected operator must be a 1D tensor either equal to the output channel size or of size 1. Previously we asserted the former case, we now include the second case. Signed-off-by: Jack Frankland Change-Id: I07dbc8a3aa1650703e5c50e1e7f36bb9539fd5db --- reference_model/src/ops/tensor_ops.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'reference_model/src/ops/tensor_ops.cc') diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc index 3f0e7b2..b9e2fbe 100644 --- a/reference_model/src/ops/tensor_ops.cc +++ b/reference_model/src/ops/tensor_ops.cc @@ -1246,9 +1246,10 @@ int OpFullyConnected::checkTensorAttributes() return 1; } - if (weight->getShape()[0] != bias->getShape()[0]) + if (weight->getShape()[0] != bias->getShape()[0] && bias->getShape()[0] != 1) { - printNodeValidationError("OpFullyConnected operator bias.shape[0] should match weight.shape[0]"); + printNodeValidationError( + "OpFullyConnected operator bias.shape[0] should match weight.shape[0] or be equal to 1"); return 1; } -- cgit v1.2.1