alibi-detect
alibi-detect copied to clipboard
Remove `nn.Sequential` and `tf.keras.Sequential` typings
In a number of places we have type hints (and potentially type checks) for torch models like:
model: Union[nn.Sequential, nn.Module]
However, nn.Sequential
is a sub-class of nn.Module
. Therefore we can remove the nn.Sequential
's. This needs to be done in numerous places.
Likewise, the same should be done for tf.keras.Sequential
, which is a subclass of tf.keras.Model
.
I'm not sure but I think historically in some cases there has been a genuine restriction needed to a subset of models that are sequential (e.g. do we do layer indexing by integers anywhere?), although I don't know of any examples off the top of my head @arnaudvl
That's a good point. Would be good to clarify before we do this.
Note: This is a duplicate of https://github.com/SeldonIO/alibi-detect/issues/239. Closing that one since this issue also includes PyTorch.