From 3e4168d741c167d2d52b1a3fc9a800c101bba09b Mon Sep 17 00:00:00 2001 From: Mauricio Briceno Date: Wed, 9 Jun 2021 09:49:05 +0200 Subject: mlw_codec: Fixed alignment warning - Restructured pointer API to prevent alignment warnings - Changed weight tensor data type to np.int16 Change-Id: I310c1ca733bf98724c84e8b2194becb4be3e7eea --- ethosu/mlw_codec/mlw_encode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ethosu/mlw_codec/mlw_encode.c') diff --git a/ethosu/mlw_codec/mlw_encode.c b/ethosu/mlw_codec/mlw_encode.c index cac5e98b..02e92533 100644 --- a/ethosu/mlw_codec/mlw_encode.c +++ b/ethosu/mlw_codec/mlw_encode.c @@ -898,21 +898,21 @@ static int round_up(int num, int den) struct brick_buf_s { - uint8_t* buf; + int16_t* buf; int* strides; }; typedef struct brick_buf_s brick_buf_t; static int16_t get_brick_weight(brick_buf_t* buf, int ofm_z, int wy, int wx, int ifm_z) { - uint8_t* p = buf->buf; + int16_t* p = buf->buf; p += ofm_z * buf->strides[0]; p += wy * buf->strides[1]; p += wx * buf->strides[2]; p += ifm_z * buf->strides[3]; - return *(int16_t*)p; + return *p; } static void reorder_free(int16_t* buf) @@ -931,7 +931,7 @@ static int16_t* reorder( int kernel_width, int ifm_depth, int* strides, - void* inbuf, + int16_t* inbuf, int ofm_block_depth, int is_depthwise, int is_partkernel, @@ -1070,7 +1070,7 @@ int mlw_reorder_encode( int kernel_width, int ifm_depth, int* brick_strides, - void* inbuf, + int16_t* inbuf, int ofm_block_depth, int is_depthwise, int is_partkernel, -- cgit v1.2.1