Skip to content

Commit

Permalink
[CI] fix no_observer_set for pt19 (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
zk1998 authored Jun 4, 2024
1 parent 7de51e6 commit 8571617
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion tests/converter_op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4856,7 +4856,11 @@ def forward(self, x):
converter.convert()

dummy_output = model(dummy_input)
tfl_output = tfl_run_model(model_path, dummy_input.permute(0, 2, 3, 1), dummy_output).permute(0, 3, 1, 2)
tfl_output = (
tfl_run_model(model_path, dummy_input.permute(0, 2, 3, 1), dummy_output)
.permute(0, 3, 1, 2)
.contiguous()
)

def msg(*args, **kwargs):
return f'testing {type(func).__name__} failed: {args}'
Expand Down
6 changes: 2 additions & 4 deletions tinynn/graph/quantization/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3717,10 +3717,8 @@ def new_no_observer_set():
orig_no_observer_set
)
elif LooseVersion(torch.__version__) >= LooseVersion("1.9.0"):
orig_no_observer_set = torch.ao.quantization.quantization_mappings.no_observer_set
torch.ao.quantization.quantization_mappings.no_observer_set = patch_observer_set(
orig_no_observer_set
)
orig_no_observer_set = torch.quantization.quantization_mappings.no_observer_set
torch.quantization.quantization_mappings.no_observer_set = patch_observer_set(orig_no_observer_set)

add_observer_func(
graph.module,
Expand Down

0 comments on commit 8571617

Please sign in to comment.