fix(fx): drop the dynamic_range argument from the 8 remaining mark_as_int8_layer calls - #4651
fix(fx): drop the dynamic_range argument from the 8 remaining mark_as_int8_layer calls#4651Anai-Guo wants to merge 2 commits into
Conversation
…_int8_layer calls 13873bd ("remove dynamic_range in fx", pytorch#4221) changed mark_as_int8_layer(layer, dynamic_range) to mark_as_int8_layer(layer) and cleaned up 6 files, but 8 call sites across 5 files still pass two positional arguments and raise TypeError: mark_as_int8_layer() takes 1 positional argument but 2 were given on every quantized conversion that reaches them: add.py:47/64/70, batchnorm.py:21, linear.py:43/51, mul.py:46 and impl/convolution.py:130. linear.py:27, the one site pytorch#4221 did update, is the intended shape. Follows the same idiom as pytorch#4221: keep the call, drop the argument, and remove the get_dyn_range() computations and imports that become unused. get_dyn_range itself is kept -- quantization.py still uses it.
micwill755
left a comment
There was a problem hiding this comment.
After this change, get_dyn_range has no remaining callers. #4221 already removed the last use in quantization.py and left only the import.
Could you also delete get_dyn_range from converter_utils.py and the unused import in quantization.py? It's leftover from the old ITensor.dynamic_range path which TRT 10 no longer exposes.
Per review: after dropping the extra `get_dyn_range(...)` argument from the eight `mark_as_int8_layer` call sites, and after pytorch#4221 removed the last use in quantization.py, `get_dyn_range` has no remaining callers. It is leftover from the old `ITensor.dynamic_range` path that TRT 10 no longer exposes. Delete the helper from converter_utils.py and drop the now-unused import in quantization.py.
|
Thanks @micwill755 — done in
Confirmed there are no other references left in the repo — the only remaining hits for
|
|
Small note on the red checks here, since they are unrelated to this PR.
That literal stopped existing on This PR only touches Everything you asked for is in |
Problem
13873bd "remove dynamic_range in fx" (#4221) changed
and cleaned up
adaptive_avgpool.py,impl/activation.py,maxpool.py,quantization.py,transformation.pyand one of the three sites inlinear.py. Eight call sites were missed and still pass two positionalarguments:
Replaying every
mark_as_int8_layer(...)call site infx/converters/againstthe signature parsed out of
converter_utils.pyonmain:Each one sits behind an
is_quantized/scale is not Noneguard, so it isreached by quantized
add,add_relu,mul,BatchNorm,LinearandConvconversion through the FX path.Fix
Same idiom #4221 used for
linear.py:27: keep the call, drop the argument.Where the argument was the only consumer of a
get_dyn_range(...)result, thecomputation and the now-unused import go too.
get_dyn_rangeitself is kept —quantization.pystill uses it.Note the two shapes #4221 dealt with: sites guarded by
if input_val.dynamic_range:were deleted whole (that attribute is gone in TRT 10), while sites guarded by
if is_quantized:kept the call. All eight sites here are the second kind, sonone of them are deleted.
Checks
black(26.3.1, the pinned pre-commit rev) reports all five files unchanged.pyflakesis clean on the patched files — the one remaining note,'typing.Any' imported but unusedinimpl/convolution.py, is pre-existing onmainand untouched here.🤖 Generated with Claude Code