Make sure that all the users of this partiton are within the delegatable subgraph, except the last partition. If we quantize partitions that have users outside this subgraph then delegation of this partition to the backend will not be possible.
(partitions)
| 51 | |
| 52 | |
| 53 | def check_for_outside_users(partitions) -> bool: |
| 54 | """ |
| 55 | Make sure that all the users of this partiton are within the delegatable subgraph, |
| 56 | except the last partition. If we quantize partitions that have users outside this |
| 57 | subgraph then delegation of this partition to the backend will not be possible. |
| 58 | """ |
| 59 | for source_partition in partitions[:-1]: |
| 60 | if len(source_partition.output_nodes) != 1: |
| 61 | return True |
| 62 | if len(source_partition.output_nodes[0].users) != 1: |
| 63 | return True |
| 64 | return False |
| 65 | |
| 66 | |
| 67 | class ExampleQuantizer(Quantizer): |