diff mbox series

[FFmpeg-devel,V3,1/2] dnn/native: unify error return to DNN_ERROR

Message ID 20200821034726.24134-1-ting.fu@intel.com
State Accepted
Headers show
Series [FFmpeg-devel,V3,1/2] dnn/native: unify error return to DNN_ERROR | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Fu, Ting Aug. 21, 2020, 3:47 a.m. UTC
Unify all error return as DNN_ERROR, in order to cease model executing
when return error in ff_dnn_execute_model_native layer_func.pf_exec

Signed-off-by: Ting Fu <ting.fu@intel.com>
---
 libavfilter/dnn/dnn_backend_native_layer_avgpool.c     | 2 +-
 libavfilter/dnn/dnn_backend_native_layer_conv2d.c      | 4 ++--
 libavfilter/dnn/dnn_backend_native_layer_depth2space.c | 4 ++--
 libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  | 2 +-
 libavfilter/dnn/dnn_backend_native_layer_mathunary.c   | 2 +-
 libavfilter/dnn/dnn_backend_native_layer_pad.c         | 4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)

Comments

Guo, Yejun Aug. 21, 2020, 10:57 a.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ting Fu
> Sent: 2020年8月21日 11:47
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH V3 1/2] dnn/native: unify error return to
> DNN_ERROR
> 
> Unify all error return as DNN_ERROR, in order to cease model executing
> when return error in ff_dnn_execute_model_native layer_func.pf_exec
> 
> Signed-off-by: Ting Fu <ting.fu@intel.com>
> ---
>  libavfilter/dnn/dnn_backend_native_layer_avgpool.c     | 2 +-
>  libavfilter/dnn/dnn_backend_native_layer_conv2d.c      | 4 ++--
>  libavfilter/dnn/dnn_backend_native_layer_depth2space.c | 4 ++--
>  libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  | 2 +-
>  libavfilter/dnn/dnn_backend_native_layer_mathunary.c   | 2 +-
>  libavfilter/dnn/dnn_backend_native_layer_pad.c         | 4 ++--
>  6 files changed, 9 insertions(+), 9 deletions(-)
> 

we'd better move the following change to patch 1/2 from patch 2/2, so this patch is complete.

-        layer_funcs[layer_type].pf_exec(native_model->operands,
-                                        native_model->layers[layer].input_operand_indexes,
-                                        native_model->layers[layer].output_operand_index,
-                                        native_model->layers[layer].params);
+        if (layer_funcs[layer_type].pf_exec(native_model->operands,
+                                            native_model->layers[layer].input_operand_indexes,
+                                            native_model->layers[layer].output_operand_index,
+                                            native_model->layers[layer].params) == DNN_ERROR) {
+            return DNN_ERROR;
+        }
Fu, Ting Aug. 23, 2020, 3:40 p.m. UTC | #2
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Guo,
> Yejun
> Sent: Friday, August 21, 2020 06:57 PM
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH V3 1/2] dnn/native: unify error return to
> DNN_ERROR
> 
> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ting
> > Fu
> > Sent: 2020年8月21日 11:47
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH V3 1/2] dnn/native: unify error return
> > to DNN_ERROR
> >
> > Unify all error return as DNN_ERROR, in order to cease model executing
> > when return error in ff_dnn_execute_model_native layer_func.pf_exec
> >
> > Signed-off-by: Ting Fu <ting.fu@intel.com>
> > ---
> >  libavfilter/dnn/dnn_backend_native_layer_avgpool.c     | 2 +-
> >  libavfilter/dnn/dnn_backend_native_layer_conv2d.c      | 4 ++--
> >  libavfilter/dnn/dnn_backend_native_layer_depth2space.c | 4 ++--
> > libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  | 2 +-
> >  libavfilter/dnn/dnn_backend_native_layer_mathunary.c   | 2 +-
> >  libavfilter/dnn/dnn_backend_native_layer_pad.c         | 4 ++--
> >  6 files changed, 9 insertions(+), 9 deletions(-)
> >
> 
> we'd better move the following change to patch 1/2 from patch 2/2, so this
> patch is complete.

Sure, thank you for your review.

> 
> -        layer_funcs[layer_type].pf_exec(native_model->operands,
> -                                        native_model->layers[layer].input_operand_indexes,
> -                                        native_model->layers[layer].output_operand_index,
> -                                        native_model->layers[layer].params);
> +        if (layer_funcs[layer_type].pf_exec(native_model->operands,
> +                                            native_model->layers[layer].input_operand_indexes,
> +                                            native_model->layers[layer].output_operand_index,
> +                                            native_model->layers[layer].params) == DNN_ERROR)
> {
> +            return DNN_ERROR;
> +        }
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
Gibson Tang Aug. 23, 2020, 3:56 p.m. UTC | #3
On Sun, Aug 23, 2020 at 11:40 PM Fu, Ting <ting.fu@intel.com> wrote:

