def test1D(self): net = resunet(1, 1, spatial=(32, )) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='instance') net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='layer') net(th.rand(1, 1, 16))
def __init__(self, in_channels, out_channels, channels_per_step_in=1, channels_per_step_out=4): super().__init__() self.in_steps = in_channels // channels_per_step_in self.out_steps = (out_channels - 8) // channels_per_step_out // 4 self.channels_per_step_in = channels_per_step_in self.channels_per_step_out = channels_per_step_out self.out_channels = out_channels self.lstm = ConvLSTM(1, channels_per_step_out * 4, kernel_size=3, num_layers=1, return_all_layers=True) self.unet = resunet(16, 8, block=HyperBottleneck, relu=CappingRelu(), ratio=-2, layers=6, vblks=[1, 1, 1, 1, 1, 1], hblks=[1, 1, 1, 1, 1, 1], scales=[-1, -1, -1, -1, -1, -1], factors=[1, 1, 1, 1, 1, 1], spatial=(64, 64)) self.lstm = ConvLSTM(1, channels_per_step_out * 4, kernel_size=3, num_layers=1, return_all_layers=False)
def __init__(self, setting): super().__init__(setting) self.name = 't850d3bg-rasp' self.resunet = resunet(setting.input_span * len(setting.vars_in) + self.constant_size + 2, 1, spatial=(32, 64+2), layers=5, ratio=-2, vblks=[2, 2, 2, 2, 2], hblks=[1, 1, 1, 1, 1], scales=[-1, -1, -1, -1, -1], factors=[1, 1, 1, 1, 1], block=HyperBottleneck, relu=CappingRelu(), final_normalized=False)
def testHyp1D(self): net = resunet(1, 1, spatial=(32, ), block=HyperBasic) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='instance', block=HyperBasic) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='layer', block=HyperBasic) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), block=HyperBottleneck) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='instance', block=HyperBottleneck) net(th.rand(1, 1, 16)) net = resunet(1, 1, spatial=(32, ), normalizor='layer', block=HyperBottleneck) net(th.rand(1, 1, 16))
def test2D(self): resunet(1, 1, spatial=(16, 16)) resunet(1, 1, spatial=(16, 32)) resunet(1, 1, spatial=(32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]]) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='instance') net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='layer') net(th.rand(1, 1, 32, 16))
def __init__(self, setting): super().__init__(setting) tube = hyptub(1664, 832, 1664, encoder=linear, decoder=linear) self.resunet = resunet(setting.input_span * (len(setting.vars) + 2) + self.constant_size + 2, 1, spatial=(32, 64 + 2), layers=5, ratio=-1, vblks=[2, 2, 2, 2, 2], hblks=[1, 1, 1, 1, 1], scales=[-1, -1, -1, -1, -1], factors=[1, 1, 1, 1, 1], block=HyperBottleneck, relu=CappingRelu(), enhencer=tube, final_normalized=False)
def __init__(self, in_channels, out_channels, channels_per_step_in=1, channels_per_step_out=4): super().__init__() self.unet = resunet(in_channels, out_channels, block=Basic, relu=nn.ReLU(inplace=True), ratio=0, layers=6, vblks=[1, 1, 1, 1, 1, 1], hblks=[1, 1, 1, 1, 1, 1], scales=[-1, -1, -1, -1, -1, -1], factors=[1, 1, 1, 1, 1, 1], spatial=(64, 64))
def testHyp3D2(self): net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], block=HyperBasic2) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='instance', block=HyperBasic2) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='layer', block=HyperBasic2) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], block=HyperBottleneck2) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='instance', block=HyperBottleneck2) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='layer', block=HyperBottleneck2) net(th.rand(1, 1, 4, 16, 32))
def testSE3D(self): net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], block=SEBasicBlock) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='instance', block=SEBasicBlock) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='layer', block=SEBasicBlock) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], block=SEBottleneck) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='instance', block=SEBottleneck) net(th.rand(1, 1, 4, 16, 32)) net = resunet(1, 1, spatial=(4, 16, 32), scales=[[0, -1, -1], [-1, -1, -1], [0, -1, -1], [-1, -1, -1]], normalizor='layer', block=SEBottleneck) net(th.rand(1, 1, 4, 16, 32))
def testHyp2DGroupNorm(self): net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBottleneck) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBottleneck) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='group', block=HyperBottleneck) net(th.rand(1, 1, 32, 16))
def testHyp2D(self): net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='instance', block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='layer', block=HyperBasic) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], block=HyperBottleneck) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='instance', block=HyperBottleneck) net(th.rand(1, 1, 32, 16)) net = resunet(1, 1, spatial=(32, 16), scales=[[0, -1], [0, -1], [0, -1], [0, -1]], normalizor='layer', block=HyperBottleneck) net(th.rand(1, 1, 32, 16))