Exemple #1
0
 def upsample(self, x, n1=1, n2=0):
     """Upsample mesh."""
     if x.ndimension() < 3:
         for i in reversed(range(n2, n1)):
             x = spmm(self._U[i], x)
     elif x.ndimension() == 3:
         out = []
         for i in range(x.shape[0]):
             y = x[i]
             for j in reversed(range(n2, n1)):
                 y = spmm(self._U[j], y)
             out.append(y)
         x = torch.stack(out, dim=0)
     return x
Exemple #2
0
 def downsample(self, x, n1=0, n2=None):
     """Downsample mesh."""
     if n2 is None:
         n2 = self.num_downsampling
     if x.ndimension() < 3:
         for i in range(n1, n2):
             x = spmm(self._D[i], x)
     elif x.ndimension() == 3:
         out = []
         for i in range(x.shape[0]):
             y = x[i]
             for j in range(n1, n2):
                 y = spmm(self._D[j], y)
             out.append(y)
         x = torch.stack(out, dim=0)
     return x