Skip to content

Commit f5bc09c

Browse files
author
RJ Ascani
committed
Use is_channels_last_tensor helper function
1 parent 2546c39 commit f5bc09c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,15 @@ bool validate_depthwise_conv2d_arguments(
7171
return false;
7272
}
7373

74-
// Check for channels_last dim_order (NHWC: 0, 2, 3, 1)
75-
// Skip check if channels == 1, as dim_order is ambiguous in that case
76-
constexpr executorch::aten::DimOrderType kChannelsLastDimOrder[] = {
77-
0, 2, 3, 1};
78-
executorch::aten::ArrayRef<executorch::aten::DimOrderType>
79-
channels_last_order(kChannelsLastDimOrder, 4);
80-
81-
if (input.size(1) > 1 && input.dim_order() != channels_last_order) {
74+
if (!is_channels_last_tensor(input)) {
8275
ET_LOG(
8376
Error,
8477
"quantized_depthwise_conv2d_out: input must have channels_last dim_order (NHWC)");
8578
context.fail(Error::InvalidArgument);
8679
return false;
8780
}
8881

89-
if (output.size(1) > 1 && output.dim_order() != channels_last_order) {
82+
if (!is_channels_last_tensor(output)) {
9083
ET_LOG(
9184
Error,
9285
"quantized_depthwise_conv2d_out: output must have channels_last dim_order (NHWC)");

0 commit comments

Comments
 (0)