Skip to content

Commit 8a71aba

Browse files
committed
Sync from upstream TF.
1 parent 392b78f commit 8a71aba

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tensorflow/lite/tools/flatbuffer_utils.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"""
2222

2323
import copy
24-
import functools
2524
import random
2625
import re
2726
import struct
@@ -490,12 +489,7 @@ def get_options_as(
490489
):
491490
raise err
492491

493-
@functools.singledispatch
494-
def _get_opts(unused_op):
495-
return None
496-
497-
@_get_opts.register
498-
def _(op: schema_fb.Operator):
492+
if isinstance(op, schema_fb.Operator):
499493
if not is_opt_1_type:
500494
enum_val = getattr(schema_fb.BuiltinOptions2, base_type_name)
501495
opts_creator = schema_fb.BuiltinOptions2Creator
@@ -510,8 +504,7 @@ def _(op: schema_fb.Operator):
510504
return None
511505
return opts_creator(enum_val, raw_ops)
512506

513-
@_get_opts.register
514-
def _(op: schema_fb.OperatorT):
507+
elif isinstance(op, schema_fb.OperatorT):
515508
if is_opt_1_type:
516509
raw_ops_t = op.builtinOptions
517510
else:
@@ -520,4 +513,5 @@ def _(op: schema_fb.OperatorT):
520513
return None
521514
return raw_ops_t
522515

523-
return _get_opts(op)
516+
else:
517+
return None

0 commit comments

Comments
 (0)