Skip to content

Commit

Permalink
Automated sync from github.com/tensorflow/tensorflow (#2158)
Browse files Browse the repository at this point in the history
BUG=automated sync from upstream
NO_CHECK_TFLITE_FILES=automated sync from upstream
  • Loading branch information
TFLM-bot authored Aug 9, 2023
1 parent ed7830f commit aa61a91
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions tensorflow/lite/builtin_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ typedef enum {
kTfLiteBuiltinBitcast = 159,
kTfLiteBuiltinBitwiseXor = 160,
kTfLiteBuiltinRightShift = 161,
kTfLiteBuiltinStablehloLogistic = 162,
} 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 @@ -899,6 +899,7 @@ TfLiteStatus ParseOpDataTfLite(const Operator* op, BuiltinOperator op_type,
case BuiltinOperator_SIGN:
case BuiltinOperator_BITCAST:
case BuiltinOperator_WHERE:
case BuiltinOperator_STABLEHLO_LOGISTIC:
return kTfLiteOk;
case BuiltinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES:
return kTfLiteError;
Expand Down
1 change: 1 addition & 0 deletions tensorflow/lite/python/schema_py_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ class BuiltinOperator(object):
BITCAST = 159
BITWISE_XOR = 160
RIGHT_SHIFT = 161
STABLEHLO_LOGISTIC = 162
# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite
Expand Down
3 changes: 3 additions & 0 deletions tensorflow/lite/schema/schema.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ enum BuiltinOperator : int32 {
BITCAST = 159,
BITWISE_XOR = 160,
RIGHT_SHIFT = 161,
// All Operators start with STABLEHLO_ prefixes are subject to change
// Many of the ops below can not be executed by TFlite runtime
STABLEHLO_LOGISTIC = 162, // WARNING: Do not have runtime support
}
// LINT.ThenChange(nnapi_linter/linter.proto)

Expand Down
13 changes: 8 additions & 5 deletions tensorflow/lite/schema/schema_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -1074,11 +1074,12 @@ enum BuiltinOperator : int32_t {
BuiltinOperator_BITCAST = 159,
BuiltinOperator_BITWISE_XOR = 160,
BuiltinOperator_RIGHT_SHIFT = 161,
BuiltinOperator_STABLEHLO_LOGISTIC = 162,
BuiltinOperator_MIN = BuiltinOperator_ADD,
BuiltinOperator_MAX = BuiltinOperator_RIGHT_SHIFT
BuiltinOperator_MAX = BuiltinOperator_STABLEHLO_LOGISTIC
};

inline const BuiltinOperator (&EnumValuesBuiltinOperator())[162] {
inline const BuiltinOperator (&EnumValuesBuiltinOperator())[163] {
static const BuiltinOperator values[] = {
BuiltinOperator_ADD,
BuiltinOperator_AVERAGE_POOL_2D,
Expand Down Expand Up @@ -1241,13 +1242,14 @@ inline const BuiltinOperator (&EnumValuesBuiltinOperator())[162] {
BuiltinOperator_SIGN,
BuiltinOperator_BITCAST,
BuiltinOperator_BITWISE_XOR,
BuiltinOperator_RIGHT_SHIFT
BuiltinOperator_RIGHT_SHIFT,
BuiltinOperator_STABLEHLO_LOGISTIC
};
return values;
}

inline const char * const *EnumNamesBuiltinOperator() {
static const char * const names[163] = {
static const char * const names[164] = {
"ADD",
"AVERAGE_POOL_2D",
"CONCATENATION",
Expand Down Expand Up @@ -1410,13 +1412,14 @@ inline const char * const *EnumNamesBuiltinOperator() {
"BITCAST",
"BITWISE_XOR",
"RIGHT_SHIFT",
"STABLEHLO_LOGISTIC",
nullptr
};
return names;
}

inline const char *EnumNameBuiltinOperator(BuiltinOperator e) {
if (flatbuffers::IsOutRange(e, BuiltinOperator_ADD, BuiltinOperator_RIGHT_SHIFT)) return "";
if (flatbuffers::IsOutRange(e, BuiltinOperator_ADD, BuiltinOperator_STABLEHLO_LOGISTIC)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesBuiltinOperator()[index];
}
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/lite/schema/schema_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ limitations under the License.
namespace tflite {

// The following GetBuiltinCode methods are the utility methods for reading
// builtin operatore code, ensuring compatibility issues between v3 and v3a
// builtin operator code, ensuring compatibility issues between v3 and v3a
// schema. Always the maximum value of the two fields always will be the correct
// value as follows:
//
// - Supporting schema version v3 models
//
// The `builtin_code` field is not available in the v3 models. Flatbuffer
// library will feed zero value, which is the default value in the v3a schema.
// The actual builtin operatore code value will exist in the
// The actual builtin operator code value will exist in the
// `deprecated_builtin_code` field. At the same time, it implies that
// `deprecated_builtin_code` >= `builtin_code` and the maximum value of the two
// fields will be same with `deprecated_builtin_code'.
Expand Down

0 comments on commit aa61a91

Please sign in to comment.