Update logic to read builtin op code
PiperOrigin-RevId: 338017168 Change-Id: Ib5eadbf8d9d8ba4dc0c262f97728981d7d510690
This commit is contained in:
parent
c1841cf246
commit
fc9652f980
tensorflow/lite/tools
@ -319,6 +319,7 @@ cc_library(
|
||||
hdrs = ["list_flex_ops.h"],
|
||||
deps = [
|
||||
"//tensorflow/lite:framework",
|
||||
"//tensorflow/lite/schema:schema_utils",
|
||||
"@jsoncpp_git//:jsoncpp",
|
||||
],
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
#include "json/json.h"
|
||||
#include "tensorflow/lite/schema/schema_utils.h"
|
||||
#include "tensorflow/lite/tools/list_flex_ops.h"
|
||||
|
||||
namespace tflite {
|
||||
@ -40,7 +41,7 @@ void AddFlexOpsFromModel(const tflite::Model* model, OpKernelSet* flex_ops) {
|
||||
for (int i = 0; i < operators->size(); ++i) {
|
||||
const tflite::Operator* op = operators->Get(i);
|
||||
const tflite::OperatorCode* opcode = opcodes->Get(op->opcode_index());
|
||||
if (opcode->builtin_code() != tflite::BuiltinOperator_CUSTOM ||
|
||||
if (tflite::GetBuiltinCode(opcode) != tflite::BuiltinOperator_CUSTOM ||
|
||||
!tflite::IsFlexOp(opcode->custom_code()->c_str())) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user