Skip to content

Commit 61dddb5

Browse files
committed
Add shape check
Signed-off-by: Adrian Lundell <[email protected]>
1 parent 023c583 commit 61dddb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backends/cortex_m/ops/cortex_m_ops_common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
* All rights reserved.
4+
* Copyright 2025 Arm Limited and/or its affiliates.
45
*
56
* This source code is licensed under the BSD-style license found in the
67
* LICENSE file in the root directory of this source tree.
@@ -49,6 +50,12 @@ inline void validate_cmsis_nn_tensor_requirements(
4950
"Output dtype must be %hhd, got %hhd",
5051
expected_dtype,
5152
output.scalar_type());
53+
ET_CHECK_MSG(
54+
input1.sizes() == input2.sizes(),
55+
"Input1 and Input2 must have the same sizes");
56+
ET_CHECK_MSG(
57+
output.sizes() == input1.sizes(),
58+
"Output must have the same sizes as inputs");
5259

5360
// Dim order consistency
5461
ET_CHECK_MSG(

0 commit comments

Comments
 (0)