from tsai.models.TST import *Miscellaneous
This contains a set of experiments.
InputWrapper
def InputWrapper(
arch, c_in, c_out, seq_len, new_c_in:NoneType=None, new_seq_len:NoneType=None, kwargs:VAR_KEYWORD
):
Same as nn.Module, but no need for subclasses to call super().__init__
xb = torch.randn(16, 1, 1000)
model = InputWrapper(TST, 1, 4, 1000, 10, 224)
test_eq(model.to(xb.device)(xb).shape, (16,4))ResidualWrapper
def ResidualWrapper(
model
):
Same as nn.Module, but no need for subclasses to call super().__init__
RecursiveWrapper
def RecursiveWrapper(
model, n_steps, anchored:bool=False
):
Same as nn.Module, but no need for subclasses to call super().__init__
xb = torch.randn(16, 1, 20)
model = RecursiveWrapper(TST(1, 1, 20), 5)
test_eq(model.to(xb.device)(xb).shape, (16, 5))