| 104 | ) |
| 105 | |
| 106 | def validate( |
| 107 | self, |
| 108 | *, |
| 109 | target: str, |
| 110 | inputs: List[TosaArg], |
| 111 | output: TosaArg, |
| 112 | num_inputs: int | List[int], |
| 113 | input_dtypes: List[Any], |
| 114 | output_dtypes: Optional[List[Any]] = None, |
| 115 | same_dtype_with_output: bool = True, |
| 116 | dtype_check_inputs_only: bool = False, |
| 117 | ) -> None: |
| 118 | validate_num_inputs(target, inputs, num_inputs) |
| 119 | if same_dtype_with_output: |
| 120 | validate_same_dtype(target, [*inputs, output], ts) |
| 121 | else: |
| 122 | validate_same_dtype(target, inputs, ts) |
| 123 | |
| 124 | dtype_check_tensors = inputs if dtype_check_inputs_only else [*inputs, output] |
| 125 | validate_valid_dtype( |
| 126 | target, |
| 127 | dtype_check_tensors, |
| 128 | input_dtypes, |
| 129 | self.tosa_spec, |
| 130 | ) |
| 131 | if output_dtypes is not None: |
| 132 | validate_valid_dtype( |
| 133 | target, |
| 134 | output, |
| 135 | output_dtypes, |
| 136 | self.tosa_spec, |
| 137 | ) |
| 138 | |
| 139 | def serialize( |
| 140 | self, |