Skip to content

Commit

Permalink
Merge pull request #6415 from apach301:fix-logging
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 651516343
  • Loading branch information
xnnpack-bot committed Jul 11, 2024
2 parents 488a695 + 95d6d02 commit 1ac6719
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 4 additions & 13 deletions src/operators/resize-bilinear-nhwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,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 @@ -78,10 +73,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 @@ -161,7 +161,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

0 comments on commit 1ac6719

Please sign in to comment.