|
12 | 12 | from typing import Any, Tuple
|
13 | 13 |
|
14 | 14 | import serializer.tosa_serializer as ts # type: ignore
|
15 |
| -import torch.fx |
16 |
| -import torch.fx.node |
17 | 15 |
|
18 | 16 | from executorch.backends.arm._passes.fold_qdq_with_annotated_qparams_pass import (
|
19 | 17 | get_input_qparams,
|
@@ -351,38 +349,3 @@ def build_rescale_from_int32(
|
351 | 349 | ) # type: ignore[call-arg]
|
352 | 350 |
|
353 | 351 | return
|
354 |
| - |
355 |
| - |
356 |
| -""" Creates a TOSA rescale op based on conv2d parameters. """ |
357 |
| - |
358 |
| - |
359 |
| -def build_rescale_conv_output( |
360 |
| - tosa_fb: Any, |
361 |
| - op: Any, |
362 |
| - output_name: str, |
363 |
| - output_type: Any, |
364 |
| - input_scale: list[float], |
365 |
| - weight_scale: list[float], |
366 |
| - output_scale: list[float], |
367 |
| - output_zp: list[int], |
368 |
| - tosa_spec=None, |
369 |
| -): |
370 |
| - # TODO add check to verify if this is a Per-channel quantization. |
371 |
| - post_conv2d_scale = [ |
372 |
| - (inp * w) / out for inp, w, out in zip(input_scale, weight_scale, output_scale) |
373 |
| - ] |
374 |
| - |
375 |
| - # For TOSA v1.0 multipliers, shifts, input_zp and output_zp are now inputs |
376 |
| - # to the RESCALE op see: https://www.mlplatform.org/tosa/tosa_spec.html#_rescale |
377 |
| - build_rescale( |
378 |
| - tosa_fb=tosa_fb, |
379 |
| - scale=post_conv2d_scale, |
380 |
| - input_node=op, |
381 |
| - output_name=output_name, |
382 |
| - output_type=output_type, |
383 |
| - input_zp=[0], |
384 |
| - output_zp=output_zp, |
385 |
| - rounding_mode=RoundingMode.SINGLE_ROUND, |
386 |
| - per_channel=isinstance(weight_scale, torch.Tensor), |
387 |
| - ) # type: ignore[call-arg] |
388 |
| - return |
0 commit comments