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

Method define_node

backends/arm/operators/op_mul.py:29–62  ·  view source on GitHub ↗
(
        self,
        node: torch.fx.Node,
        tosa_graph: Any,
        inputs: List[TosaArg],
        output: TosaArg,
    )

Source from the content-addressed store, hash-verified

27 target = "aten.mul.Tensor"
28
29 def define_node(
30 self,
31 node: torch.fx.Node,
32 tosa_graph: Any,
33 inputs: List[TosaArg],
34 output: TosaArg,
35 ) -> None:
36 validate_num_inputs(self.target, inputs, 2)
37 validate_same_dtype(self.target, [*inputs, output], ts)
38 validate_valid_dtype(
39 self.target,
40 [*inputs, output],
41 [
42 ts.DType.INT8,
43 ts.DType.INT16,
44 ts.DType.INT32,
45 ts.DType.FP32,
46 ts.DType.BF16,
47 ts.DType.FP16,
48 ],
49 self.tosa_spec,
50 )
51
52 tosa_graph.addConst([1], ts.DType.INT8, 0, name=f"{output.name}_shift")
53 attr = ts.TosaSerializerAttribute()
54 attr.MulAttribute()
55 self._serialize_operator(
56 node,
57 tosa_graph,
58 ts.Op.MUL,
59 [inputs[0].name, inputs[1].name, f"{output.name}_shift"],
60 [output.name],
61 attr,
62 )

Callers

nothing calls this directly

Calls 5

validate_num_inputsFunction · 0.90
validate_same_dtypeFunction · 0.90
validate_valid_dtypeFunction · 0.90
addConstMethod · 0.80
_serialize_operatorMethod · 0.80

Tested by

no test coverage detected