Skip to content

Commit

Permalink
Sync from upstream TF.
Browse files Browse the repository at this point in the history
  • Loading branch information
TFLM-bot committed Sep 12, 2023
1 parent c3cfd34 commit 0a5ea34
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 11 deletions.
1 change: 1 addition & 0 deletions tensorflow/lite/builtin_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ typedef enum {
kTfLiteBuiltinStablehloWhile = 200,
kTfLiteBuiltinStablehloGather = 201,
kTfLiteBuiltinStablehloTranspose = 202,
kTfLiteBuiltinDilate = 203,
} TfLiteBuiltinOperator;

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions tensorflow/lite/core/api/flatbuffer_conversions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type,
case BuiltinOperator_SIGN:
case BuiltinOperator_BITCAST:
case BuiltinOperator_WHERE:
case BuiltinOperator_DILATE:
return kTfLiteOk;
case BuiltinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES:
return kTfLiteError;
Expand Down
70 changes: 69 additions & 1 deletion tensorflow/lite/python/schema_py_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,7 @@ class BuiltinOperator(object):
STABLEHLO_WHILE = 200
STABLEHLO_GATHER = 201
STABLEHLO_TRANSPOSE = 202
DILATE = 203
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite
Expand Down Expand Up @@ -2005,6 +2006,7 @@ class BuiltinOptions2(object):
StablehloWhileOptions = 15
StablehloGatherOptions = 16
StablehloTransposeOptions = 17
DilateOptions = 18

def BuiltinOptions2Creator(unionType, table):
from flatbuffers.table import Table
Expand Down Expand Up @@ -2044,6 +2046,8 @@ def BuiltinOptions2Creator(unionType, table):
return StablehloGatherOptionsT.InitFromBuf(table.Bytes, table.Pos)
if unionType == BuiltinOptions2().StablehloTransposeOptions:
return StablehloTransposeOptionsT.InitFromBuf(table.Bytes, table.Pos)
if unionType == BuiltinOptions2().DilateOptions:
return DilateOptionsT.InitFromBuf(table.Bytes, table.Pos)
return None
# automatically generated by the FlatBuffers compiler, do not modify

Expand Down Expand Up @@ -3515,6 +3519,70 @@ def Pack(self, builder):
from flatbuffers.compat import import_numpy
np = import_numpy()

class DilateOptions(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = DilateOptions()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsDilateOptions(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def DilateOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)

# DilateOptions
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

def DilateOptionsStart(builder): builder.StartObject(0)
def Start(builder):
return DilateOptionsStart(builder)
def DilateOptionsEnd(builder): return builder.EndObject()
def End(builder):
return DilateOptionsEnd(builder)

class DilateOptionsT(object):

# DilateOptionsT
def __init__(self):
pass

@classmethod
def InitFromBuf(cls, buf, pos):
dilateOptions = DilateOptions()
dilateOptions.Init(buf, pos)
return cls.InitFromObj(dilateOptions)

@classmethod
def InitFromObj(cls, dilateOptions):
x = DilateOptionsT()
x._UnPack(dilateOptions)
return x

# DilateOptionsT
def _UnPack(self, dilateOptions):
if dilateOptions is None:
return

# DilateOptionsT
def Pack(self, builder):
DilateOptionsStart(builder)
dilateOptions = DilateOptionsEnd(builder)
return dilateOptions
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

from flatbuffers.compat import import_numpy
np = import_numpy()

class DimensionMetadata(object):
__slots__ = ['_tab']

Expand Down Expand Up @@ -7775,7 +7843,7 @@ def __init__(self):
self.largeCustomOptionsOffset = 0 # type: int
self.largeCustomOptionsSize = 0 # type: int
self.builtinOptions2Type = 0 # type: int
self.builtinOptions2 = None # type: Union[None, StablehloConcatenateOptionsT, StablehloBroadcastInDimOptionsT, StablehloSliceOptionsT, StablehloConvolutionOptionsT, StablehloCustomCallOptionsT, StablehloReduceOptionsT, StablehloScatterOptionsT, StablehloCompareOptionsT, StablehloDynamicSliceOptionsT, StablehloPadOptionsT, StablehloIotaOptionsT, StablehloDotGeneralOptionsT, StablehloReduceWindowOptionsT, StablehloSortOptionsT, StablehloWhileOptionsT, StablehloGatherOptionsT, StablehloTransposeOptionsT]
self.builtinOptions2 = None # type: Union[None, StablehloConcatenateOptionsT, StablehloBroadcastInDimOptionsT, StablehloSliceOptionsT, StablehloConvolutionOptionsT, StablehloCustomCallOptionsT, StablehloReduceOptionsT, StablehloScatterOptionsT, StablehloCompareOptionsT, StablehloDynamicSliceOptionsT, StablehloPadOptionsT, StablehloIotaOptionsT, StablehloDotGeneralOptionsT, StablehloReduceWindowOptionsT, StablehloSortOptionsT, StablehloWhileOptionsT, StablehloGatherOptionsT, StablehloTransposeOptionsT, DilateOptionsT]

@classmethod
def InitFromBuf(cls, buf, pos):
Expand Down
5 changes: 5 additions & 0 deletions tensorflow/lite/schema/schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ enum BuiltinOperator : int32 {
STABLEHLO_WHILE = 200, // WARNING: No runtime support
STABLEHLO_GATHER = 201, // WARNING: No runtime support
STABLEHLO_TRANSPOSE = 202, // WARNING: No runtime support
DILATE = 203,
}
// LINT.ThenChange(nnapi_linter/linter.proto)

Expand Down Expand Up @@ -621,6 +622,7 @@ union BuiltinOptions2{
StablehloWhileOptions,
StablehloGatherOptions,
StablehloTransposeOptions,
DilateOptions,
}

table StablehloGatherOptions{
Expand Down Expand Up @@ -1410,6 +1412,9 @@ table BitwiseXorOptions {
table RightShiftOptions {
}

table DilateOptions {
}

// An OperatorCode can be an enum value (BuiltinOperator) if the operator is a
// builtin, or a string if the operator is custom.
table OperatorCode {
Expand Down
Loading

0 comments on commit 0a5ea34

Please sign in to comment.