Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions torch/ao/nn/quantized/modules/rnn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# mypy: allow-untyped-defs
from typing import Any

import torch


Expand Down Expand Up @@ -35,11 +36,11 @@ class LSTM(torch.ao.nn.quantizable.LSTM):

_FLOAT_MODULE = torch.ao.nn.quantizable.LSTM # type: ignore[assignment]

def _get_name(self):
def _get_name(self) -> str:
return "QuantizedLSTM"

@classmethod
def from_float(cls, *args, **kwargs):
def from_float(cls, *args: Any, **kwargs: Any) -> None:
# The whole flow is float -> observed -> quantized
# This class does observed -> quantized only
raise NotImplementedError(
Expand All @@ -49,7 +50,7 @@ def from_float(cls, *args, **kwargs):
)

@classmethod
def from_observed(cls, other):
def from_observed(cls: type["LSTM"], other: torch.ao.nn.quantizable.LSTM) -> "LSTM":
assert isinstance(other, cls._FLOAT_MODULE) # type: ignore[has-type]
converted = torch.ao.quantization.convert(
other, inplace=False, remove_qconfig=True
Expand Down
Loading