diff options
author | Ting Fu <ting.fu@intel.com> | 2020-08-25 11:47:50 +0800 |
---|---|---|
committer | Guo, Yejun <yejun.guo@intel.com> | 2020-08-25 13:03:46 +0800 |
commit | c8ba0daf8dab2f5cbcdded37cd6383649933fbf3 (patch) | |
tree | 07fc4d82be5a16a925f5710ec370141e1163d778 /libavfilter/dnn/dnn_backend_native_layer_mathunary.c | |
parent | 230cf9d1854b171727d1b10c2a2fbe0df9d1d489 (diff) |
dnn/native: add log error message
Signed-off-by: Ting Fu <ting.fu@intel.com>
Diffstat (limited to 'libavfilter/dnn/dnn_backend_native_layer_mathunary.c')
-rw-r--r-- | libavfilter/dnn/dnn_backend_native_layer_mathunary.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c index 57bbd9d3e8..ae5d4daae9 100644 --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c @@ -53,7 +53,7 @@ int dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int } int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes, - int32_t output_operand_index, const void *parameters) + int32_t output_operand_index, const void *parameters, NativeContext *ctx) { const DnnOperand *input = &operands[input_operand_indexes[0]]; DnnOperand *output = &operands[output_operand_index]; @@ -67,11 +67,15 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper output->data_type = input->data_type; output->length = calculate_operand_data_length(output); - if (output->length <= 0) + if (output->length <= 0) { + av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n"); return DNN_ERROR; + } output->data = av_realloc(output->data, output->length); - if (!output->data) + if (!output->data) { + av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n"); return DNN_ERROR; + } dims_count = calculate_operand_dims_count(output); src = input->data; @@ -143,6 +147,7 @@ int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper dst[i] = round(src[i]); return 0; default: + av_log(ctx, AV_LOG_ERROR, "Unmatch math unary operator\n"); return DNN_ERROR; } } |