>
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Guo,
> > Yejun
> > Sent: Friday, August 21, 2020 06:57 PM
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH V3 1/2] dnn/native: unify error
> return to
> > DNN_ERROR
> >
> >
> >
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ting
> > > Fu
> > > Sent: 2020年8月21日 11:47
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: [FFmpeg-devel] [PATCH V3 1/2] dnn/native: unify error return
> > > to DNN_ERROR
> > >
> > > Unify all error return as DNN_ERROR, in order to cease model executing
> > > when return error in ff_dnn_execute_model_native layer_func.pf_exec
> > >
> > > Signed-off-by: Ting Fu <ting.fu@intel.com>
> > > ---
> > >  libavfilter/dnn/dnn_backend_native_layer_avgpool.c     | 2 +-
> > >  libavfilter/dnn/dnn_backend_native_layer_conv2d.c      | 4 ++--
> > >  libavfilter/dnn/dnn_backend_native_layer_depth2space.c | 4 ++--
> > > libavfilter/dnn/dnn_backend_native_layer_mathbinary.c  | 2 +-
> > >  libavfilter/dnn/dnn_backend_native_layer_mathunary.c   | 2 +-
> > >  libavfilter/dnn/dnn_backend_native_layer_pad.c         | 4 ++--
> > >  6 files changed, 9 insertions(+), 9 deletions(-)
> > >
> >
> > we'd better move the following change to patch 1/2 from patch 2/2, so
> this
> > patch is complete.
>
> Sure, thank you for your review.
>
> >
> > -        layer_funcs[layer_type].pf_exec(native_model->operands,
> > -
> native_model->layers[layer].input_operand_indexes,
> > -
> native_model->layers[layer].output_operand_index,
> > -
> native_model->layers[layer].params);
> > +        if (layer_funcs[layer_type].pf_exec(native_model->operands,
> > +
> native_model->layers[layer].input_operand_indexes,
> > +
> native_model->layers[layer].output_operand_index,
> > +
> native_model->layers[layer].params) == DNN_ERROR)
> > {
> > +            return DNN_ERROR;
> > +        }
> >
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org
> > with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
index d745c35b4a..e21a635c82 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_avgpool.c
@@ -109,7 +109,7 @@  int dnn_execute_layer_avg_pool(DnnOperand *operands, const int32_t *input_operan
     output_operand->length = calculate_operand_data_length(output_operand);
     output_operand->data = av_realloc(output_operand->data, output_operand->length);
     if (!output_operand->data)
-        return -1;
+        return DNN_ERROR;
     output = output_operand->data;
 
     for (int y = 0; y < height_end; y += kernel_strides) {
diff --git a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
index a2202e4073..25356901c2 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_conv2d.c
@@ -114,10 +114,10 @@  int dnn_execute_layer_conv2d(DnnOperand *operands, const int32_t *input_operand_
     output_operand->data_type = operands[input_operand_index].data_type;
     output_operand->length = calculate_operand_data_length(output_operand);
     if (output_operand->length <= 0)
-        return -1;
+        return DNN_ERROR;
     output_operand->data = av_realloc(output_operand->data, output_operand->length);
     if (!output_operand->data)
-        return -1;
+        return DNN_ERROR;
     output = output_operand->data;
 
     av_assert0(channel == conv_params->input_num);
diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
index 2c8bddf23d..5a61025f7a 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
@@ -76,10 +76,10 @@  int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ope
     output_operand->data_type = operands[input_operand_index].data_type;
     output_operand->length = calculate_operand_data_length(output_operand);
     if (output_operand->length <= 0)
-        return -1;
+        return DNN_ERROR;
     output_operand->data = av_realloc(output_operand->data, output_operand->length);
     if (!output_operand->data)
-        return -1;
+        return DNN_ERROR;
     output = output_operand->data;
 
     for (y = 0; y < height; ++y){
diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
index dd42c329a9..bffa41cdda 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
@@ -176,6 +176,6 @@  int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t *input_ope
         }
         return 0;
     default:
-        return -1;
+        return DNN_ERROR;
     }
 }
diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c
index 58ee0e9d3d..57bbd9d3e8 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.c
@@ -143,6 +143,6 @@  int dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_oper
             dst[i] = round(src[i]);
         return 0;
     default:
-        return -1;
+        return DNN_ERROR;
     }
 }
diff --git a/libavfilter/dnn/dnn_backend_native_layer_pad.c b/libavfilter/dnn/dnn_backend_native_layer_pad.c
index feaab001e8..5452d22878 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_pad.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_pad.c
@@ -112,10 +112,10 @@  int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_ind
     output_operand->data_type = operands[input_operand_index].data_type;
     output_operand->length = calculate_operand_data_length(output_operand);
     if (output_operand->length <= 0)
-        return -1;
+        return DNN_ERROR;
     output_operand->data = av_realloc(output_operand->data, output_operand->length);
     if (!output_operand->data)
-        return -1;
+        return DNN_ERROR;
     output = output_operand->data;
 
     // copy the original data