mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +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 numpy as np
|
||||
from typing import Tuple, Optional, Sequence
|
||||
from typing import Optional, Sequence, Tuple
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
@ -1039,15 +1039,18 @@ def look_at_view_transform(
|
||||
|
||||
if eye is not None:
|
||||
broadcasted_args = convert_to_tensors_and_broadcast(
|
||||
eye, at, up, device=device)
|
||||
eye, at, up, device=device
|
||||
)
|
||||
eye, at, up = broadcasted_args
|
||||
C = eye
|
||||
else:
|
||||
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
|
||||
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)
|
||||
T = -torch.bmm(R.transpose(1, 2), C[:, :, None])[:, :, 0]
|
||||
|
@ -121,7 +121,7 @@ class TestCameraHelpers(unittest.TestCase):
|
||||
dist = math.sqrt(2)
|
||||
elev = math.pi / 4
|
||||
azim = 0.0
|
||||
eye = ((0.0, 1.0, 1.0), )
|
||||
eye = ((0.0, 1.0, 1.0),)
|
||||
# using passed values for dist, elev, azim
|
||||
R, t = look_at_view_transform(dist, elev, azim, degrees=False)
|
||||
# using other values for dist, elev, azim - eye overrides
|
||||
|
@ -188,7 +188,7 @@ class TestAccumulatePoints(unittest.TestCase):
|
||||
):
|
||||
res1 = fn1(*args1)
|
||||
res2 = fn2(*args2)
|
||||
|
||||
|
||||
self.assertTrue(torch.allclose(res1.cpu(), res2.cpu(), atol=1e-6))
|
||||
|
||||
if not compare_grads:
|
||||
|
@ -291,7 +291,7 @@ class TestSamplePoints(unittest.TestCase):
|
||||
if sampled_weights.min() <= 0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def test_verts_nan(self):
|
||||
num_verts = 30
|
||||
num_faces = 50
|
||||
@ -300,14 +300,19 @@ class TestSamplePoints(unittest.TestCase):
|
||||
verts = torch.rand(
|
||||
(num_verts, 3), dtype=torch.float32, device=device
|
||||
)
|
||||
# randomly assign an invalid type
|
||||
# randomly assign an invalid type
|
||||
verts[torch.randperm(num_verts)[:10]] = float(invalid)
|
||||
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])
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "Meshes contain nan or inf."):
|
||||
with self.assertRaisesRegex(
|
||||
ValueError, "Meshes contain nan or inf."
|
||||
):
|
||||
sample_points_from_meshes(
|
||||
meshes, num_samples=100, return_normals=True
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user