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

Function _annotate_conv2d

backends/example/example_operators/conv2d.py:17–37  ·  view source on GitHub ↗

This is what the graph of a simple conv op looks like: l__self___conv_weight = self.L__self___conv_weight l__self___conv_bias = self.L__self___conv_bias convolution_default = torch.ops.aten.convolution.default(arg2_1, l__self___conv_weight, l__self___conv_bias, [1, 1], [1, 1], [1, 1

(partitions, quant_config)

Source from the content-addressed store, hash-verified

15
16
17def _annotate_conv2d(partitions, quant_config):
18 """
19 This is what the graph of a simple conv op looks like:
20 l__self___conv_weight = self.L__self___conv_weight
21 l__self___conv_bias = self.L__self___conv_bias
22 convolution_default = torch.ops.aten.convolution.default(arg2_1, l__self___conv_weight, l__self___conv_bias, [1, 1], [1, 1], [1, 1], False, [0, 0], 1); arg2_1 = l__self___conv_weight = l__self___conv_bias = None
23 """
24 conv_node = partitions[0].output_nodes[0]
25 input_node = conv_node.args[0]
26 weight_node = conv_node.args[1]
27
28 if _nodes_are_annotated([conv_node]):
29 return
30
31 _annotate_nodes(
32 [(conv_node, input_node)], quant_config.input_quant_spec, input_node=True
33 )
34 _annotate_nodes(
35 [(conv_node, weight_node)], quant_config.weight_quant_spec, input_node=True
36 )
37 _annotate_nodes([(conv_node,)], quant_config.output_quant_spec)
38
39
40# def _permuate_memory_format_pass(exported_program, partitions):

Callers

nothing calls this directly

Calls 2

_nodes_are_annotatedFunction · 0.90
_annotate_nodesFunction · 0.90

Tested by

no test coverage detected