(self)
| 678 | self.assertEqual(deserialized.named_data, None) |
| 679 | |
| 680 | def test_no_constants(self) -> None: |
| 681 | program = get_test_program() |
| 682 | # Insert placeholder for non-const tensors. |
| 683 | add_constant_data(program, [b""]) |
| 684 | |
| 685 | pte_data = bytes( |
| 686 | serialize_pte_binary( |
| 687 | PTEFile(program=program), |
| 688 | extract_delegate_segments=True, |
| 689 | segment_alignment=SEGMENT_ALIGNMENT, |
| 690 | constant_tensor_alignment=CONSTANT_TENSOR_ALIGNMENT, |
| 691 | ) |
| 692 | ) |
| 693 | # The input Program should not be modified. |
| 694 | self.assertEqual(program.segments, []) |
| 695 | |
| 696 | # Peek inside the actual flatbuffer data to see the segments. |
| 697 | flatbuffer_program = _json_to_program(_program_flatbuffer_to_json(pte_data)) |
| 698 | |
| 699 | # Constant buffer should be empty. |
| 700 | self.assertEqual(len(flatbuffer_program.constant_buffer), 0) |
| 701 | |
| 702 | # Constant segment should contain the placeholder. |
| 703 | self.assertEqual(flatbuffer_program.constant_segment.segment_index, 0) |
| 704 | self.assertEqual(len(flatbuffer_program.constant_segment.offsets), 1) |
| 705 | self.assertEqual(flatbuffer_program.constant_segment.offsets[0], 0) |
| 706 | |
| 707 | def test_unused_inline_delegate_blobs_with_segments(self) -> None: |
| 708 | # Create a program with some delegate data blobs. |
nothing calls this directly
no test coverage detected