!21468 master codex fix 5

Merge pull request !21468 from zhaodezan/master_fix_magic
This commit is contained in:
i-robot 2021-08-09 03:31:37 +00:00 committed by Gitee
commit 2827618425
5 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,9 @@ int RangeInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **
if (!InferFlag(inputs, inputs_size)) {
return NNACL_INFER_INVALID;
}
if (GetElementNum(inputs[0]) < 1 || GetElementNum(inputs[1]) < 1 || GetElementNum(inputs[2]) < 1) {
return NNACL_ERR;
}
int shape_size = 0;
if (inputs_size == 3) {
if ((inputs[0]->data_ == NULL) || (inputs[1]->data_ == NULL) || (inputs[2]->data_ == NULL)) {

View File

@ -32,6 +32,9 @@ int HandleTwoInputs(const TensorC *const *inputs, ResizeParameter *param) {
if (data == NULL) {
return NNACL_INFER_INVALID;
}
if (GetElementNum(shape_tensor) < 4) {
return NNACL_ERR;
}
switch (shape_tensor->format_) {
case Format_NCHW:
param->new_height_ = data[2];

View File

@ -32,7 +32,7 @@ bool StridedSliceCheckInputs(const TensorC *const *inputs, size_t inputs_size) {
return true; // note: the original code is ndim_ <= in_shape_size
}
void ApplyBeginEndEllipsisMask(size_t ndim, int *begins, uint32_t *begins_mask, int *ends,
void ApplyBeginEndEllipsisMask(size_t ndim, int *begins, const uint32_t *const begins_mask, int *ends,
const uint32_t *const ends_mask, const uint32_t *const ellipsis_mask,
const int *const in_shape) {
for (size_t i = 0; i < ndim; i++) {

View File

@ -58,12 +58,6 @@ int TensorListFromTensorInferShape(const TensorC *const *inputs, size_t inputs_s
free(tensor_shape.shape_);
return NNACL_NULL_PTR;
}
if (dim0 < 0) {
free(tensor_shape.shape_);
free(tensor_shape.shape_size_);
return NNACL_ERR;
}
for (int i = 0; i < dim0; i++) {
tensor_shape.shape_[i] = (int *)(input0->shape_ + 1);
tensor_shape.shape_size_[i] = (int)(input0->shape_size_) - 1;

View File

@ -94,7 +94,7 @@ int TileInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o
ShapePush(out_shape, &out_shape_size, input->shape_[i]);
}
for (size_t i = 0; i < dims_size; ++i) {
if (input->shape_[dims[i]] == 0 || dims[i] >= MAX_SHAPE_SIZE) {
if (dims[i] >= MAX_SHAPE_SIZE || input->shape_[dims[i]] == 0) {
return NNACL_ERR;
}
if (input->shape_[dims[i]] != 0 && param->multiples_[i] > INT_MAX / input->shape_[dims[i]]) {