diff --git a/source/operator/prototype/reshape.c b/source/operator/prototype/reshape.c index 8a7a03b6b9c4505eac0c4401b79203afc7ce2356..1720e2a33e52409b76744fa54b5e8c0df176653d 100644 --- a/source/operator/prototype/reshape.c +++ b/source/operator/prototype/reshape.c @@ -30,6 +30,7 @@ #include "module/module.h" #include "utility/sys_port.h" #include "utility/vector.h" +#include "utility/log.h" #include @@ -115,6 +116,11 @@ static int infer_shape(struct node* node) else new_size *= temp; } + // check input and reshaped size + if (new_size != size) { + TLOG_ERR("Error: input elem num(%d) != reshaped elem num(%d)\n", size, new_size); + return -1; + } if (idx >= 0) {