Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging errors #6415

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions src/operators/resize-bilinear-nhwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,33 @@ static enum xnn_status create_resize_bilinear2d_nhwc(
xnn_operator_t* resize_op_out)
{
xnn_operator_t resize_op = NULL;
enum xnn_status status = xnn_status_uninitialized;

if ((xnn_params.init_flags & XNN_INIT_FLAG_XNNPACK) == 0) {
xnn_log_error("failed to create %s operator: XNNPACK is not initialized",
xnn_operator_type_to_string(operator_type));
goto error;
return xnn_status_uninitialized;
}

status = xnn_status_invalid_parameter;

if (output_width == 0 || output_height == 0) {
xnn_log_error(
"failed to reshape %s operator with %zux%zu output: output dimensions must be non-zero",
xnn_operator_type_to_string(resize_op->type), output_width, output_height);
xnn_operator_type_to_string(operator_type), output_width, output_height);
return xnn_status_invalid_parameter;
}

if (max(output_width, output_height) >= 16777216) {
xnn_log_error(
"failed to reshape %s operator with %zux%zu output: output dimensions must be below 2**24",
xnn_operator_type_to_string(resize_op->type), output_width, output_height);
xnn_operator_type_to_string(operator_type), output_width, output_height);
return xnn_status_unsupported_parameter;
}

status = xnn_status_out_of_memory;

resize_op = xnn_allocate_zero_simd_memory(sizeof(struct xnn_operator));
if (resize_op == NULL) {
xnn_log_error(
"failed to allocate %zu bytes for %s operator descriptor",
sizeof(struct xnn_operator), xnn_operator_type_to_string(operator_type));
goto error;
return xnn_status_out_of_memory;
}

resize_op->output_height = output_height;
Expand All @@ -79,10 +74,6 @@ static enum xnn_status create_resize_bilinear2d_nhwc(

*resize_op_out = resize_op;
return xnn_status_success;

error:
xnn_delete_operator(resize_op);
return status;
}

enum xnn_status xnn_create_resize_bilinear2d_nhwc_f16(
Expand Down
4 changes: 3 additions & 1 deletion src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ enum xnn_status xnn_create_weights_cache_with_size(size_t size, xnn_weights_cach
return xnn_status_success;

error:
xnn_internal_release_weights_cache(cache_provider->context);
if (cache_provider != NULL) {
xnn_internal_release_weights_cache(cache_provider->context);
}
return status;
}

Expand Down