From d1f0494b89a31298df7743018c0a3fa388ac16a2 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 8 Oct 2018 22:13:04 -0700 Subject: Add Floor_mod to schema. PiperOrigin-RevId: 216303340 --- tensorflow/contrib/lite/builtin_ops.h | 1 + .../lite/core/api/flatbuffer_conversions.cc | 1 + tensorflow/contrib/lite/nnapi_delegate.cc | 1 + tensorflow/contrib/lite/schema/schema.fbs | 5 + tensorflow/contrib/lite/schema/schema_generated.h | 124 ++++++++++++++++++++- 5 files changed, 126 insertions(+), 6 deletions(-) diff --git a/tensorflow/contrib/lite/builtin_ops.h b/tensorflow/contrib/lite/builtin_ops.h index 7809d114e2..6117cbf9f1 100644 --- a/tensorflow/contrib/lite/builtin_ops.h +++ b/tensorflow/contrib/lite/builtin_ops.h @@ -120,6 +120,7 @@ typedef enum { kTfLiteBuiltinSquare = 92, kTfLiteBuiltinZerosLike = 93, kTfLiteBuiltinFill = 94, + kTfLiteBuiltinFloorMod = 95, } TfLiteBuiltinOperator; #ifdef __cplusplus diff --git a/tensorflow/contrib/lite/core/api/flatbuffer_conversions.cc b/tensorflow/contrib/lite/core/api/flatbuffer_conversions.cc index b092e5ee54..890d9c04bb 100644 --- a/tensorflow/contrib/lite/core/api/flatbuffer_conversions.cc +++ b/tensorflow/contrib/lite/core/api/flatbuffer_conversions.cc @@ -651,6 +651,7 @@ TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type, case BuiltinOperator_SQUARE: case BuiltinOperator_ZEROS_LIKE: case BuiltinOperator_FILL: + case BuiltinOperator_FLOOR_MOD: break; } return kTfLiteOk; diff --git a/tensorflow/contrib/lite/nnapi_delegate.cc b/tensorflow/contrib/lite/nnapi_delegate.cc index f23a0ccb80..c7005eb53e 100644 --- a/tensorflow/contrib/lite/nnapi_delegate.cc +++ b/tensorflow/contrib/lite/nnapi_delegate.cc @@ -679,6 +679,7 @@ TfLiteStatus AddOpsAndParams( case tflite::BuiltinOperator_SQUARE: case tflite::BuiltinOperator_ZEROS_LIKE: case tflite::BuiltinOperator_FILL: + case tflite::BuiltinOperator_FLOOR_MOD: logError("Op code %d is currently not delegated to NNAPI", builtin); return kTfLiteError; break; diff --git a/tensorflow/contrib/lite/schema/schema.fbs b/tensorflow/contrib/lite/schema/schema.fbs index cb7a282743..2b36209e5f 100644 --- a/tensorflow/contrib/lite/schema/schema.fbs +++ b/tensorflow/contrib/lite/schema/schema.fbs @@ -176,6 +176,7 @@ enum BuiltinOperator : byte { SQUARE = 92, ZEROS_LIKE = 93, FILL = 94, + FLOOR_MOD = 95, } // Options for the builtin operators. @@ -251,6 +252,7 @@ union BuiltinOptions { BidirectionalSequenceLSTMOptions, BidirectionalSequenceRNNOptions, UnidirectionalSequenceLSTMOptions, + FloorModOptions, } enum Padding : byte { SAME, VALID } @@ -618,6 +620,9 @@ table ZerosLikeOptions { table FillOptions { } +table FloorModOptions { +} + // An OperatorCode can be an enum value (BuiltinOperator) if the operator is a // builtin, or a string if the operator is custom. table OperatorCode { diff --git a/tensorflow/contrib/lite/schema/schema_generated.h b/tensorflow/contrib/lite/schema/schema_generated.h index e7b7a59def..3aaa99ec55 100755 --- a/tensorflow/contrib/lite/schema/schema_generated.h +++ b/tensorflow/contrib/lite/schema/schema_generated.h @@ -241,6 +241,9 @@ struct ZerosLikeOptionsT; struct FillOptions; struct FillOptionsT; +struct FloorModOptions; +struct FloorModOptionsT; + struct OperatorCode; struct OperatorCodeT; @@ -401,11 +404,12 @@ enum BuiltinOperator { BuiltinOperator_SQUARE = 92, BuiltinOperator_ZEROS_LIKE = 93, BuiltinOperator_FILL = 94, + BuiltinOperator_FLOOR_MOD = 95, BuiltinOperator_MIN = BuiltinOperator_ADD, - BuiltinOperator_MAX = BuiltinOperator_FILL + BuiltinOperator_MAX = BuiltinOperator_FLOOR_MOD }; -inline const BuiltinOperator (&EnumValuesBuiltinOperator())[94] { +inline const BuiltinOperator (&EnumValuesBuiltinOperator())[95] { static const BuiltinOperator values[] = { BuiltinOperator_ADD, BuiltinOperator_AVERAGE_POOL_2D, @@ -500,7 +504,8 @@ inline const BuiltinOperator (&EnumValuesBuiltinOperator())[94] { BuiltinOperator_REDUCE_ANY, BuiltinOperator_SQUARE, BuiltinOperator_ZEROS_LIKE, - BuiltinOperator_FILL + BuiltinOperator_FILL, + BuiltinOperator_FLOOR_MOD }; return values; } @@ -602,6 +607,7 @@ inline const char * const *EnumNamesBuiltinOperator() { "SQUARE", "ZEROS_LIKE", "FILL", + "FLOOR_MOD", nullptr }; return names; @@ -685,11 +691,12 @@ enum BuiltinOptions { BuiltinOptions_BidirectionalSequenceLSTMOptions = 69, BuiltinOptions_BidirectionalSequenceRNNOptions = 70, BuiltinOptions_UnidirectionalSequenceLSTMOptions = 71, + BuiltinOptions_FloorModOptions = 72, BuiltinOptions_MIN = BuiltinOptions_NONE, - BuiltinOptions_MAX = BuiltinOptions_UnidirectionalSequenceLSTMOptions + BuiltinOptions_MAX = BuiltinOptions_FloorModOptions }; -inline const BuiltinOptions (&EnumValuesBuiltinOptions())[72] { +inline const BuiltinOptions (&EnumValuesBuiltinOptions())[73] { static const BuiltinOptions values[] = { BuiltinOptions_NONE, BuiltinOptions_Conv2DOptions, @@ -762,7 +769,8 @@ inline const BuiltinOptions (&EnumValuesBuiltinOptions())[72] { BuiltinOptions_FillOptions, BuiltinOptions_BidirectionalSequenceLSTMOptions, BuiltinOptions_BidirectionalSequenceRNNOptions, - BuiltinOptions_UnidirectionalSequenceLSTMOptions + BuiltinOptions_UnidirectionalSequenceLSTMOptions, + BuiltinOptions_FloorModOptions }; return values; } @@ -841,6 +849,7 @@ inline const char * const *EnumNamesBuiltinOptions() { "BidirectionalSequenceLSTMOptions", "BidirectionalSequenceRNNOptions", "UnidirectionalSequenceLSTMOptions", + "FloorModOptions", nullptr }; return names; @@ -1139,6 +1148,10 @@ template<> struct BuiltinOptionsTraits { static const BuiltinOptions enum_value = BuiltinOptions_UnidirectionalSequenceLSTMOptions; }; +template<> struct BuiltinOptionsTraits { + static const BuiltinOptions enum_value = BuiltinOptions_FloorModOptions; +}; + struct BuiltinOptionsUnion { BuiltinOptions type; void *value; @@ -1738,6 +1751,14 @@ struct BuiltinOptionsUnion { return type == BuiltinOptions_UnidirectionalSequenceLSTMOptions ? reinterpret_cast(value) : nullptr; } + FloorModOptionsT *AsFloorModOptions() { + return type == BuiltinOptions_FloorModOptions ? + reinterpret_cast(value) : nullptr; + } + const FloorModOptionsT *AsFloorModOptions() const { + return type == BuiltinOptions_FloorModOptions ? + reinterpret_cast(value) : nullptr; + } }; bool VerifyBuiltinOptions(flatbuffers::Verifier &verifier, const void *obj, BuiltinOptions type); @@ -6241,6 +6262,46 @@ inline flatbuffers::Offset CreateFillOptions( flatbuffers::Offset CreateFillOptions(flatbuffers::FlatBufferBuilder &_fbb, const FillOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); +struct FloorModOptionsT : public flatbuffers::NativeTable { + typedef FloorModOptions TableType; + FloorModOptionsT() { + } +}; + +struct FloorModOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { + typedef FloorModOptionsT NativeTableType; + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && + verifier.EndTable(); + } + FloorModOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; + void UnPackTo(FloorModOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; + static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); +}; + +struct FloorModOptionsBuilder { + flatbuffers::FlatBufferBuilder &fbb_; + flatbuffers::uoffset_t start_; + explicit FloorModOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) + : fbb_(_fbb) { + start_ = fbb_.StartTable(); + } + FloorModOptionsBuilder &operator=(const FloorModOptionsBuilder &); + flatbuffers::Offset Finish() { + const auto end = fbb_.EndTable(start_); + auto o = flatbuffers::Offset(end); + return o; + } +}; + +inline flatbuffers::Offset CreateFloorModOptions( + flatbuffers::FlatBufferBuilder &_fbb) { + FloorModOptionsBuilder builder_(_fbb); + return builder_.Finish(); +} + +flatbuffers::Offset CreateFloorModOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); + struct OperatorCodeT : public flatbuffers::NativeTable { typedef OperatorCode TableType; BuiltinOperator builtin_code; @@ -6587,6 +6648,9 @@ struct Operator FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { const UnidirectionalSequenceLSTMOptions *builtin_options_as_UnidirectionalSequenceLSTMOptions() const { return builtin_options_type() == BuiltinOptions_UnidirectionalSequenceLSTMOptions ? static_cast(builtin_options()) : nullptr; } + const FloorModOptions *builtin_options_as_FloorModOptions() const { + return builtin_options_type() == BuiltinOptions_FloorModOptions ? static_cast(builtin_options()) : nullptr; + } const flatbuffers::Vector *custom_options() const { return GetPointer *>(VT_CUSTOM_OPTIONS); } @@ -6902,6 +6966,10 @@ template<> inline const UnidirectionalSequenceLSTMOptions *Operator::builtin_opt return builtin_options_as_UnidirectionalSequenceLSTMOptions(); } +template<> inline const FloorModOptions *Operator::builtin_options_as() const { + return builtin_options_as_FloorModOptions(); +} + struct OperatorBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; @@ -9286,6 +9354,29 @@ inline flatbuffers::Offset CreateFillOptions(flatbuffers::FlatBuffe _fbb); } +inline FloorModOptionsT *FloorModOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { + auto _o = new FloorModOptionsT(); + UnPackTo(_o, _resolver); + return _o; +} + +inline void FloorModOptions::UnPackTo(FloorModOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { + (void)_o; + (void)_resolver; +} + +inline flatbuffers::Offset FloorModOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { + return CreateFloorModOptions(_fbb, _o, _rehasher); +} + +inline flatbuffers::Offset CreateFloorModOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { + (void)_rehasher; + (void)_o; + struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FloorModOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; + return tflite::CreateFloorModOptions( + _fbb); +} + inline OperatorCodeT *OperatorCode::UnPack(const flatbuffers::resolver_function_t *_resolver) const { auto _o = new OperatorCodeT(); UnPackTo(_o, _resolver); @@ -9759,6 +9850,10 @@ inline bool VerifyBuiltinOptions(flatbuffers::Verifier &verifier, const void *ob auto ptr = reinterpret_cast(obj); return verifier.VerifyTable(ptr); } + case BuiltinOptions_FloorModOptions: { + auto ptr = reinterpret_cast(obj); + return verifier.VerifyTable(ptr); + } default: return false; } } @@ -10061,6 +10156,10 @@ inline void *BuiltinOptionsUnion::UnPack(const void *obj, BuiltinOptions type, c auto ptr = reinterpret_cast(obj); return ptr->UnPack(resolver); } + case BuiltinOptions_FloorModOptions: { + auto ptr = reinterpret_cast(obj); + return ptr->UnPack(resolver); + } default: return nullptr; } } @@ -10351,6 +10450,10 @@ inline flatbuffers::Offset BuiltinOptionsUnion::Pack(flatbuffers::FlatBuff auto ptr = reinterpret_cast(value); return CreateUnidirectionalSequenceLSTMOptions(_fbb, ptr, _rehasher).Union(); } + case BuiltinOptions_FloorModOptions: { + auto ptr = reinterpret_cast(value); + return CreateFloorModOptions(_fbb, ptr, _rehasher).Union(); + } default: return 0; } } @@ -10641,6 +10744,10 @@ inline BuiltinOptionsUnion::BuiltinOptionsUnion(const BuiltinOptionsUnion &u) FL value = new UnidirectionalSequenceLSTMOptionsT(*reinterpret_cast(u.value)); break; } + case BuiltinOptions_FloorModOptions: { + value = new FloorModOptionsT(*reinterpret_cast(u.value)); + break; + } default: break; } @@ -11003,6 +11110,11 @@ inline void BuiltinOptionsUnion::Reset() { delete ptr; break; } + case BuiltinOptions_FloorModOptions: { + auto ptr = reinterpret_cast(value); + delete ptr; + break; + } default: break; } value = nullptr; -- cgit v1.2.3