forked from espressif/arduino-esp32
IDF release/v3.3 (#3339)
* IDF release/v3.3 46b12a560 * fix build * IDF release/v3.3 367c3c09c
This commit is contained in:
@ -11,13 +11,13 @@ typedef int16_t qtp_t;
|
||||
typedef struct
|
||||
{
|
||||
/******* fix start *******/
|
||||
int w; /*!< Width */
|
||||
int h; /*!< Height */
|
||||
int c; /*!< Channel */
|
||||
int n; /*!< Number of filter, input and output must be 1 */
|
||||
int stride; /*!< Step between lines */
|
||||
int exponent; /*!< Exponent for quantization */
|
||||
qtp_t *item; /*!< Data */
|
||||
int w; /*!< Width */
|
||||
int h; /*!< Height */
|
||||
int c; /*!< Channel */
|
||||
int n; /*!< Number of filter, input and output must be 1 */
|
||||
int stride; /*!< Step between lines */
|
||||
int exponent; /*!< Exponent for quantization */
|
||||
qtp_t *item; /*!< Data */
|
||||
/******* fix end *******/
|
||||
} dl_matrix3dq_t;
|
||||
|
||||
@ -38,23 +38,22 @@ typedef struct
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DL_C_IMPL = 0, /*!< ANSI C */
|
||||
DL_XTENSA_IMPL = 1 /*!< Handwrite xtensa instruction */
|
||||
DL_C_IMPL = 0, /*!< ANSI C */
|
||||
DL_XTENSA_IMPL = 1 /*!< Handwrite xtensa instruction */
|
||||
} dl_conv_mode;
|
||||
|
||||
|
||||
/**
|
||||
* Configuration of mobilenet operation
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int stride_x; /*!< Strides of width */
|
||||
int stride_y; /*!< Strides of height */
|
||||
dl_padding_type padding; /*!< Padding type */
|
||||
dl_conv_mode mode; /*!< Implementation mode */
|
||||
int dilate_exponent; /*!< Exponent of dilation filter */
|
||||
int depthwise_exponent; /*!< Exponent of depthwise filter */
|
||||
int compress_exponent; /*!< Exponent of compress filter */
|
||||
int stride_x; /*!< Strides of width */
|
||||
int stride_y; /*!< Strides of height */
|
||||
dl_padding_type padding; /*!< Padding type */
|
||||
dl_conv_mode mode; /*!< Implementation mode */
|
||||
int dilate_exponent; /*!< Exponent of dilation filter */
|
||||
int depthwise_exponent; /*!< Exponent of depthwise filter */
|
||||
int compress_exponent; /*!< Exponent of compress filter */
|
||||
} dl_matrix3dq_mobilenet_config_t;
|
||||
|
||||
//
|
||||
@ -71,14 +70,52 @@ typedef struct
|
||||
* @param e Exponent of matrix data
|
||||
* @return 3d quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_alloc(int n, int w, int h, int c, int e);
|
||||
static inline dl_matrix3dq_t *dl_matrix3dq_alloc(int n, int w, int h, int c, int e)
|
||||
{
|
||||
dl_matrix3dq_t *r = (dl_matrix3dq_t *)dl_lib_calloc(1, sizeof(dl_matrix3dq_t), 0);
|
||||
if (NULL == r)
|
||||
{
|
||||
printf("dl_matrix3dq alloc failed.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qtp_t *items = (qtp_t *)dl_lib_calloc(n * w * h * c, sizeof(qtp_t), 16);
|
||||
if (NULL == items)
|
||||
{
|
||||
printf("matrix3dq item alloc failed.\n");
|
||||
dl_lib_free(r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
r->w = w;
|
||||
r->h = h;
|
||||
r->c = c;
|
||||
r->n = n;
|
||||
r->exponent = e;
|
||||
r->stride = w * c;
|
||||
r->item = items;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Free a 3d quantized matrix
|
||||
*
|
||||
* @param m 3d quantised matrix
|
||||
*/
|
||||
void dl_matrix3dq_free(dl_matrix3dq_t *m);
|
||||
static inline void dl_matrix3dq_free(dl_matrix3dq_t *m)
|
||||
{
|
||||
if (NULL == m)
|
||||
return;
|
||||
if (NULL == m->item)
|
||||
{
|
||||
dl_lib_free(m);
|
||||
return;
|
||||
}
|
||||
dl_lib_free(m->item);
|
||||
dl_lib_free(m);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Copy a range of items from an existing matrix to a preallocated matrix
|
||||
@ -92,6 +129,15 @@ void dl_matrix3dq_free(dl_matrix3dq_t *m);
|
||||
*/
|
||||
void dl_matrix3dq_slice_copy(dl_matrix3dq_t *dst, dl_matrix3dq_t *src, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* @brief Transform a sliced matrix block from nhwc to nchw, the block needs to be memory continous.
|
||||
*
|
||||
* @param out The destination sliced matrix in nchw
|
||||
* @param in The source sliced matrix in nhwc
|
||||
*/
|
||||
void dl_matrix3dq_sliced_transform_nchw(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in);
|
||||
|
||||
/**
|
||||
* @brief Transform a fixed point matrix to a float point matrix
|
||||
*
|
||||
@ -245,7 +291,8 @@ dl_matrix3dq_t *dl_matrix3dq_concat_8(dl_matrix3dq_t *in_1,
|
||||
void dl_matrix3dqq_conv_1x1(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix, with relu activation
|
||||
@ -258,7 +305,8 @@ void dl_matrix3dqq_conv_1x1(dl_matrix3dq_t *out,
|
||||
void dl_matrix3dqq_conv_1x1_with_relu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with a quantized matrix, with bias adding
|
||||
@ -290,13 +338,25 @@ void dl_matrix3dqq_conv_1x1_with_bias_relu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param out
|
||||
* @param in
|
||||
* @param filter
|
||||
* @param prelu
|
||||
* @param mode
|
||||
* @param name
|
||||
*/
|
||||
void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *prelu,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with an 8-bit fixed point matrix
|
||||
@ -309,7 +369,8 @@ void dl_matrix3dqq_conv_1x1_with_prelu(dl_matrix3dq_t *out,
|
||||
void dl_matrix3duq_conv_1x1(dl_matrix3dq_t *out,
|
||||
dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 1x1 convolution with an 8-bit fixed point matrix, with bias adding
|
||||
@ -324,66 +385,47 @@ void dl_matrix3duq_conv_1x1_with_bias(dl_matrix3dq_t *out,
|
||||
dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
//
|
||||
// Conv 3x3
|
||||
//
|
||||
/**
|
||||
* @brief Do 3x3 convolution basic operation with a quantized matrix
|
||||
*
|
||||
* @param out Preallocated quantized matrix
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
*/
|
||||
void dl_matrix3dqq_conv_3x3_op(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
int stride_y);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 convolution with a quantized matrix
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*
|
||||
* @param input Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @param name
|
||||
* @return dl_matrix3dq_t* Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3(dl_matrix3dq_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 convolution with a quantized matrix, with bias adding
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding Padding type, 0: valid, 1: same
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @return Resulting quantized matrix
|
||||
*
|
||||
* @param input Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @param name
|
||||
* @return dl_matrix3dq_t* Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias(dl_matrix3du_t *in,
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias(dl_matrix3dq_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
@ -392,7 +434,65 @@ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias(dl_matrix3du_t *in,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *in,
|
||||
/**
|
||||
* @brief Do 3x3 convolution with a quantized matrix, with bias adding, relu activation
|
||||
*
|
||||
* @param input Input matrix, size (1, w, h, c)
|
||||
* @param filter 3x3 filter, size (n, 3, 3, c)
|
||||
* @param bias Bias, size (1, 1, 1, n)
|
||||
* @param stride_x Stride of width
|
||||
* @param stride_y Stride of height
|
||||
* @param padding
|
||||
* @param exponent Exponent for resulting matrix
|
||||
* @param name
|
||||
* @return dl_matrix3dq_t* Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias_relu(dl_matrix3dq_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param input
|
||||
* @param filter
|
||||
* @param bias
|
||||
* @param stride_x
|
||||
* @param stride_y
|
||||
* @param padding
|
||||
* @param exponent
|
||||
* @param name
|
||||
* @return dl_matrix3dq_t*
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias(dl_matrix3du_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param input
|
||||
* @param filter
|
||||
* @param bias
|
||||
* @param prelu
|
||||
* @param stride_x
|
||||
* @param stride_y
|
||||
* @param padding
|
||||
* @param exponent
|
||||
* @param name
|
||||
* @return dl_matrix3dq_t*
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_matrix3dq_t *prelu,
|
||||
@ -402,6 +502,17 @@ dl_matrix3dq_t *dl_matrix3duq_conv_3x3_with_bias_prelu(dl_matrix3du_t *in,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_conv_3x3_with_bias_prelu(dl_matrix3dq_t *input,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_matrix3dq_t *prelu,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
char *name);
|
||||
//
|
||||
// Conv common
|
||||
//
|
||||
@ -469,7 +580,8 @@ dl_matrix3dq_t *dl_matrix3duq_depthwise_conv_3x3(dl_matrix3du_t *in,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with a quantized matrix
|
||||
@ -487,7 +599,8 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3(dl_matrix3dq_t *in,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
#if CONFIG_DEVELOPING_CODE
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_2(dl_matrix3dq_t *in,
|
||||
@ -495,14 +608,16 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_2(dl_matrix3dq_t *in,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_3(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -519,13 +634,14 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_3(dl_matrix3dq_t *in,
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do 3x3 depthwise convolution with a quantized matrix, with bias adding and stride 1
|
||||
@ -539,11 +655,12 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias(dl_matrix3dq_t *in,
|
||||
* @return Resulting quantized matrix
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3s1_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu);
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
int relu,
|
||||
char *name);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
@ -551,9 +668,25 @@ dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_prelu(dl_matrix3dq_t *in,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent);
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_depthwise_conv_3x3_with_bias_prelu(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *f,
|
||||
dl_matrix3dq_t *bias,
|
||||
dl_matrix3dq_t *prelu,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_global_depthwise_conv_with_bias(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_matrix3dq_t *bias,
|
||||
int exponent,
|
||||
char *name);
|
||||
|
||||
//
|
||||
// Depthwise Common
|
||||
//
|
||||
@ -594,11 +727,13 @@ void dl_matrix3dqq_dot_product(dl_matrix3dq_t *out,
|
||||
* @param in Input matrix, size (1, 1, 1, w)
|
||||
* @param filter Filter matrix, size (1, w, h, 1)
|
||||
* @param mode Implementation mode
|
||||
* @param name
|
||||
*/
|
||||
void dl_matrix3dqq_fc(dl_matrix3dq_t *out,
|
||||
dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *filter,
|
||||
dl_conv_mode mode);
|
||||
dl_conv_mode mode,
|
||||
char *name);
|
||||
|
||||
/**
|
||||
* @brief Do fully connected layer forward, with bias adding
|
||||
@ -695,6 +830,86 @@ dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock(dl_matrix3dq_t *in,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw,
|
||||
dl_matrix3dq_t *pw_bias,
|
||||
dl_matrix3dq_t *pw_prelu,
|
||||
dl_matrix3dq_t *dw,
|
||||
dl_matrix3dq_t *dw_bias,
|
||||
dl_matrix3dq_t *dw_prelu,
|
||||
dl_matrix3dq_t *pw_linear,
|
||||
dl_matrix3dq_t *pw_linear_bias,
|
||||
int pw_exponent,
|
||||
int dw_exponent,
|
||||
int pw_linear_exponent,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_2_2(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw_1,
|
||||
dl_matrix3dq_t *pw_2,
|
||||
dl_matrix3dq_t *pw_bias,
|
||||
dl_matrix3dq_t *pw_prelu,
|
||||
dl_matrix3dq_t *dw,
|
||||
dl_matrix3dq_t *dw_bias,
|
||||
dl_matrix3dq_t *dw_prelu,
|
||||
dl_matrix3dq_t *pw_linear_1,
|
||||
dl_matrix3dq_t *pw_linear_2,
|
||||
dl_matrix3dq_t *pw_linear_bias,
|
||||
int pw_exponent,
|
||||
int dw_exponent,
|
||||
int pw_linear_exponent,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_4_4(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw_1,
|
||||
dl_matrix3dq_t *pw_2,
|
||||
dl_matrix3dq_t *pw_3,
|
||||
dl_matrix3dq_t *pw_4,
|
||||
dl_matrix3dq_t *pw_bias,
|
||||
dl_matrix3dq_t *pw_prelu,
|
||||
dl_matrix3dq_t *dw,
|
||||
dl_matrix3dq_t *dw_bias,
|
||||
dl_matrix3dq_t *dw_prelu,
|
||||
dl_matrix3dq_t *pw_linear_1,
|
||||
dl_matrix3dq_t *pw_linear_2,
|
||||
dl_matrix3dq_t *pw_linear_3,
|
||||
dl_matrix3dq_t *pw_linear_4,
|
||||
dl_matrix3dq_t *pw_linear_bias,
|
||||
int pw_exponent,
|
||||
int dw_exponent,
|
||||
int pw_linear_exponent,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
|
||||
dl_matrix3dq_t *dl_matrix3dqq_mobilefaceblock_prelu_split_1_2(dl_matrix3dq_t *in,
|
||||
dl_matrix3dq_t *pw,
|
||||
dl_matrix3dq_t *pw_bias,
|
||||
dl_matrix3dq_t *pw_prelu,
|
||||
dl_matrix3dq_t *dw,
|
||||
dl_matrix3dq_t *dw_bias,
|
||||
dl_matrix3dq_t *dw_prelu,
|
||||
dl_matrix3dq_t *pw_linear_1,
|
||||
dl_matrix3dq_t *pw_linear_2,
|
||||
dl_matrix3dq_t *pw_linear_bias,
|
||||
int pw_exponent,
|
||||
int dw_exponent,
|
||||
int pw_linear_exponent,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
dl_conv_mode mode,
|
||||
int shortcut);
|
||||
//
|
||||
// Mobilenet
|
||||
//
|
||||
@ -749,23 +964,49 @@ dl_matrix3dq_t *dl_matrix3duq_mobilenet(dl_matrix3du_t *in,
|
||||
// Padding
|
||||
//
|
||||
|
||||
dl_error_type dl_matrix3dqq_padding(dl_matrix3dq_t **padded_in,
|
||||
dl_matrix3dq_t **out,
|
||||
dl_matrix3dq_t *in,
|
||||
int out_c,
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param padded_input
|
||||
* @param output_height
|
||||
* @param output_width
|
||||
* @param input
|
||||
* @param stride_x
|
||||
* @param stride_y
|
||||
* @param kernel_size
|
||||
* @param padding_type
|
||||
* @return dl_error_type
|
||||
*/
|
||||
dl_error_type dl_matrix3dqq_padding(dl_matrix3dq_t **padded_input,
|
||||
int *output_height,
|
||||
int *output_width,
|
||||
dl_matrix3dq_t *input,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
int padding,
|
||||
int exponent);
|
||||
int kernel_size,
|
||||
dl_padding_type padding_type);
|
||||
|
||||
dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_in,
|
||||
dl_matrix3dq_t **out,
|
||||
dl_matrix3du_t *in,
|
||||
int out_c,
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param padded_input
|
||||
* @param output_height
|
||||
* @param output_width
|
||||
* @param input
|
||||
* @param stride_x
|
||||
* @param stride_y
|
||||
* @param kernel_size
|
||||
* @param padding_type
|
||||
* @return dl_error_type
|
||||
*/
|
||||
dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_input,
|
||||
int *output_height,
|
||||
int *output_width,
|
||||
dl_matrix3du_t *input,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
int padding,
|
||||
int exponent);
|
||||
int kernel_size,
|
||||
dl_padding_type padding_type);
|
||||
|
||||
//
|
||||
// Pooling
|
||||
@ -777,3 +1018,23 @@ dl_error_type dl_matrix3duq_padding(dl_matrix3du_t **padded_in,
|
||||
* @return Resulting matrix, size (1, 1, 1, c)
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_global_pool(dl_matrix3dq_t *in);
|
||||
|
||||
/**
|
||||
* @brief Calculate pooling layer of a feature map
|
||||
*
|
||||
* @param in Input matrix, size (1, w, h, c)
|
||||
* @param f_w Window width
|
||||
* @param f_h Window height
|
||||
* @param stride_x Stride in horizontal direction
|
||||
* @param stride_y Stride in vertical direction
|
||||
* @param padding Padding type: PADDING_VALID and PADDING_SAME
|
||||
* @param pooling_type Pooling type: DL_POOLING_MAX and POOLING_AVG
|
||||
* @return Resulting matrix, size (1, w', h', c)
|
||||
*/
|
||||
dl_matrix3dq_t *dl_matrix3dq_pooling(dl_matrix3dq_t *in,
|
||||
int f_w,
|
||||
int f_h,
|
||||
int stride_x,
|
||||
int stride_y,
|
||||
dl_padding_type padding,
|
||||
dl_pooling_type pooling_type);
|
||||
|
Reference in New Issue
Block a user