diff mbox series

[FFmpeg-devel,5/5] lavfi/dnn_backend_native_layer_mathunary.h: Documentation

Message ID 20210508121307.13976-5-shubhanshu.e01@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/5] lavfi/dnn_backend_native_layer_avgpool.h: Documentation
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Shubhanshu Saxena May 8, 2021, 12:13 p.m. UTC
Add documentation for Unary Math Layer

Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
---
 .../dnn/dnn_backend_native_layer_mathunary.h  | 64 +++++++++++++------
 1 file changed, 46 insertions(+), 18 deletions(-)

Comments

Anton Khirnov May 9, 2021, 8:25 a.m. UTC | #1
Quoting Shubhanshu Saxena (2021-05-08 14:13:07)
> Add documentation for Unary Math Layer
> 
> Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
> ---
>  .../dnn/dnn_backend_native_layer_mathunary.h  | 64 +++++++++++++------
>  1 file changed, 46 insertions(+), 18 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> index 151a73200a..869fdc16fd 100644
> --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> @@ -30,31 +30,59 @@
>  #include "dnn_backend_native.h"
>  
>  typedef enum {
> -    DMUO_ABS = 0,
> -    DMUO_SIN = 1,
> -    DMUO_COS = 2,
> -    DMUO_TAN = 3,
> -    DMUO_ASIN = 4,
> -    DMUO_ACOS = 5,
> -    DMUO_ATAN = 6,
> -    DMUO_SINH = 7,
> -    DMUO_COSH = 8,
> -    DMUO_TANH = 9,
> -    DMUO_ASINH = 10,
> -    DMUO_ACOSH = 11,
> -    DMUO_ATANH = 12,
> -    DMUO_CEIL = 13,
> -    DMUO_FLOOR = 14,
> -    DMUO_ROUND = 15,
> -    DMUO_EXP = 16,
> -    DMUO_COUNT
> +    DMUO_ABS = 0,    // Absolute Value
> +    DMUO_SIN = 1,    // Sine
> +    DMUO_COS = 2,    // Cosine
> +    DMUO_TAN = 3,    // Tangent
> +    DMUO_ASIN = 4,   // Inverse Sine
> +    DMUO_ACOS = 5,   // Inverse Cosine
> +    DMUO_ATAN = 6,   // Inverse Tangent
> +    DMUO_SINH = 7,   // Hyperbolic Sine
> +    DMUO_COSH = 8,   // Hyperbolic Cosine
> +    DMUO_TANH = 9,   // Hyperbolic Tangent
> +    DMUO_ASINH = 10, // Inverse Hyperbolic Sine
> +    DMUO_ACOSH = 11, // Inverse Hyperbolic Cosine
> +    DMUO_ATANH = 12, // Inverse Hyperbolic Tangent
> +    DMUO_CEIL = 13,  // Ceiling
> +    DMUO_FLOOR = 14, // Floor
> +    DMUO_ROUND = 15, // Round off to Nearest Integer
> +    DMUO_EXP = 16,   // Exponential
> +    DMUO_COUNT       // Total Number of Operators

Every single one of those is obvious from the enum name itself, the
comments just add more visual clutter.
Shubhanshu Saxena May 9, 2021, 10:02 a.m. UTC | #2
On Sun, May 9, 2021 at 1:55 PM Anton Khirnov <anton@khirnov.net> wrote:

> Quoting Shubhanshu Saxena (2021-05-08 14:13:07)
> > Add documentation for Unary Math Layer
> >
> > Signed-off-by: Shubhanshu Saxena <shubhanshu.e01@gmail.com>
> > ---
> >  .../dnn/dnn_backend_native_layer_mathunary.h  | 64 +++++++++++++------
> >  1 file changed, 46 insertions(+), 18 deletions(-)
> >
> > diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> > index 151a73200a..869fdc16fd 100644
> > --- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> > +++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
> > @@ -30,31 +30,59 @@
> >  #include "dnn_backend_native.h"
> >
> >  typedef enum {
> > -    DMUO_ABS = 0,
> > -    DMUO_SIN = 1,
> > -    DMUO_COS = 2,
> > -    DMUO_TAN = 3,
> > -    DMUO_ASIN = 4,
> > -    DMUO_ACOS = 5,
> > -    DMUO_ATAN = 6,
> > -    DMUO_SINH = 7,
> > -    DMUO_COSH = 8,
> > -    DMUO_TANH = 9,
> > -    DMUO_ASINH = 10,
> > -    DMUO_ACOSH = 11,
> > -    DMUO_ATANH = 12,
> > -    DMUO_CEIL = 13,
> > -    DMUO_FLOOR = 14,
> > -    DMUO_ROUND = 15,
> > -    DMUO_EXP = 16,
> > -    DMUO_COUNT
> > +    DMUO_ABS = 0,    // Absolute Value
> > +    DMUO_SIN = 1,    // Sine
> > +    DMUO_COS = 2,    // Cosine
> > +    DMUO_TAN = 3,    // Tangent
> > +    DMUO_ASIN = 4,   // Inverse Sine
> > +    DMUO_ACOS = 5,   // Inverse Cosine
> > +    DMUO_ATAN = 6,   // Inverse Tangent
> > +    DMUO_SINH = 7,   // Hyperbolic Sine
> > +    DMUO_COSH = 8,   // Hyperbolic Cosine
> > +    DMUO_TANH = 9,   // Hyperbolic Tangent
> > +    DMUO_ASINH = 10, // Inverse Hyperbolic Sine
> > +    DMUO_ACOSH = 11, // Inverse Hyperbolic Cosine
> > +    DMUO_ATANH = 12, // Inverse Hyperbolic Tangent
> > +    DMUO_CEIL = 13,  // Ceiling
> > +    DMUO_FLOOR = 14, // Floor
> > +    DMUO_ROUND = 15, // Round off to Nearest Integer
> > +    DMUO_EXP = 16,   // Exponential
> > +    DMUO_COUNT       // Total Number of Operators
>
> Every single one of those is obvious from the enum name itself, the
> comments just add more visual clutter.
>
> --
> Anton Khirnov
> _______________________________________________
> 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".
>

Sure, I'll remove them. Thanks.
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
index 151a73200a..869fdc16fd 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathunary.h
@@ -30,31 +30,59 @@ 
 #include "dnn_backend_native.h"
 
 typedef enum {
-    DMUO_ABS = 0,
-    DMUO_SIN = 1,
-    DMUO_COS = 2,
-    DMUO_TAN = 3,
-    DMUO_ASIN = 4,
-    DMUO_ACOS = 5,
-    DMUO_ATAN = 6,
-    DMUO_SINH = 7,
-    DMUO_COSH = 8,
-    DMUO_TANH = 9,
-    DMUO_ASINH = 10,
-    DMUO_ACOSH = 11,
-    DMUO_ATANH = 12,
-    DMUO_CEIL = 13,
-    DMUO_FLOOR = 14,
-    DMUO_ROUND = 15,
-    DMUO_EXP = 16,
-    DMUO_COUNT
+    DMUO_ABS = 0,    // Absolute Value
+    DMUO_SIN = 1,    // Sine
+    DMUO_COS = 2,    // Cosine
+    DMUO_TAN = 3,    // Tangent
+    DMUO_ASIN = 4,   // Inverse Sine
+    DMUO_ACOS = 5,   // Inverse Cosine
+    DMUO_ATAN = 6,   // Inverse Tangent
+    DMUO_SINH = 7,   // Hyperbolic Sine
+    DMUO_COSH = 8,   // Hyperbolic Cosine
+    DMUO_TANH = 9,   // Hyperbolic Tangent
+    DMUO_ASINH = 10, // Inverse Hyperbolic Sine
+    DMUO_ACOSH = 11, // Inverse Hyperbolic Cosine
+    DMUO_ATANH = 12, // Inverse Hyperbolic Tangent
+    DMUO_CEIL = 13,  // Ceiling
+    DMUO_FLOOR = 14, // Floor
+    DMUO_ROUND = 15, // Round off to Nearest Integer
+    DMUO_EXP = 16,   // Exponential
+    DMUO_COUNT       // Total Number of Operators
 } DNNMathUnaryOperation;
 
 typedef struct DnnLayerMathUnaryParams{
     DNNMathUnaryOperation un_op;
 } DnnLayerMathUnaryParams;
 
+/**
+ * @brief Load the Unary Math Layer.
+ *
+ * It assigns the layer parameters to the unary operator
+ * hyperparameter from the model file context.
+ *
+ * @param layer pointer to the DNN layer instance
+ * @param model_file_context pointer to model file context
+ * @param file_size model file size
+ * @param operands_num number of operands for the layer
+ * @return Size of DNN Layer
+ * @retval 0 if model file context contains invalid hyperparameters.
+ */
 int ff_dnn_load_layer_math_unary(Layer *layer, AVIOContext *model_file_context, int file_size, int operands_num);
+
+/**
+ * @brief Execute the Unary Math Layer.
+ *
+ * It applies the unary operator parsed while
+ * loading to the given input operands.
+ *
+ * @param operands input operands
+ * @param input_operand_indexes input operand indexes
+ * @param output_operand_index output operand index
+ * @param parameters layer parameters
+ * @param ctx pointer to Native model context
+ * @retval DNN_SUCCESS if the execution succeeds
+ * @retval DNN_ERROR if the execution fails
+ */
 int ff_dnn_execute_layer_math_unary(DnnOperand *operands, const int32_t *input_operand_indexes,
                                     int32_t output_operand_index, const void *parameters, NativeContext *ctx);