Update deprecated torch.symeig in vision/fair/pytorch3d/projects/nerf/nerf/eval_video_utils.py

Summary:
torch.symeig is deprecated for a long time and is being removed by https://github.com/pytorch/pytorch/pull/70988.

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: bottler

Differential Revision: D39153103

fbshipit-source-id: 3a1397b6d86fb3e45e4777e06a4da3ee76591b32
This commit is contained in:
Sergii Dymchenko 2022-08-30 17:15:11 -07:00 committed by Facebook GitHub Bot
parent 1163eaab43
commit 1530a66469

View File

@ -87,7 +87,7 @@ def generate_eval_video_cameras(
plane_normal = torch.FloatTensor(up) plane_normal = torch.FloatTensor(up)
else: else:
cov = (cam_centers_c.t() @ cam_centers_c) / cam_centers_c.shape[0] cov = (cam_centers_c.t() @ cam_centers_c) / cam_centers_c.shape[0]
_, e_vec = torch.symeig(cov, eigenvectors=True) _, e_vec = torch.linalg.eigh(cov, UPLO="U")
plane_normal = e_vec[:, 0] plane_normal = e_vec[:, 0]
plane_dist = (plane_normal[None] * cam_centers_c).sum(dim=-1) plane_dist = (plane_normal[None] * cam_centers_c).sum(dim=-1)
@ -96,7 +96,7 @@ def generate_eval_video_cameras(
cov = ( cov = (
cam_centers_on_plane.t() @ cam_centers_on_plane cam_centers_on_plane.t() @ cam_centers_on_plane
) / cam_centers_on_plane.shape[0] ) / cam_centers_on_plane.shape[0]
_, e_vec = torch.symeig(cov, eigenvectors=True) _, e_vec = torch.linalg.eigh(cov, UPLO="U")
traj_radius = (cam_centers_on_plane**2).sum(dim=1).sqrt().mean() traj_radius = (cam_centers_on_plane**2).sum(dim=1).sqrt().mean()
angle = torch.linspace(0, 2.0 * math.pi, n_eval_cams) angle = torch.linspace(0, 2.0 * math.pi, n_eval_cams)
traj = traj_radius * torch.stack( traj = traj_radius * torch.stack(