Added versioning.
Change-Id: Ie0d7bbb9798dd4d06493537a0f44ca18f8a07a5f
This commit is contained in:
parent
9ca8d0cdc1
commit
f81de276db
@ -134,7 +134,7 @@ BuiltinOpResolver::BuiltinOpResolver() {
|
||||
/* max_version = */ 4);
|
||||
AddBuiltin(BuiltinOperator_TRANSPOSE, Register_TRANSPOSE(),
|
||||
/* min_version = */ 1,
|
||||
/* max_version = */ 4);
|
||||
/* max_version = */ 5);
|
||||
AddBuiltin(BuiltinOperator_MEAN, Register_MEAN(),
|
||||
/* min_version = */ 1,
|
||||
/* max_version = */ 3);
|
||||
@ -201,7 +201,7 @@ BuiltinOpResolver::BuiltinOpResolver() {
|
||||
AddBuiltin(BuiltinOperator_SELECT_V2, Register_SELECT_V2());
|
||||
AddBuiltin(BuiltinOperator_SLICE, Register_SLICE(),
|
||||
/* min_version = */ 1,
|
||||
/* max_version = */ 3);
|
||||
/* max_version = */ 4);
|
||||
AddBuiltin(BuiltinOperator_SIN, Register_SIN());
|
||||
AddBuiltin(BuiltinOperator_COS, Register_COS());
|
||||
AddBuiltin(BuiltinOperator_TRANSPOSE_CONV, Register_TRANSPOSE_CONV(),
|
||||
|
@ -121,6 +121,7 @@ std::string GetMinimumRuntimeVersionForModel(const Model& model) {
|
||||
{{OperatorType::kTranspose, 1}, "1.6.0"},
|
||||
{{OperatorType::kTranspose, 2}, "1.14.0"},
|
||||
{{OperatorType::kTranspose, 3}, "1.15.0"},
|
||||
{{OperatorType::kTranspose, 5}, kPendingReleaseOpVersion},
|
||||
{{OperatorType::kLstmCell, 1}, "1.7.0"},
|
||||
{{OperatorType::kLstmCell, 2}, "1.10.0"},
|
||||
{{OperatorType::kLstmCell, 3}, "1.14.0"},
|
||||
@ -176,6 +177,7 @@ std::string GetMinimumRuntimeVersionForModel(const Model& model) {
|
||||
{{OperatorType::kSlice, 1}, "1.14.0"},
|
||||
{{OperatorType::kSlice, 2}, "1.14.0"},
|
||||
{{OperatorType::kSlice, 3}, "1.14.0"},
|
||||
{{OperatorType::kSlice, 4}, kPendingReleaseOpVersion},
|
||||
{{OperatorType::kTanh, 1}, "1.14.0"},
|
||||
{{OperatorType::kTanh, 2}, "1.14.0"},
|
||||
{{OperatorType::kTanh, 3}, kPendingReleaseOpVersion},
|
||||
|
@ -237,6 +237,9 @@ int GetBuiltinOperatorVersion(const OpSignature& op_sig) {
|
||||
return 1;
|
||||
|
||||
case BuiltinOperator_TRANSPOSE:
|
||||
if (op_sig.input_types.at(0) == TensorType_INT16) {
|
||||
return 5;
|
||||
}
|
||||
if (op_sig.options.single_input_op.num_dims > 4) {
|
||||
return 4;
|
||||
}
|
||||
@ -320,6 +323,9 @@ int GetBuiltinOperatorVersion(const OpSignature& op_sig) {
|
||||
return 1;
|
||||
|
||||
case BuiltinOperator_SLICE:
|
||||
if (op_sig.input_types.at(0) == TensorType_INT16) {
|
||||
return 4;
|
||||
}
|
||||
// Version 3 supports string input types.
|
||||
if (op_sig.input_types.at(0) == TensorType_STRING) {
|
||||
return 3;
|
||||
|
@ -216,6 +216,12 @@ TEST(OpVersionTest, VersioningSpaceToDepthTest) {
|
||||
|
||||
TEST(OpVersionTest, VersioningSliceTest) {
|
||||
OpSignature fake_op_sig = {
|
||||
.op = BuiltinOperator_SLICE,
|
||||
.input_types = std::vector<TensorType>{TensorType_INT16},
|
||||
};
|
||||
EXPECT_EQ(GetBuiltinOperatorVersion(fake_op_sig), 4);
|
||||
|
||||
fake_op_sig = {
|
||||
.op = BuiltinOperator_SLICE,
|
||||
.input_types = std::vector<TensorType>{TensorType_STRING},
|
||||
};
|
||||
@ -587,6 +593,12 @@ TEST(OpVersionTest, VersioningTileOperatorTest) {
|
||||
}
|
||||
TEST(OpVersionTest, VersioningTransposeTest) {
|
||||
OpSignature fake_op_sig = {
|
||||
.op = BuiltinOperator_TRANSPOSE,
|
||||
.input_types = std::vector<TensorType>{TensorType_INT16},
|
||||
};
|
||||
EXPECT_EQ(GetBuiltinOperatorVersion(fake_op_sig), 5);
|
||||
|
||||
fake_op_sig = {
|
||||
.op = BuiltinOperator_TRANSPOSE,
|
||||
.input_types = std::vector<TensorType>{TensorType_BOOL},
|
||||
};
|
||||
|
@ -156,6 +156,7 @@ std::string FindMinimumRuntimeVersionForOp(tflite::BuiltinOperator op_code,
|
||||
{{BuiltinOperator_TRANSPOSE, 2}, "1.14.0"},
|
||||
{{BuiltinOperator_TRANSPOSE, 3}, "1.15.0"},
|
||||
{{BuiltinOperator_TRANSPOSE, 4}, "2.3.0"},
|
||||
{{BuiltinOperator_TRANSPOSE, 5}, kPendingReleaseVersion},
|
||||
{{BuiltinOperator_LSTM, 1}, "1.7.0"},
|
||||
{{BuiltinOperator_LSTM, 2}, "1.10.0"},
|
||||
{{BuiltinOperator_LSTM, 3}, "1.14.0"},
|
||||
@ -223,6 +224,7 @@ std::string FindMinimumRuntimeVersionForOp(tflite::BuiltinOperator op_code,
|
||||
{{BuiltinOperator_SLICE, 1}, "1.14.0"},
|
||||
{{BuiltinOperator_SLICE, 2}, "1.14.0"},
|
||||
{{BuiltinOperator_SLICE, 3}, "1.14.0"},
|
||||
{{BuiltinOperator_SLICE, 4}, kPendingReleaseVersion},
|
||||
{{BuiltinOperator_TANH, 1}, "1.14.0"},
|
||||
{{BuiltinOperator_TANH, 2}, "1.14.0"},
|
||||
{{BuiltinOperator_TANH, 3}, "2.3.0"},
|
||||
|
Loading…
Reference in New Issue
Block a user