-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Quantization modules for dynamic and static quantization. Addit…
…ionally, added abstraction for quantizing input data
- Loading branch information
1 parent
450f092
commit 4f6dc72
Showing
3 changed files
with
117 additions
and
39 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import torch | ||
|
||
def get_observer_by_name(observer_name: str): | ||
if observer_name.lower() == "percentile": | ||
return torch.ao.quantization.observer.PercentileObserver | ||
|
||
if observer_name.lower() == "histogram": | ||
return torch.ao.quantization.observer.HistogramObserver | ||
|
||
if observer_name.lower() == "min_max": | ||
return torch.ao.quantization.observer.MinMaxObserver | ||
|
||
if observer_name.lower() == "moving_min_max": | ||
return torch.ao.quantization.observer.MovingAverageMinMaxObserver | ||
else: | ||
raise NotImplemented() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters