Commit 03f441e7 authored by Georgia Gkioxari's avatar Georgia Gkioxari Committed by Facebook GitHub Bot
Browse files

run lint

Summary: Run `/dev/linter.sh` to fix linting

Reviewed By: nikhilaravi

Differential Revision: D20584037

fbshipit-source-id: 69e45b33d22e3d54b6d37c3c35580bb3e9dc50a5
parent 6d34e1c6
...@@ -2,7 +2,7 @@ ...@@ -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( ...@@ -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): ...@@ -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
......
...@@ -188,7 +188,7 @@ class TestAccumulatePoints(unittest.TestCase): ...@@ -188,7 +188,7 @@ class TestAccumulatePoints(unittest.TestCase):
): ):
res1 = fn1(*args1) res1 = fn1(*args1)
res2 = fn2(*args2) res2 = fn2(*args2)
self.assertTrue(torch.allclose(res1.cpu(), res2.cpu(), atol=1e-6)) self.assertTrue(torch.allclose(res1.cpu(), res2.cpu(), atol=1e-6))
if not compare_grads: if not compare_grads:
......
...@@ -291,7 +291,7 @@ class TestSamplePoints(unittest.TestCase): ...@@ -291,7 +291,7 @@ class TestSamplePoints(unittest.TestCase):
if sampled_weights.min() <= 0: if sampled_weights.min() <= 0:
return False return False
return True return True
def test_verts_nan(self): def test_verts_nan(self):
num_verts = 30 num_verts = 30
num_faces = 50 num_faces = 50
...@@ -300,14 +300,19 @@ class TestSamplePoints(unittest.TestCase): ...@@ -300,14 +300,19 @@ class TestSamplePoints(unittest.TestCase):
verts = torch.rand( verts = torch.rand(
(num_verts, 3), dtype=torch.float32, device=device (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) 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
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment