diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-14 17:09:57 -0700 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-18 18:50:08 +0000 |
commit | cc61be36c3b0f5cd1ea719e129a54fd48a6ee9a2 (patch) | |
tree | 2d664f87e3fdd75de8c6794f6f6c8d6364ece6bb /reference_model/src/ops/type_conversion.cc | |
parent | e807aae606a78d923a2565052f7c2179e3050650 (diff) | |
download | reference_model-cc61be36c3b0f5cd1ea719e129a54fd48a6ee9a2.tar.gz |
More ERROR_IF supports
- Also delay tensor allocation after operator being validated
ERROR_IF can be caught first before 0 or negative dimension set the graph_status to UNPREDICTABLE
- Rescale, Argmax, FullyConnected, Matmul, Pad, Reshape, Slice, Transpose, Clamp, Concat, Equal, Greater, GreaterEqual, Table
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: I4e1b3e5794fe195ce1a37e28443ae584645a3b91
Diffstat (limited to 'reference_model/src/ops/type_conversion.cc')
-rw-r--r-- | reference_model/src/ops/type_conversion.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/reference_model/src/ops/type_conversion.cc b/reference_model/src/ops/type_conversion.cc index 657eebf..e46ab38 100644 --- a/reference_model/src/ops/type_conversion.cc +++ b/reference_model/src/ops/type_conversion.cc @@ -30,7 +30,7 @@ OpRescale<Rank, InDtype, OutDtype>::OpRescale(SubgraphTraverser* sgt_, : GraphNode(sgt_, Op_RESCALE, id_) { setRequiredOperands(1, 1); - setRequiredRank(0, 6); + setRequiredRank(0, 4); INIT_ATTRIBUTE(Rescale); } @@ -64,6 +64,30 @@ int OpRescale<Rank, InDtype, OutDtype>::checkTensorAttributes() ASSERT_MEM(in && out); + if ((InDtype != DType_INT8) && (InDtype != DType_UINT8) && (attribute->input_zp() != 0)) + { + printNodeValidationError("OpRescale: Input DType not INT8/UINT8 and zero point not 0"); + return 1; + } + + if ((OutDtype != DType_INT8) && (OutDtype != DType_UINT8) && (attribute->output_zp() != 0)) + { + printNodeValidationError("OpRescale: Output DType not INT8/UINT8 and zero point not 0"); + return 1; + } + + if (attribute->scale32() && (InDtype == DType_INT48)) + { + printNodeValidationError("OpRescale: Scale set to true but input type is INT48"); + return 1; + } + + if ((!attribute->scale32()) && attribute->double_round()) + { + printNodeValidationError("OpRescale: Scale set to false but double round set to true"); + return 1; + } + return 0; } |