//  [python]
def main(self, x, y, t, cont, stl):
        numt = t.size()
        numt = numt[0]
        sz0 = x.size()

        tt, t2, t2r, invt = self.process_t(t, sz0[0])

        self.tst = t2
        self.tts = t2r

        if self.costl:
            contt, cont2, cont2r, invcont = self.process_t(cont, sz0[0])
            stlt, stl2, stl2r, invstl = self.process_t(stl, sz0[0])
            self.cont = cont2
            self.stl = stl2

        x2 = x.repeat(numt, 1, 1, 1, 1)
        y2 = y.repeat(numt, 1, 1, 1, 1)
        x22 = x2.view(-1, sz0[1], sz0[2], sz0[3])
        y22 = y2.view(-1, sz0[1], sz0[2], sz0[3])

        self.A = x22
        self.B = y22


        if self.stn:

            xx = x
            yy = y
            theta = self.main_stn(xx, yy)
            itheta  = self.main_stn(yy, xx)

            theta = theta.view(sz0[0], 2, self.grid_sz, self.grid_sz)
            grid = t(theta, size=(sz0[2], sz0[3]), mode='bilinear')
            itheta = itheta.view(sz0[0], 2, self.grid_sz, self.grid_sz)
            igrid = t(itheta, size=(sz0[2], sz0[3]), mode='bilinear')

            self.theta = theta
            self.itheta = itheta
            
            self.ident = self.get_ident([sz0[0], sz0[1], self.grid_sz, self.grid_sz])

            grid = grid.repeat(numt, 1, 1, 1)
            igrid = igrid.repeat(numt, 1, 1, 1)
            
            ident = self.get_ident(sz0)
            ident = ident.repeat(numt,1,1,1)
            diff_st = grid - ident
            diff_ts = igrid - ident
            
            if self.costl:
                tmp2 = ident + cont2r.unsqueeze(1).unsqueeze(2).unsqueeze(3) * diff_ts
                tmp1 = ident + cont2.unsqueeze(1).unsqueeze(2).unsqueeze(3) * diff_st
            else:
                tmp2 = ident + t2r.unsqueeze(1).unsqueeze(2).unsqueeze(3) * diff_ts
                tmp1 = ident + t2.unsqueeze(1).unsqueeze(2).unsqueeze(3) * diff_st

            tmp1 = tmp1.permute(0, 2, 3, 1)
            tmp2 = tmp2.permute(0, 2, 3, 1)

            A = F.grid_sample(x22, tmp1, padding_mode='border')
            B = F.grid_sample(y22, tmp2, padding_mode='border')

            self.A = A
            self.B = B
            

            out, out2 = self.main_encoder(A, B)
            if self.do_adain:
                if self.costl:
                    out, out2 = function.ada_in(out, out2, stl2)
                else:
                    out, out2 = function.ada_in(out, out2, t2)
            

            ccat = torch.cat((out, out2), 1)
            if self.costl:
                out3 = self.main_decoder(ccat, tt, contt, stlt)
            else:
                out3 = self.main_decoder(ccat, tt)
            ccat2 = torch.cat((out2, out), 1)
            if self.costl:
                out4 = self.main_decoder(ccat2, tt, -1*invcont, -1*invstl)
            else:
                out4 = self.main_decoder(ccat2, tt)

        else:
            
            out, out2 = self.main_encoder(x, y)

            out = out.repeat(numt,1,1,1)
            out2 = out2.repeat(numt,1,1,1)

            out, out2 = function.ada_in(out, out2, t2)

            ccat = torch.cat((out, out2), 1)

            out3 = self.main_decoder(ccat, tt)
            ccat2 = torch.cat((out2, out), 1)

            out4 = self.main_decoder(ccat2, tt)

        return (out3, out4)