(
self,
node: torch.fx.Node,
tosa_graph: Any,
inputs: List[TosaArg],
output: TosaArg,
)
| 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 | ) |
nothing calls this directly
no test coverage detected