This is a modified version of fastai's XResNet model in github. Changes include:
bs, c_in, seq_len = 2, 4, 32
c_out = 2
x = torch.rand(bs, c_in, seq_len)
archs = [
xresnet1d18, xresnet1d34, xresnet1d50,
xresnet1d18_deep, xresnet1d34_deep, xresnet1d50_deep, xresnet1d18_deeper,
xresnet1d34_deeper, xresnet1d50_deeper
# # Long test
# xresnet1d101, xresnet1d152,
]
for i, arch in enumerate(archs):
print(i, arch.__name__)
test_eq(arch(c_in, c_out, sa=True, act=Mish)(x).shape, (bs, c_out))
m = xresnet1d34(4, 2, act=Mish)
test_eq(len(get_layers(m, is_bn)), 38)
test_eq(check_weight(m, is_bn)[0].sum(), 22)