Serialize an input node.
(
node: torch.fx.Node,
tosa_graph: Any,
tosa_spec: TosaSpecification,
)
| 103 | |
| 104 | |
| 105 | def process_inputs( |
| 106 | node: torch.fx.Node, |
| 107 | tosa_graph: Any, |
| 108 | tosa_spec: TosaSpecification, |
| 109 | ): |
| 110 | """Serialize an input node.""" |
| 111 | |
| 112 | try: |
| 113 | tosa_arg = TosaArg(node, tosa_spec) |
| 114 | except ValueError as e: |
| 115 | raise ValueError( |
| 116 | f"Failed processing input placeholder: {node.name}. " |
| 117 | "Is the original torch function supported?" |
| 118 | ) from e |
| 119 | |
| 120 | input_shape = tosa_arg.shape |
| 121 | tensor = ts.TosaSerializerTensor( |
| 122 | tosa_arg.name, |
| 123 | normalize_symint(input_shape), |
| 124 | tosa_arg.dtype, |
| 125 | data=None, |
| 126 | ) |
| 127 | tosa_graph.addInputTensor(tensor) |
| 128 | |
| 129 | |
| 130 | def process_inputs_to_parameters( |
no test coverage detected