Address black + isort fbsource linter warnings

Summary: Address black + isort fbsource linter warnings from D20558374 (previous diff)

Reviewed By: nikhilaravi

Differential Revision: D20558373

fbshipit-source-id: d3607de4a01fb24c0d5269634563a7914bddf1c8
This commit is contained in:
Patrick Labatut
2020-03-29 14:46:33 -07:00
committed by Facebook GitHub Bot
parent eb512ffde3
commit d57daa6f85
110 changed files with 705 additions and 1850 deletions

View File

@@ -5,4 +5,5 @@ from .rasterize_points import rasterize_points
from .rasterizer import PointsRasterizationSettings, PointsRasterizer
from .renderer import PointsRenderer
__all__ = [k for k in globals().keys() if not k.startswith("_")]

View File

@@ -5,6 +5,7 @@ import torch.nn as nn
from ..compositing import CompositeParams, alpha_composite, norm_weighted_sum
# A compositor should take as input 3D points and some corresponding information.
# Given this information, the compositor can:
# - blend colors across the top K vertices at a pixel
@@ -19,15 +20,11 @@ class AlphaCompositor(nn.Module):
super().__init__()
self.composite_params = (
composite_params
if composite_params is not None
else CompositeParams()
composite_params if composite_params is not None else CompositeParams()
)
def forward(self, fragments, alphas, ptclds, **kwargs) -> torch.Tensor:
images = alpha_composite(
fragments, alphas, ptclds, self.composite_params
)
images = alpha_composite(fragments, alphas, ptclds, self.composite_params)
return images
@@ -39,13 +36,9 @@ class NormWeightedCompositor(nn.Module):
def __init__(self, composite_params=None):
super().__init__()
self.composite_params = (
composite_params
if composite_params is not None
else CompositeParams()
composite_params if composite_params is not None else CompositeParams()
)
def forward(self, fragments, alphas, ptclds, **kwargs) -> torch.Tensor:
images = norm_weighted_sum(
fragments, alphas, ptclds, self.composite_params
)
images = norm_weighted_sum(fragments, alphas, ptclds, self.composite_params)
return images

View File

@@ -1,8 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from typing import Optional
import torch
import torch
from pytorch3d import _C
from pytorch3d.renderer.mesh.rasterize_meshes import pix_to_ndc
@@ -155,10 +155,7 @@ class _RasterizePoints(torch.autograd.Function):
def rasterize_points_python(
pointclouds,
image_size: int = 256,
radius: float = 0.01,
points_per_pixel: int = 8,
pointclouds, image_size: int = 256, radius: float = 0.01, points_per_pixel: int = 8
):
"""
Naive pure PyTorch implementation of pointcloud rasterization.
@@ -177,9 +174,7 @@ def rasterize_points_python(
point_idxs = torch.full(
(N, S, S, K), fill_value=-1, dtype=torch.int32, device=device
)
zbuf = torch.full(
(N, S, S, K), fill_value=-1, dtype=torch.float32, device=device
)
zbuf = torch.full((N, S, S, K), fill_value=-1, dtype=torch.float32, device=device)
pix_dists = torch.full(
(N, S, S, K), fill_value=-1, dtype=torch.float32, device=device
)

View File

@@ -3,6 +3,7 @@
from typing import NamedTuple, Optional
import torch
import torch.nn as nn

View File

@@ -5,6 +5,7 @@
import torch
import torch.nn as nn
# A renderer class should be initialized with a
# function for rasterization and a function for compositing.
# The rasterizer should: