tb/tb_deformation_dirichlet.py
def loss_so3(self, eulerangles_t, state_t, vol_loss):
        """ note that eulerangles_t  shorter than state_t by 1"""
        deformed_state = self.deformation(eulerangles_t, state_t)
        similarity = torch.zeros(self.mesh_size)
        average_length = abs(vol_loss / self.mesh_size)
        for i in range(self.mesh_size - 1):
            similarity[i] = torch.exp(-torch.sqrt(torch.abs(1. - torch.abs(torch.matmul(deformed_state[i].view(1, 3), deformed_state[i + 1]))**2)) / average_length)
        similarity[-1] = torch.exp(-(1. - torch.abs(torch.matmul(deformed_state[-1].view(1, 3), deformed_state[0]))**2) / average_length)
        loss_so3 = torch.abs(eulerangles_t[:, 0]) * similarity[0] + torch.abs(eulerangles_t[:, -1]) * similarity[-1]
        for i in range(self.mesh_size - 2):
            loss_so3 += torch.abs(eulerangles_t[:, i] - eulerangles_t[:, i + 1]) * similarity[i + 1]
        return torch.sum(loss_so3)
 note that eulerangles_t  shorter than state_t by 1
note that eulerangles_t  shorter than state_t by 1
note that eulerangles_t shorter than state_t by 1
def loss_so3(self, eulerangles_t, state_t, vol_loss):
        deformed_state = self.deformation(eulerangles_t, state_t)
        similarity = torch.zeros(self.mesh_size)
        average_length = abs(vol_loss / self.mesh_size)
        for i in range(self.mesh_size - 1):
            similarity[i] = torch.exp(-torch.sqrt(torch.abs(1. - torch.abs(torch.matmul(deformed_state[i].view(1, 3), deformed_state[i + 1]))**2)) / average_length)
        similarity[-1] = torch.exp(-(1. - torch.abs(torch.matmul(deformed_state[-1].view(1, 3), deformed_state[0]))**2) / average_length)
        loss_so3 = torch.abs(eulerangles_t[:, 0]) * similarity[0] + torch.abs(eulerangles_t[:, -1]) * similarity[-1]
        for i in range(self.mesh_size - 2):
            loss_so3 += torch.abs(eulerangles_t[:, i] - eulerangles_t[:, i + 1]) * similarity[i + 1]
        return torch.sum(loss_so3)
def loss_so3 ( self , eulerangles_t , state_t , vol_loss ) : deformed_state = self . deformation ( eulerangles_t , state_t ) similarity = torch . zeros ( self . mesh_size ) average_length = abs ( vol_loss / self . mesh_size ) for i in range ( self . mesh_size - 1 ) : similarity [ i ] = torch . exp ( - torch . sqrt ( torch . abs ( 1. - torch . abs ( torch . matmul ( deformed_state [ i ] . view ( 1 , 3 ) , deformed_state [ i + 1 ] ) ) ** 2 ) ) / average_length ) similarity [ - 1 ] = torch . exp ( - ( 1. - torch . abs ( torch . matmul ( deformed_state [ - 1 ] . view ( 1 , 3 ) , deformed_state [ 0 ] ) ) ** 2 ) / average_length ) loss_so3 = torch . abs ( eulerangles_t [ : , 0 ] ) * similarity [ 0 ] + torch . abs ( eulerangles_t [ : , - 1 ] ) * similarity [ - 1 ] for i in range ( self . mesh_size - 2 ) : loss_so3 += torch . abs ( eulerangles_t [ : , i ] - eulerangles_t [ : , i + 1 ] ) * similarity [ i + 1 ] return torch . sum ( loss_so3 )
note that eulerangles_t  shorter than state_t by 1
note that eulerangles_t shorter than state_t by 1
""" note that eulerangles_t  shorter than state_t by 1"""
self
eulerangles_t
state_t
vol_loss