Skip to content

Commit

Permalink
shape
Browse files Browse the repository at this point in the history
  • Loading branch information
i-evi committed Oct 2, 2020
1 parent 3a2931e commit df8d09b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cc_conv2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cc_tensor_t *cc_conv2d(const cc_tensor_t *inp,
const cc_tensor_t *inp_pad;
cc_int32 o_ch_size, p_ch_mem_size, o_ch_mem_size,
k_ch_mem_size, k_mem_size, num_omp_threads, i, j;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
char pad_name[CC_CONV2D_PAD_NAME_LEN];
#ifdef ENABLE_CC_ASSERT
cc_assert_zero(cc_tensor_dimension(inp) - CC_CNN2D_DIM);
Expand Down
4 changes: 2 additions & 2 deletions src/cc_dsc2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cc_tensor_t *cc_dw_conv2d(cc_tensor_t *inp,
cc_tensor_t *inp_pad, *oup = NULL;
cc_int32 o_ch_size, p_ch_mem_size, o_ch_mem_size,
k_ch_mem_size, k_mem_size, num_omp_threads, i;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
char pad_name[CC_CONV2D_PAD_NAME_LEN];
#ifdef ENABLE_CC_ASSERT
cc_assert_zero(cc_tensor_dimension(inp) - CC_CNN2D_DIM);
Expand Down Expand Up @@ -116,7 +116,7 @@ cc_tensor_t *cc_pw_conv2d(cc_tensor_t *inp, const cc_tensor_t *kernel,
cc_tensor_t *oup = NULL;
cc_int32 o_ch_size, o_ch_mem_size,
k_ch_mem_size, k_mem_size, num_omp_threads, i, j;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
#ifdef ENABLE_CC_ASSERT
cc_assert_zero(cc_tensor_dimension(inp) - CC_CNN2D_DIM);
cc_assert_zero(cc_tensor_dimension(kernel) - CC_CONV2D_KERNEL_DIM);
Expand Down
2 changes: 1 addition & 1 deletion src/cc_fmap2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cc_tensor_t *cc_fmap2d_flat(cc_tensor_t *inp, const char *name)
{
cc_tensor_t *flat = NULL;
cc_uint8 *sptr, *dptr;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
cc_int32 i, j ,ch_size, dt_size;
#ifdef ENABLE_CC_ASSERT
cc_assert_zero(cc_tensor_dimension(inp) - CC_CNN2D_DIM);
Expand Down
2 changes: 1 addition & 1 deletion src/cc_fmap2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum cc_cnn2d_shape {
CC_CNN2D_SHAPE_H,
CC_CNN2D_SHAPE_W,
CC_CNN2D_DIM,
CC_CNN2D_SHAPE_LEN
CC_CNN2D_SHAPE
};

cc_tensor_t *cc_fmap2d_bias(cc_tensor_t *inp,
Expand Down
6 changes: 4 additions & 2 deletions src/cc_fullycon.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ cc_tensor_t *cc_fully_connected(const cc_tensor_t *inp,
const cc_tensor_t *w, const cc_tensor_t *b, const char *name)
{
cc_tensor_t *oup = NULL;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
#ifdef ENABLE_CC_ASSERT
cc_assert(
(cc_tensor_dimension(w) == CC_CONV2D_KERNEL_DIM) ||
(cc_tensor_dimension(w) == CC_FULLYCON_KERNEL_DIM));
cc_assert_zero(cc_tensor_dimension(inp) - CC_CNN2D_DIM);
cc_assert_zero(cc_tensor_dimension(w) - CC_CONV2D_KERNEL_DIM);
cc_assert_zero(*inp->dtype - *w->dtype);
cc_assert_zero(*inp->dtype - *b->dtype);
cc_assert_zero(inp->shape[CC_CNN2D_SHAPE_C]
Expand Down
6 changes: 6 additions & 0 deletions src/cc_fullycon.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

#include "cc_tensor.h"

enum cc_fullycon_kernel {
CC_FULLYCON_KERNEL_O,
CC_FULLYCON_KERNEL_I,
CC_FULLYCON_KERNEL_DIM
};

cc_tensor_t *cc_fully_connected(const cc_tensor_t *inp,
const cc_tensor_t *w, const cc_tensor_t *b, const char *name);

Expand Down
2 changes: 1 addition & 1 deletion src/cc_pad2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cc_tensor_t *cc_pad2d(const cc_tensor_t *inp,
cc_int32 p, cc_int32 offset, const char *name)
{
cc_tensor_t *pad = NULL;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
cc_int32 soffset = offset ? 1 : 0;
cc_int32 poffset = offset > 0 ? 1 : 0;
cc_int32 i, j, c, dtsize = cc_dtype_size(*inp->dtype);
Expand Down
2 changes: 1 addition & 1 deletion src/cc_pool2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cc_tensor_t *cc_max_pool2d(
const cc_tensor_t *inp, cc_int32 s, const char *name)
{
cc_int32 i, i_ch_size, i_ch_mem_size, o_ch_size, o_ch_mem_size;
cc_int32 shape[CC_CNN2D_SHAPE_LEN] = {0};
cc_int32 shape[CC_CNN2D_SHAPE] = {0};
cc_tensor_t *pool = NULL;
#ifdef AUTO_TSRMGR
pool = cc_tsrmgr_get(name);
Expand Down

0 comments on commit df8d09b

Please sign in to comment.