Skip to content

Commit 83a0238

Browse files
committed
Fix static_quantization_tutorial error in qat_model
The model must be in eval mode to fuse and in train mode to prepare_qat. After this fix, the tutorial runs to completion on a linux x86 system. Fixes #1269 Signed-off-by: BJ Hargrave <[email protected]>
1 parent 105e952 commit 83a0238

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: advanced_source/static_quantization_tutorial.rst

+2
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,9 @@ We fuse modules as before
533533
.. code:: python
534534
535535
qat_model = load_model(saved_model_dir + float_model_file)
536+
qat_model.eval()
536537
qat_model.fuse_model()
538+
qat_model.train()
537539
538540
optimizer = torch.optim.SGD(qat_model.parameters(), lr = 0.0001)
539541
# The old 'fbgemm' is still available but 'x86' is the recommended default.

0 commit comments

Comments
 (0)