mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
run lint
Summary: Run `/dev/linter.sh` to fix linting Reviewed By: nikhilaravi Differential Revision: D20584037 fbshipit-source-id: 69e45b33d22e3d54b6d37c3c35580bb3e9dc50a5
This commit is contained in:
parent
6d34e1c60d
commit
03f441e7ca
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import math
|
import math
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from typing import Tuple, Optional, Sequence
|
from typing import Optional, Sequence, Tuple
|
||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
|
|
||||||
@ -1039,15 +1039,18 @@ def look_at_view_transform(
|
|||||||
|
|
||||||
if eye is not None:
|
if eye is not None:
|
||||||
broadcasted_args = convert_to_tensors_and_broadcast(
|
broadcasted_args = convert_to_tensors_and_broadcast(
|
||||||
eye, at, up, device=device)
|
eye, at, up, device=device
|
||||||
|
)
|
||||||
eye, at, up = broadcasted_args
|
eye, at, up = broadcasted_args
|
||||||
C = eye
|
C = eye
|
||||||
else:
|
else:
|
||||||
broadcasted_args = convert_to_tensors_and_broadcast(
|
broadcasted_args = convert_to_tensors_and_broadcast(
|
||||||
dist, elev, azim, at, up, device=device)
|
dist, elev, azim, at, up, device=device
|
||||||
|
)
|
||||||
dist, elev, azim, at, up = broadcasted_args
|
dist, elev, azim, at, up = broadcasted_args
|
||||||
C = camera_position_from_spherical_angles(
|
C = camera_position_from_spherical_angles(
|
||||||
dist, elev, azim, degrees=degrees, device=device)
|
dist, elev, azim, degrees=degrees, device=device
|
||||||
|
)
|
||||||
|
|
||||||
R = look_at_rotation(C, at, up, device=device)
|
R = look_at_rotation(C, at, up, device=device)
|
||||||
T = -torch.bmm(R.transpose(1, 2), C[:, :, None])[:, :, 0]
|
T = -torch.bmm(R.transpose(1, 2), C[:, :, None])[:, :, 0]
|
||||||
|
@ -121,7 +121,7 @@ class TestCameraHelpers(unittest.TestCase):
|
|||||||
dist = math.sqrt(2)
|
dist = math.sqrt(2)
|
||||||
elev = math.pi / 4
|
elev = math.pi / 4
|
||||||
azim = 0.0
|
azim = 0.0
|
||||||
eye = ((0.0, 1.0, 1.0), )
|
eye = ((0.0, 1.0, 1.0),)
|
||||||
# using passed values for dist, elev, azim
|
# using passed values for dist, elev, azim
|
||||||
R, t = look_at_view_transform(dist, elev, azim, degrees=False)
|
R, t = look_at_view_transform(dist, elev, azim, degrees=False)
|
||||||
# using other values for dist, elev, azim - eye overrides
|
# using other values for dist, elev, azim - eye overrides
|
||||||
|
@ -303,11 +303,16 @@ class TestSamplePoints(unittest.TestCase):
|
|||||||
# randomly assign an invalid type
|
# randomly assign an invalid type
|
||||||
verts[torch.randperm(num_verts)[:10]] = float(invalid)
|
verts[torch.randperm(num_verts)[:10]] = float(invalid)
|
||||||
faces = torch.randint(
|
faces = torch.randint(
|
||||||
num_verts, size=(num_faces, 3), dtype=torch.int64, device=device
|
num_verts,
|
||||||
|
size=(num_faces, 3),
|
||||||
|
dtype=torch.int64,
|
||||||
|
device=device,
|
||||||
)
|
)
|
||||||
meshes = Meshes(verts=[verts], faces=[faces])
|
meshes = Meshes(verts=[verts], faces=[faces])
|
||||||
|
|
||||||
with self.assertRaisesRegex(ValueError, "Meshes contain nan or inf."):
|
with self.assertRaisesRegex(
|
||||||
|
ValueError, "Meshes contain nan or inf."
|
||||||
|
):
|
||||||
sample_points_from_meshes(
|
sample_points_from_meshes(
|
||||||
meshes, num_samples=100, return_normals=True
|
meshes, num_samples=100, return_normals=True
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user