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

Method define_node

backends/apple/mps/operators/normalization_ops.py:71–97  ·  view source on GitHub ↗
(
        self,
        node: torch.fx.Node,
        mps_graph: MPSGraph,
    )

Source from the content-addressed store, hash-verified

69 super().__init__(*args)
70
71 def define_node(
72 self,
73 node: torch.fx.Node,
74 mps_graph: MPSGraph,
75 ) -> None:
76
77 input1_id = self.define_tensor(get_input_node(node, 0), mps_graph)
78 normalized_shape = eval_shape(cast(List[torch.SymInt], node.args[1]))
79 weight_id = self.define_tensor(get_input_node(node, 2), mps_graph)
80 bias_id = self.define_tensor(get_input_node(node, 3), mps_graph)
81 epsilon: float = get_scalar_val(node, 4)
82 output1_id, output2_id, output3_id = self.define_tensor_list(node, mps_graph)
83
84 mps_graph.mps_nodes.append(
85 MPSNode(
86 mpsnode_union=MPSLayerNorm(
87 input1_id=input1_id,
88 normalized_shape=normalized_shape,
89 weight_id=weight_id,
90 bias_id=bias_id,
91 eps=epsilon,
92 output1_id=output1_id,
93 output2_id=output2_id,
94 output3_id=output3_id,
95 )
96 )
97 )

Callers

nothing calls this directly

Calls 8

get_input_nodeFunction · 0.90
eval_shapeFunction · 0.90
get_scalar_valFunction · 0.90
MPSNodeClass · 0.90
MPSLayerNormClass · 0.90
define_tensor_listMethod · 0.80
define_tensorMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected