diff --git a/ethosu/regor/tflite/tflite_supported_operators.cpp b/ethosu/regor/tflite/tflite_supported_operators.cpp index 6f47222156bf02894948b65cd291d35876935a3f..5cd6f57b9bb4052a57212f444b34a48a875cfd3e 100644 --- a/ethosu/regor/tflite/tflite_supported_operators.cpp +++ b/ethosu/regor/tflite/tflite_supported_operators.cpp @@ -574,6 +574,9 @@ bool TfLiteSupportedOperators::ConstraintConstParams(const Operation *op) { case OpType::Slice: case OpType::Mean: + case OpType::Pad: + case OpType::PadV2: + case OpType::MirrorPad: break; default: return true; @@ -722,6 +725,24 @@ bool TfLiteSupportedOperators::ConstraintSoftmax(const Operation *op) return true; } +bool TfLiteSupportedOperators::ConstraintPad(const Operation *op) +{ + OpType opType = op->Type(); + if ( opType != OpType::Pad && opType != OpType::PadV2 && opType != OpType::MirrorPad ) + { + return true; + } + auto params = op->Input(TensorUsage::Params); + assert(params); + const auto &pType = params->tensor->Type(); + if ( pType != DataType::Int32 && pType != DataType::Int64 ) + { + Failure(op, fmt::format("Params tensor with datatype: {}", DataTypeToString(pType)), "Params tensor must be Int32 or Int64."); + return false; + } + return true; +} + void TfLiteSupportedOperators::Failure(const Operation *op, const std::string &message, const std::string &constraint) { assert(op); @@ -778,6 +799,7 @@ TfLiteSupportedOperators::TfLiteSupportedOperators(IArchitectureConstraints *con &TfLiteSupportedOperators::ConstraintConstParams, &TfLiteSupportedOperators::ConstraintMean, &TfLiteSupportedOperators::ConstraintSoftmax, + &TfLiteSupportedOperators::ConstraintPad, }; } diff --git a/ethosu/regor/tflite/tflite_supported_operators.hpp b/ethosu/regor/tflite/tflite_supported_operators.hpp index 92552e418834f0946ed1a3e11fac8fecfa4f0c4d..b2e3ebbacf6fc5cfdc3490a4c0ec73f49ef33fa7 100644 --- a/ethosu/regor/tflite/tflite_supported_operators.hpp +++ b/ethosu/regor/tflite/tflite_supported_operators.hpp @@ -71,5 +71,6 @@ private: bool ConstraintConstParams(const Operation *op); bool ConstraintMean(const Operation *op); bool ConstraintSoftmax(const Operation *op); + bool ConstraintPad(const Operation *op); }; } // namespace regor