MCPcopy Create free account
hub / github.com/pytorch/executorch / check_for_outside_users

Function check_for_outside_users

backends/example/example_quantizer.py:53–64  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

51
52
53def 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
67class ExampleQuantizer(Quantizer):

Callers 1

annotateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected