Exemplo n.º 1
0
 def get_node_to_latency_mapping(fx_module: GraphModule):
     node_to_latency_mapping: Dict[Node, Nodelatency] = {}
     for node in fx_module.graph.nodes:
         if node.op not in {'output', 'placeholder', 'get_attr'}:
             if node.size_bytes.total_size == node.size_bytes.output_size:
                 node_to_latency_mapping[node] = NodeLatency(node.size_bytes.total_size, 1)
             else:
                 node_to_latency_mapping[node] = NodeLatency(node.size_bytes.total_size, node.size_bytes.output_size)
     return node_to_latency_mapping
Exemplo n.º 2
0
 def get_node_to_latency_mapping(fx_module: GraphModule):
     """Given a fx module, generate node latency for each node
        based on the size of each node
     """
     node_to_latency_mapping: Dict[Node, NodeLatency] = {}
     for node in fx_module.graph.nodes:
         if node.op not in {'output', 'placeholder', 'get_attr'}:
             if node.size_bytes.total_size == node.size_bytes.output_size:
                 node_to_latency_mapping[node] = NodeLatency(node.size_bytes.total_size, 2. * node.size_bytes.total_size)
             else:
                 node_to_latency_mapping[node] = NodeLatency(node.size_bytes.total_size, node.size_bytes.output_size)
     return node_to_latency_mapping