Commit bef959c7 authored by John Reese's avatar John Reese Committed by Facebook GitHub Bot
Browse files

formatting changes from black 22.3.0

Summary:
Applies the black-fbsource codemod with the new build of pyfmt.

paintitblack

Reviewed By: lisroach

Differential Revision: D36324783

fbshipit-source-id: 280c09e88257e5e569ab729691165d8dedd767bc
parent c21ba144
......@@ -66,7 +66,7 @@ class TestAcosLinearExtrapolation(TestCaseMixin, unittest.TestCase):
# fit a line: slope * x + bias = y
x_1 = torch.stack([x, torch.ones_like(x)], dim=-1)
slope, bias = lstsq(x_1, y[:, None]).view(-1)[:2]
desired_slope = (-1.0) / torch.sqrt(1.0 - bound_t ** 2)
desired_slope = (-1.0) / torch.sqrt(1.0 - bound_t**2)
# test that the desired slope is the same as the fitted one
self.assertClose(desired_slope.view(1), slope.view(1), atol=1e-2)
# test that the autograd's slope is the same as the desired one
......
......@@ -412,7 +412,7 @@ class TestSpecularLighting(TestCaseMixin, unittest.TestCase):
camera_position=camera_position[None, :],
shininess=torch.tensor(10),
)
self.assertClose(output_light, expected_output ** 10)
self.assertClose(output_light, expected_output**10)
def test_specular_batched(self):
batch_size = 10
......
......@@ -62,7 +62,7 @@ class TestRasterizeMeshes(TestCaseMixin, unittest.TestCase):
torch.manual_seed(231)
device = torch.device("cpu")
image_size = 32
blur_radius = 0.1 ** 2
blur_radius = 0.1**2
faces_per_pixel = 3
for d in ["cpu", get_random_cuda_device()]:
......@@ -167,7 +167,7 @@ class TestRasterizeMeshes(TestCaseMixin, unittest.TestCase):
torch.manual_seed(231)
image_size = 64
radius = 0.1 ** 2
radius = 0.1**2
faces_per_pixel = 3
device = torch.device("cpu")
meshes_cpu = ico_sphere(0, device)
......@@ -224,7 +224,7 @@ class TestRasterizeMeshes(TestCaseMixin, unittest.TestCase):
# Make sure that the backward pass runs for all pathways
image_size = 64 # test is too slow for very large images.
N = 1
radius = 0.1 ** 2
radius = 0.1**2
faces_per_pixel = 3
grad_zbuf = torch.randn(N, image_size, image_size, faces_per_pixel)
......@@ -997,7 +997,7 @@ class TestRasterizeMeshes(TestCaseMixin, unittest.TestCase):
ordering of faces.
"""
image_size = 10
blur_radius = 0.12 ** 2
blur_radius = 0.12**2
faces_per_pixel = 1
# fmt: off
......
......@@ -60,13 +60,13 @@ def spherical_volumetric_function(
# the squared distance of each ray point to the centroid of the sphere
surface_dist = (
(surface_vectors ** 2)
(surface_vectors**2)
.sum(-1, keepdim=True)
.view(*rays_points_world.shape[:-1], 1)
)
# set all ray densities within the sphere_diameter distance from the centroid to 1
rays_densities = torch.sigmoid(-100.0 * (surface_dist - sphere_diameter ** 2))
rays_densities = torch.sigmoid(-100.0 * (surface_dist - sphere_diameter**2))
# ray colors are proportional to the normalized surface_vectors
rays_features = (
......
......@@ -128,7 +128,7 @@ class TestSamplePoints(TestCaseMixin, unittest.TestCase):
# Sphere: points should have radius 1.
x, y, z = samples[1, :].unbind(1)
radius = torch.sqrt(x ** 2 + y ** 2 + z ** 2)
radius = torch.sqrt(x**2 + y**2 + z**2)
self.assertClose(radius, torch.ones(num_samples))
......
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