Skip to content

Commit db21fc0

Browse files
author
RJ Ascani
committed
Shorten error messages
1 parent 53b6621 commit db21fc0

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool validate_depthwise_conv2d_arguments(
4343
if (input.size(0) != 1) {
4444
ET_LOG(
4545
Error,
46-
"quantized_depthwise_conv2d_out: CMSIS-NN only supports batch size 1, got %zd",
46+
"quantized_depthwise_conv2d_out: batch size must be 1, got %zd",
4747
input.size(0));
4848
context.fail(Error::InvalidArgument);
4949
return false;
@@ -53,7 +53,7 @@ bool validate_depthwise_conv2d_arguments(
5353
if (weight.size(0) != 1) {
5454
ET_LOG(
5555
Error,
56-
"quantized_depthwise_conv2d_out: weight dim 0 must be 1 for IHWO layout, got %zd",
56+
"quantized_depthwise_conv2d_out: weight dim 0 must be 1, got %zd",
5757
weight.size(0));
5858
context.fail(Error::InvalidArgument);
5959
return false;
@@ -64,7 +64,7 @@ bool validate_depthwise_conv2d_arguments(
6464
if (weight_output_channels != output_channels) {
6565
ET_LOG(
6666
Error,
67-
"quantized_depthwise_conv2d_out: weight output channels (%zd) must match output channels (%zd)",
67+
"quantized_depthwise_conv2d_out: weight out_ch (%zd) != out_ch (%zd)",
6868
weight_output_channels,
6969
output_channels);
7070
context.fail(Error::InvalidArgument);
@@ -73,16 +73,14 @@ bool validate_depthwise_conv2d_arguments(
7373

7474
if (!is_channels_last_tensor(input)) {
7575
ET_LOG(
76-
Error,
77-
"quantized_depthwise_conv2d_out: input must have channels_last dim_order (NHWC)");
76+
Error, "quantized_depthwise_conv2d_out: input must be channels_last");
7877
context.fail(Error::InvalidArgument);
7978
return false;
8079
}
8180

8281
if (!is_channels_last_tensor(output)) {
8382
ET_LOG(
84-
Error,
85-
"quantized_depthwise_conv2d_out: output must have channels_last dim_order (NHWC)");
83+
Error, "quantized_depthwise_conv2d_out: output must be channels_last");
8684
context.fail(Error::InvalidArgument);
8785
return false;
8886
}
@@ -102,17 +100,15 @@ bool validate_depthwise_conv2d_arguments(
102100
}
103101

104102
if (bias.has_value() && bias.value().scalar_type() != ScalarType::Int) {
105-
ET_LOG(
106-
Error,
107-
"quantized_depthwise_conv2d_out: bias must be int32 if provided");
103+
ET_LOG(Error, "quantized_depthwise_conv2d_out: bias must be int32");
108104
context.fail(Error::InvalidArgument);
109105
return false;
110106
}
111107

112108
if (stride.size() != 2 || padding.size() != 2 || dilation.size() != 2) {
113109
ET_LOG(
114110
Error,
115-
"quantized_depthwise_conv2d_out: stride, padding, and dilation must have length 2");
111+
"quantized_depthwise_conv2d_out: stride/padding/dilation must have length 2");
116112
context.fail(Error::InvalidArgument);
117113
return false;
118114
}
@@ -122,7 +118,7 @@ bool validate_depthwise_conv2d_arguments(
122118
if (output_channels != input_channels * depth_multiplier) {
123119
ET_LOG(
124120
Error,
125-
"quantized_depthwise_conv2d_out: output channels (%zd) must equal input channels (%zd) * depth_multiplier (%zd)",
121+
"quantized_depthwise_conv2d_out: out_ch (%zd) != in_ch (%zd) * depth_mult (%zd)",
126122
output_channels,
127123
input_channels,
128124
depth_multiplier);
@@ -134,7 +130,7 @@ bool validate_depthwise_conv2d_arguments(
134130
requantize_shifts.size(0) != output_channels) {
135131
ET_LOG(
136132
Error,
137-
"quantized_depthwise_conv2d_out: per-channel params must match output channels (%zd)",
133+
"quantized_depthwise_conv2d_out: per-ch params size != out_ch (%zd)",
138134
output_channels);
139135
context.fail(Error::InvalidArgument);
140136
return false;

0 commit comments

Comments
 (0)