| 667 | } |
| 668 | |
| 669 | TEST(OperatorKeyTest, TestBuiltinOp) { |
| 670 | Model model; |
| 671 | auto op = absl::make_unique<ConvOperator>(); |
| 672 | |
| 673 | // Test a normal float operation. |
| 674 | op->inputs = {"input", "filter"}; |
| 675 | op->outputs = {"output"}; |
| 676 | Array& input_array = model.GetOrCreateArray(op->inputs[0]); |
| 677 | Array& filter_array = model.GetOrCreateArray(op->inputs[1]); |
| 678 | Array& output_array = model.GetOrCreateArray(op->outputs[0]); |
| 679 | input_array.data_type = ArrayDataType::kFloat; |
| 680 | filter_array.data_type = ArrayDataType::kFloat; |
| 681 | output_array.data_type = ArrayDataType::kFloat; |
| 682 | |
| 683 | const auto ops_by_type = BuildOperatorByTypeMap(); |
| 684 | const toco::OperatorSignature op_signature = {op.get(), &model}; |
| 685 | const auto key = details::OperatorKey(op_signature, ops_by_type, false); |
| 686 | |
| 687 | EXPECT_EQ(key.type(), ::tflite::BuiltinOperator_CONV_2D); |
| 688 | EXPECT_EQ(key.custom_code(), ""); |
| 689 | EXPECT_EQ(key.version(), 1); |
| 690 | } |
| 691 | |
| 692 | TEST(OperatorKeyTest, TestBuiltinOpWithVersionedInputTypes) { |
| 693 | Model model; |
nothing calls this directly
no test coverage detected