mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	Standardize matrix_to_quaternion output
Summary: An OSS user has pointed out in https://github.com/facebookresearch/pytorch3d/issues/1703 that the output of matrix_to_quaternion (in that file) can be non standardized. This diff solves the issue by adding a line of standardize at the end of the function Reviewed By: bottler Differential Revision: D52368721 fbshipit-source-id: c8d0426307fcdb7fd165e032572382d5ae360cde
This commit is contained in:
		
							parent
							
								
									e46ab49a34
								
							
						
					
					
						commit
						3087ab7f62
					
				@ -155,10 +155,10 @@ def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # if not for numerical problems, quat_candidates[i] should be same (up to a sign),
 | 
					    # if not for numerical problems, quat_candidates[i] should be same (up to a sign),
 | 
				
			||||||
    # forall i; we pick the best-conditioned one (with the largest denominator)
 | 
					    # forall i; we pick the best-conditioned one (with the largest denominator)
 | 
				
			||||||
 | 
					    out = quat_candidates[
 | 
				
			||||||
    return quat_candidates[
 | 
					 | 
				
			||||||
        F.one_hot(q_abs.argmax(dim=-1), num_classes=4) > 0.5, :
 | 
					        F.one_hot(q_abs.argmax(dim=-1), num_classes=4) > 0.5, :
 | 
				
			||||||
    ].reshape(batch_dim + (4,))
 | 
					    ].reshape(batch_dim + (4,))
 | 
				
			||||||
 | 
					    return standardize_quaternion(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def _axis_angle_rotation(axis: str, angle: torch.Tensor) -> torch.Tensor:
 | 
					def _axis_angle_rotation(axis: str, angle: torch.Tensor) -> torch.Tensor:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user