def feature_extract(self, z, f1, f2=None, f3=None):
        h = f1(z)

        if f2 is not None and f3 is not None:
            h_in = h
            for f in f2:
                h2 = f(h_in)
                if self.model_name == "SRFlow-DA-D":
                    h2 = h2 + h_in
                h_in = h2

            if self.model_name == "SRFlow-DA-R":
                h2 = h2 + h

            h = f3(h2)

        shift, scale = thops.split_feature(h, "cross")
        scale = (torch.sigmoid(scale + 2.) + self.affine_eps)
        return scale, shift
Exemplo n.º 2
0
 def split2d_prior(self, z, ft):
     if ft is not None:
         z = torch.cat([z, ft], dim=1)
     h = self.conv(z)
     return thops.split_feature(h, "cross")
 def feature_extract_aff(self, z1, ft, f):
     z = torch.cat([z1, ft], dim=1)
     h = f(z)
     shift, scale = thops.split_feature(h, "cross")
     scale = (torch.sigmoid(scale + 2.) + self.affine_eps)
     return scale, shift
 def feature_extract(self, z, f):
     h = f(z)
     shift, scale = thops.split_feature(h, "cross")
     scale = (torch.sigmoid(scale + 2.) + self.affine_eps)
     return scale, shift