Skip to content

Commit

Permalink
Adding sanity check
Browse files Browse the repository at this point in the history
Signed-off-by: Priyanka Dangi <quic_pdangi@quicinc.com>
  • Loading branch information
quic-pdangi committed Oct 28, 2024
1 parent 88fb681 commit 09f2333
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ def batch_norm_wrapper(
momentum: float = 0.1,
eps: float = 1e-5,
) -> Tensor:
if training:
if self.input_quantizers[1] is not None or self.input_quantizers[2] is not None:
raise RuntimeError(f"{self.__class__} doesn't support quantizing running_mean or running_var in training mode")

input = _quantize_dequantize_if_applicable(input, self.input_quantizers[0])
running_mean = _quantize_dequantize_if_applicable(running_mean, self.input_quantizers[1])
Expand Down Expand Up @@ -587,6 +590,7 @@ def batch_norm_wrapper(
momentum: float = 0.1,
eps: float = 1e-5,
) -> Tensor:

input = _quantize_if_applicable(input, self.input_quantizers[0])
running_mean = _quantize_if_applicable(running_mean, self.input_quantizers[1])
running_var = _quantize_if_applicable(running_var, self.input_quantizers[2])
Expand Down

0 comments on commit 09f2333

Please sign in to comment.