@@ -203,7 +203,7 @@ def test_camera_position_from_angles_torch_scalar_grads(self):
203
203
+ torch .cos (elev ) * torch .cos (azim )
204
204
)
205
205
grad_elev = (
206
- - torch .sin (elev ) * torch .sin (azim )
206
+ - ( torch .sin (elev ) ) * torch .sin (azim )
207
207
+ torch .cos (elev )
208
208
- torch .sin (elev ) * torch .cos (azim )
209
209
)
@@ -260,7 +260,7 @@ def test_camera_position_from_angles_vectors_mixed_broadcast_grads(self):
260
260
+ torch .cos (elev ) * torch .cos (azim )
261
261
)
262
262
grad_elev = (
263
- - torch .sin (elev ) * torch .sin (azim )
263
+ - ( torch .sin (elev ) ) * torch .sin (azim )
264
264
+ torch .cos (elev )
265
265
- torch .sin (elev ) * torch .cos (azim )
266
266
)
@@ -395,8 +395,8 @@ def init_random_cameras(cam_type: CamerasBase, batch_size: int):
395
395
cam_params ["aspect_ratio" ] = torch .rand (batch_size ) * 0.5 + 0.5
396
396
else :
397
397
cam_params ["top" ] = torch .rand (batch_size ) * 0.2 + 0.9
398
- cam_params ["bottom" ] = - torch .rand (batch_size ) * 0.2 - 0.9
399
- cam_params ["left" ] = - torch .rand (batch_size ) * 0.2 - 0.9
398
+ cam_params ["bottom" ] = - ( torch .rand (batch_size ) ) * 0.2 - 0.9
399
+ cam_params ["left" ] = - ( torch .rand (batch_size ) ) * 0.2 - 0.9
400
400
cam_params ["right" ] = torch .rand (batch_size ) * 0.2 + 0.9
401
401
elif cam_type in (SfMOrthographicCameras , SfMPerspectiveCameras ):
402
402
cam_params ["focal_length" ] = torch .rand (batch_size ) * 10 + 0.1
@@ -532,7 +532,7 @@ def test_perspective_mixed_inputs_broadcast(self):
532
532
P = cameras .get_projection_transform ()
533
533
vertices = torch .tensor ([1 , 2 , 10 ], dtype = torch .float32 )
534
534
z1 = 1.0 # vertices at far clipping plane so z = 1.0
535
- z2 = (20.0 / (20.0 - 1.0 ) * 10.0 + - ( 20.0 ) / (20.0 - 1.0 )) / 10.0
535
+ z2 = (20.0 / (20.0 - 1.0 ) * 10.0 + - 20.0 / (20.0 - 1.0 )) / 10.0
536
536
projected_verts = torch .tensor (
537
537
[
538
538
[np .sqrt (3 ) / 10.0 , 2 * np .sqrt (3 ) / 10.0 , z1 ],
@@ -660,7 +660,7 @@ def test_orthographic_mixed_inputs_broadcast(self):
660
660
cameras = OpenGLOrthographicCameras (znear = near , zfar = far )
661
661
P = cameras .get_projection_transform ()
662
662
vertices = torch .tensor ([1.0 , 2.0 , 10.0 ], dtype = torch .float32 )
663
- z2 = 1.0 / (20.0 - 1.0 ) * 10.0 + - ( 1.0 ) / (20.0 - 1.0 )
663
+ z2 = 1.0 / (20.0 - 1.0 ) * 10.0 + - 1.0 / (20.0 - 1.0 )
664
664
projected_verts = torch .tensor (
665
665
[[1.0 , 2.0 , 1.0 ], [1.0 , 2.0 , z2 ]], dtype = torch .float32
666
666
)
0 commit comments