diff --git a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp index fd657dcdeca6ed86b55db5f567b2d787edd4961a..090530d9ef08ec58a91eeda3784e5f6d2b2551c0 100644 --- a/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp +++ b/ethosu/regor/architecture/ethosu55/ethos_u55_constraints.cpp @@ -281,6 +281,12 @@ bool EthosU55Constraints::SupportedDtypes(OpType opType, DataType ifmType, DataT // Validate that zero-points are supported bool EthosU55Constraints::SupportedZeroPoint(int64_t zp, TensorUsage usage, DataType dType, OpType opType) { + if ( !IsSignedInteger(dType) && zp < 0 ) + { + // must be non-negative for unsigned data types + return false; + } + if ( IsIFM(usage) ) { // must be zero for 32-bit IFM and for CLZ or SHL operations diff --git a/ethosu/regor/compiler/tflite_graph_optimiser.cpp b/ethosu/regor/compiler/tflite_graph_optimiser.cpp index 5e722813d24c48e7479b8f84d0bc7f9cffd5afc7..ce1369f434b6fa37ecc07b416ec4c0e4cef1c05e 100644 --- a/ethosu/regor/compiler/tflite_graph_optimiser.cpp +++ b/ethosu/regor/compiler/tflite_graph_optimiser.cpp @@ -2648,8 +2648,14 @@ Operation *TFLiteGraphOptimiser::ConvertZeroPoint(Graph *const graph, Operation // quantization which may require legalization depending on which hardware is targeted. Operation *TFLiteGraphOptimiser::LegalizeAsymmetricQuantization(Graph *const graph, Operation *const operation) { + UNUSED(graph); auto returnOp = operation; OpType opType = operation->Type(); + if ( opType == OpType::Passthrough ) + { + return returnOp; + } + TensorConnection *ifmConn = operation->Input(TensorUsage::IFM); if ( ifmConn->quantization.zeroPoints.size() == 0 ) {