apply import merging for fbcode/vision/fair (2 of 2)

Summary:
Applies new import merging and sorting from µsort v1.0.

When merging imports, µsort will make a best-effort to move associated
comments to match merged elements, but there are known limitations due to
the diynamic nature of Python and developer tooling. These changes should
not produce any dangerous runtime changes, but may require touch-ups to
satisfy linters and other tooling.

Note that µsort uses case-insensitive, lexicographical sorting, which
results in a different ordering compared to isort. This provides a more
consistent sorting order, matching the case-insensitive order used when
sorting import statements by module name, and ensures that "frog", "FROG",
and "Frog" always sort next to each other.

For details on µsort's sorting and merging semantics, see the user guide:
https://usort.readthedocs.io/en/stable/guide.html#sorting

Reviewed By: bottler

Differential Revision: D35553814

fbshipit-source-id: be49bdb6a4c25264ff8d4db3a601f18736d17be1
This commit is contained in:
Tim Hatch 2022-04-13 06:51:33 -07:00 committed by Facebook GitHub Bot
parent df08ea8eb4
commit 34bbb3ad32
67 changed files with 119 additions and 114 deletions

View File

@ -12,13 +12,13 @@ from pytorch3d.io import load_objs_as_meshes
from pytorch3d.renderer import ( from pytorch3d.renderer import (
BlendParams, BlendParams,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
MeshRasterizer, MeshRasterizer,
MeshRenderer, MeshRenderer,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
SoftPhongShader, SoftPhongShader,
SoftSilhouetteShader, SoftSilhouetteShader,
look_at_view_transform,
) )

View File

@ -8,7 +8,7 @@ import math
from typing import Tuple from typing import Tuple
import torch import torch
from pytorch3d.renderer import PerspectiveCameras, look_at_view_transform from pytorch3d.renderer import look_at_view_transform, PerspectiveCameras
from torch.utils.data.dataset import Dataset from torch.utils.data.dataset import Dataset

View File

@ -8,7 +8,7 @@ from typing import Tuple
import torch import torch
from pytorch3d.common.linear_with_repeat import LinearWithRepeat from pytorch3d.common.linear_with_repeat import LinearWithRepeat
from pytorch3d.renderer import HarmonicEmbedding, RayBundle, ray_bundle_to_ray_points from pytorch3d.renderer import HarmonicEmbedding, ray_bundle_to_ray_points, RayBundle
def _xavier_init(linear): def _xavier_init(linear):

View File

@ -9,7 +9,7 @@ from typing import Tuple
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
from torch.nn import Parameter, init from torch.nn import init, Parameter
class LinearWithRepeat(torch.nn.Module): class LinearWithRepeat(torch.nn.Module):

View File

@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the # This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from .r2n2 import R2N2, BlenderCamera, collate_batched_R2N2, render_cubified_voxels from .r2n2 import BlenderCamera, collate_batched_R2N2, R2N2, render_cubified_voxels
from .shapenet import ShapeNetCore from .shapenet import ShapeNetCore
from .utils import collate_batched_meshes from .utils import collate_batched_meshes

View File

@ -19,8 +19,8 @@ from pytorch3d.renderer import HardPhongShader
from tabulate import tabulate from tabulate import tabulate
from .utils import ( from .utils import (
BlenderCamera,
align_bbox, align_bbox,
BlenderCamera,
compute_extrinsic_matrix, compute_extrinsic_matrix,
read_binvox_coords, read_binvox_coords,
voxelize, voxelize,

View File

@ -39,7 +39,7 @@ from PIL import Image
from pytorch3d.io import IO from pytorch3d.io import IO
from pytorch3d.renderer.camera_utils import join_cameras_as_batch from pytorch3d.renderer.camera_utils import join_cameras_as_batch
from pytorch3d.renderer.cameras import CamerasBase, PerspectiveCameras from pytorch3d.renderer.cameras import CamerasBase, PerspectiveCameras
from pytorch3d.structures.pointclouds import Pointclouds, join_pointclouds_as_batch from pytorch3d.structures.pointclouds import join_pointclouds_as_batch, Pointclouds
from . import types from . import types

View File

@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the # This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from typing import Optional, Tuple, cast from typing import cast, Optional, Tuple
import torch import torch
from pytorch3d.implicitron.tools.point_cloud_utils import get_rgbd_point_cloud from pytorch3d.implicitron.tools.point_cloud_utils import get_rgbd_point_cloud

View File

@ -8,7 +8,7 @@
import copy import copy
import dataclasses import dataclasses
import os import os
from typing import Optional, cast from typing import cast, Optional
import lpips import lpips
import torch import torch

View File

@ -11,7 +11,7 @@ from typing import List, Optional
import torch import torch
from pytorch3d.common.linear_with_repeat import LinearWithRepeat from pytorch3d.common.linear_with_repeat import LinearWithRepeat
from pytorch3d.implicitron.tools.config import registry from pytorch3d.implicitron.tools.config import registry
from pytorch3d.renderer import RayBundle, ray_bundle_to_ray_points from pytorch3d.renderer import ray_bundle_to_ray_points, RayBundle
from pytorch3d.renderer.cameras import CamerasBase from pytorch3d.renderer.cameras import CamerasBase
from pytorch3d.renderer.implicit import HarmonicEmbedding from pytorch3d.renderer.implicit import HarmonicEmbedding

View File

@ -1,13 +1,13 @@
# @lint-ignore-every LICENSELINT # @lint-ignore-every LICENSELINT
# Adapted from https://github.com/vsitzmann/scene-representation-networks # Adapted from https://github.com/vsitzmann/scene-representation-networks
# Copyright (c) 2019 Vincent Sitzmann # Copyright (c) 2019 Vincent Sitzmann
from typing import Any, Optional, Tuple, cast from typing import Any, cast, Optional, Tuple
import torch import torch
from pytorch3d.common.linear_with_repeat import LinearWithRepeat from pytorch3d.common.linear_with_repeat import LinearWithRepeat
from pytorch3d.implicitron.third_party import hyperlayers, pytorch_prototyping from pytorch3d.implicitron.third_party import hyperlayers, pytorch_prototyping
from pytorch3d.implicitron.tools.config import Configurable, registry, run_auto_creation from pytorch3d.implicitron.tools.config import Configurable, registry, run_auto_creation
from pytorch3d.renderer import RayBundle, ray_bundle_to_ray_points from pytorch3d.renderer import ray_bundle_to_ray_points, RayBundle
from pytorch3d.renderer.cameras import CamerasBase from pytorch3d.renderer.cameras import CamerasBase
from pytorch3d.renderer.implicit import HarmonicEmbedding from pytorch3d.renderer.implicit import HarmonicEmbedding

View File

@ -13,7 +13,7 @@ import torch.nn.functional as F
from pytorch3d.implicitron.models.view_pooling.view_sampling import ( from pytorch3d.implicitron.models.view_pooling.view_sampling import (
cameras_points_cartesian_product, cameras_points_cartesian_product,
) )
from pytorch3d.implicitron.tools.config import ReplaceableBase, registry from pytorch3d.implicitron.tools.config import registry, ReplaceableBase
from pytorch3d.ops import wmean from pytorch3d.ops import wmean
from pytorch3d.renderer.cameras import CamerasBase from pytorch3d.renderer.cameras import CamerasBase

View File

@ -10,7 +10,7 @@ from typing import Optional, Tuple
import torch import torch
from pytorch3d.common.compat import eigh from pytorch3d.common.compat import eigh
from pytorch3d.implicitron.tools.circle_fitting import fit_circle_in_3d from pytorch3d.implicitron.tools.circle_fitting import fit_circle_in_3d
from pytorch3d.renderer import PerspectiveCameras, look_at_view_transform from pytorch3d.renderer import look_at_view_transform, PerspectiveCameras
from pytorch3d.transforms import Scale from pytorch3d.transforms import Scale

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from typing import Optional, Tuple, cast from typing import cast, Optional, Tuple
import torch import torch
import torch.nn.functional as Fu import torch.nn.functional as Fu

View File

@ -42,18 +42,18 @@ from base64 import b64decode
from collections import deque from collections import deque
from enum import IntEnum from enum import IntEnum
from io import BytesIO from io import BytesIO
from typing import Any, BinaryIO, Dict, List, Optional, Tuple, Union, cast from typing import Any, BinaryIO, cast, Dict, List, Optional, Tuple, Union
import numpy as np import numpy as np
import torch import torch
from iopath.common.file_io import PathManager from iopath.common.file_io import PathManager
from PIL import Image from PIL import Image
from pytorch3d.io.utils import PathOrStr, _open_file from pytorch3d.io.utils import _open_file, PathOrStr
from pytorch3d.renderer.mesh import TexturesBase, TexturesUV, TexturesVertex from pytorch3d.renderer.mesh import TexturesBase, TexturesUV, TexturesVertex
from pytorch3d.structures import Meshes, join_meshes_as_scene from pytorch3d.structures import join_meshes_as_scene, Meshes
from pytorch3d.transforms import Transform3d, quaternion_to_matrix from pytorch3d.transforms import quaternion_to_matrix, Transform3d
from .pluggable_formats import MeshFormatInterpreter, endswith from .pluggable_formats import endswith, MeshFormatInterpreter
_GLTF_MAGIC = 0x46546C67 _GLTF_MAGIC = 0x46546C67

View File

@ -18,11 +18,11 @@ from iopath.common.file_io import PathManager
from PIL import Image from PIL import Image
from pytorch3d.common.datatypes import Device from pytorch3d.common.datatypes import Device
from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas
from pytorch3d.io.utils import PathOrStr, _check_faces_indices, _make_tensor, _open_file from pytorch3d.io.utils import _check_faces_indices, _make_tensor, _open_file, PathOrStr
from pytorch3d.renderer import TexturesAtlas, TexturesUV from pytorch3d.renderer import TexturesAtlas, TexturesUV
from pytorch3d.structures import Meshes, join_meshes_as_batch from pytorch3d.structures import join_meshes_as_batch, Meshes
from .pluggable_formats import MeshFormatInterpreter, endswith from .pluggable_formats import endswith, MeshFormatInterpreter
# Faces & Aux type returned from load_obj function. # Faces & Aux type returned from load_obj function.

View File

@ -13,16 +13,16 @@ This format is introduced, for example, at
http://www.geomview.org/docs/html/OFF.html . http://www.geomview.org/docs/html/OFF.html .
""" """
import warnings import warnings
from typing import Optional, Tuple, Union, cast from typing import cast, Optional, Tuple, Union
import numpy as np import numpy as np
import torch import torch
from iopath.common.file_io import PathManager from iopath.common.file_io import PathManager
from pytorch3d.io.utils import PathOrStr, _check_faces_indices, _open_file from pytorch3d.io.utils import _check_faces_indices, _open_file, PathOrStr
from pytorch3d.renderer import TexturesAtlas, TexturesVertex from pytorch3d.renderer import TexturesAtlas, TexturesVertex
from pytorch3d.structures import Meshes from pytorch3d.structures import Meshes
from .pluggable_formats import MeshFormatInterpreter, endswith from .pluggable_formats import endswith, MeshFormatInterpreter
def _is_line_empty(line: Union[str, bytes]) -> bool: def _is_line_empty(line: Union[str, bytes]) -> bool:

View File

@ -21,14 +21,14 @@ from typing import List, Optional, Tuple
import numpy as np import numpy as np
import torch import torch
from iopath.common.file_io import PathManager from iopath.common.file_io import PathManager
from pytorch3d.io.utils import PathOrStr, _check_faces_indices, _make_tensor, _open_file from pytorch3d.io.utils import _check_faces_indices, _make_tensor, _open_file, PathOrStr
from pytorch3d.renderer import TexturesVertex from pytorch3d.renderer import TexturesVertex
from pytorch3d.structures import Meshes, Pointclouds from pytorch3d.structures import Meshes, Pointclouds
from .pluggable_formats import ( from .pluggable_formats import (
endswith,
MeshFormatInterpreter, MeshFormatInterpreter,
PointcloudFormatInterpreter, PointcloudFormatInterpreter,
endswith,
) )

View File

@ -7,7 +7,7 @@
import contextlib import contextlib
import pathlib import pathlib
import warnings import warnings
from typing import IO, ContextManager, Optional, Union from typing import ContextManager, IO, Optional, Union
import numpy as np import numpy as np
import torch import torch

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import warnings import warnings
from typing import TYPE_CHECKING, List, NamedTuple, Optional, Union from typing import List, NamedTuple, Optional, TYPE_CHECKING, Union
import torch import torch
from pytorch3d.ops import knn_points from pytorch3d.ops import knn_points

View File

@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the # This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from typing import TYPE_CHECKING, Optional, Tuple, Union from typing import Optional, Tuple, TYPE_CHECKING, Union
import torch import torch

View File

@ -11,19 +11,19 @@ from .blending import (
softmax_rgb_blend, softmax_rgb_blend,
) )
from .camera_utils import join_cameras_as_batch, rotate_on_spot from .camera_utils import join_cameras_as_batch, rotate_on_spot
from .cameras import OpenGLOrthographicCameras # deprecated from .cameras import ( # deprecated # deprecated # deprecated # deprecated
from .cameras import OpenGLPerspectiveCameras # deprecated camera_position_from_spherical_angles,
from .cameras import SfMOrthographicCameras # deprecated
from .cameras import SfMPerspectiveCameras # deprecated
from .cameras import (
FoVOrthographicCameras, FoVOrthographicCameras,
FoVPerspectiveCameras, FoVPerspectiveCameras,
OrthographicCameras,
PerspectiveCameras,
camera_position_from_spherical_angles,
get_world_to_view_transform, get_world_to_view_transform,
look_at_rotation, look_at_rotation,
look_at_view_transform, look_at_view_transform,
OpenGLOrthographicCameras,
OpenGLPerspectiveCameras,
OrthographicCameras,
PerspectiveCameras,
SfMOrthographicCameras,
SfMPerspectiveCameras,
) )
from .implicit import ( from .implicit import (
AbsorptionOnlyRaymarcher, AbsorptionOnlyRaymarcher,
@ -35,22 +35,25 @@ from .implicit import (
MultinomialRaysampler, MultinomialRaysampler,
NDCGridRaysampler, NDCGridRaysampler,
NDCMultinomialRaysampler, NDCMultinomialRaysampler,
ray_bundle_to_ray_points,
ray_bundle_variables_to_ray_points,
RayBundle, RayBundle,
VolumeRenderer, VolumeRenderer,
VolumeSampler, VolumeSampler,
ray_bundle_to_ray_points,
ray_bundle_variables_to_ray_points,
) )
from .lighting import AmbientLights, DirectionalLights, PointLights, diffuse, specular from .lighting import AmbientLights, diffuse, DirectionalLights, PointLights, specular
from .materials import Materials from .materials import Materials
from .mesh import ( from .mesh import (
gouraud_shading,
HardFlatShader, HardFlatShader,
HardGouraudShader, HardGouraudShader,
HardPhongShader, HardPhongShader,
MeshRasterizer, MeshRasterizer,
MeshRenderer, MeshRenderer,
MeshRendererWithFragments, MeshRendererWithFragments,
phong_shading,
RasterizationSettings, RasterizationSettings,
rasterize_meshes,
SoftGouraudShader, SoftGouraudShader,
SoftPhongShader, SoftPhongShader,
SoftSilhouetteShader, SoftSilhouetteShader,
@ -58,9 +61,6 @@ from .mesh import (
TexturesAtlas, TexturesAtlas,
TexturesUV, TexturesUV,
TexturesVertex, TexturesVertex,
gouraud_shading,
phong_shading,
rasterize_meshes,
) )
from .points import ( from .points import (
AlphaCompositor, AlphaCompositor,
@ -72,10 +72,10 @@ from .points import (
rasterize_points, rasterize_points,
) )
from .utils import ( from .utils import (
TensorProperties,
convert_to_tensors_and_broadcast, convert_to_tensors_and_broadcast,
ndc_grid_sample, ndc_grid_sample,
ndc_to_grid_sample_coords, ndc_to_grid_sample_coords,
TensorProperties,
) )

View File

@ -15,9 +15,9 @@ from .raysampling import (
) )
from .renderer import ImplicitRenderer, VolumeRenderer, VolumeSampler from .renderer import ImplicitRenderer, VolumeRenderer, VolumeSampler
from .utils import ( from .utils import (
RayBundle,
ray_bundle_to_ray_points, ray_bundle_to_ray_points,
ray_bundle_variables_to_ray_points, ray_bundle_variables_to_ray_points,
RayBundle,
) )

View File

@ -9,7 +9,7 @@ import torch
import torch.nn.functional as F import torch.nn.functional as F
from ..common.datatypes import Device from ..common.datatypes import Device
from .utils import TensorProperties, convert_to_tensors_and_broadcast from .utils import convert_to_tensors_and_broadcast, TensorProperties
def diffuse(normals, color, direction) -> torch.Tensor: def diffuse(normals, color, direction) -> torch.Tensor:

View File

@ -6,16 +6,15 @@
from .clip import ( from .clip import (
clip_faces,
ClipFrustum, ClipFrustum,
ClippedFaces, ClippedFaces,
clip_faces,
convert_clipped_rasterization_to_original_faces, convert_clipped_rasterization_to_original_faces,
) )
from .rasterize_meshes import rasterize_meshes from .rasterize_meshes import rasterize_meshes
from .rasterizer import MeshRasterizer, RasterizationSettings from .rasterizer import MeshRasterizer, RasterizationSettings
from .renderer import MeshRenderer, MeshRendererWithFragments from .renderer import MeshRenderer, MeshRendererWithFragments
from .shader import TexturedSoftPhongShader # DEPRECATED from .shader import ( # DEPRECATED
from .shader import (
BlendParams, BlendParams,
HardFlatShader, HardFlatShader,
HardGouraudShader, HardGouraudShader,
@ -23,10 +22,16 @@ from .shader import (
SoftGouraudShader, SoftGouraudShader,
SoftPhongShader, SoftPhongShader,
SoftSilhouetteShader, SoftSilhouetteShader,
TexturedSoftPhongShader,
) )
from .shading import gouraud_shading, phong_shading from .shading import gouraud_shading, phong_shading
from .textures import Textures # DEPRECATED from .textures import ( # DEPRECATED
from .textures import TexturesAtlas, TexturesBase, TexturesUV, TexturesVertex Textures,
TexturesAtlas,
TexturesBase,
TexturesUV,
TexturesVertex,
)
__all__ = [k for k in globals().keys() if not k.startswith("_")] __all__ = [k for k in globals().keys() if not k.startswith("_")]

View File

@ -12,8 +12,8 @@ import torch
from pytorch3d import _C from pytorch3d import _C
from .clip import ( from .clip import (
ClipFrustum,
clip_faces, clip_faces,
ClipFrustum,
convert_clipped_rasterization_to_original_faces, convert_clipped_rasterization_to_original_faces,
) )

View File

@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the # This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
from .meshes import Meshes, join_meshes_as_batch, join_meshes_as_scene from .meshes import join_meshes_as_batch, join_meshes_as_scene, Meshes
from .pointclouds import Pointclouds from .pointclouds import Pointclouds
from .utils import list_to_packed, list_to_padded, packed_to_list, padded_to_list from .utils import list_to_packed, list_to_padded, packed_to_list, padded_to_list
from .volumes import Volumes from .volumes import Volumes

View File

@ -11,14 +11,14 @@ import plotly.graph_objects as go
import torch import torch
from plotly.subplots import make_subplots from plotly.subplots import make_subplots
from pytorch3d.renderer import ( from pytorch3d.renderer import (
ray_bundle_to_ray_points,
RayBundle, RayBundle,
TexturesAtlas, TexturesAtlas,
TexturesVertex, TexturesVertex,
ray_bundle_to_ray_points,
) )
from pytorch3d.renderer.camera_utils import camera_to_eye_at_up from pytorch3d.renderer.camera_utils import camera_to_eye_at_up
from pytorch3d.renderer.cameras import CamerasBase from pytorch3d.renderer.cameras import CamerasBase
from pytorch3d.structures import Meshes, Pointclouds, join_meshes_as_scene from pytorch3d.structures import join_meshes_as_scene, Meshes, Pointclouds
Struct = Union[CamerasBase, Meshes, Pointclouds, RayBundle] Struct = Union[CamerasBase, Meshes, Pointclouds, RayBundle]

View File

@ -13,7 +13,7 @@ from typing import List, Optional
import torch import torch
from setuptools import find_packages, setup from setuptools import find_packages, setup
from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension from torch.utils.cpp_extension import CppExtension, CUDA_HOME, CUDAExtension
def get_existing_ccbin(nvcc_args: List[str]) -> Optional[str]: def get_existing_ccbin(nvcc_args: List[str]) -> Optional[str]:

View File

@ -13,18 +13,18 @@ from typing import Any, List, Optional, Set, Tuple
from omegaconf import DictConfig, ListConfig, OmegaConf, ValidationError from omegaconf import DictConfig, ListConfig, OmegaConf, ValidationError
from pytorch3d.implicitron.tools.config import ( from pytorch3d.implicitron.tools.config import (
Configurable,
ReplaceableBase,
_get_type_to_process, _get_type_to_process,
_is_actually_dataclass, _is_actually_dataclass,
_ProcessType, _ProcessType,
_Registry, _Registry,
Configurable,
enable_get_default_args, enable_get_default_args,
expand_args_fields, expand_args_fields,
get_default_args, get_default_args,
get_default_args_field, get_default_args_field,
registry, registry,
remove_unused_components, remove_unused_components,
ReplaceableBase,
run_auto_creation, run_auto_creation,
) )

View File

@ -11,7 +11,7 @@ import torch
from pytorch3d.implicitron.tools.eval_video_trajectory import ( from pytorch3d.implicitron.tools.eval_video_trajectory import (
generate_eval_video_cameras, generate_eval_video_cameras,
) )
from pytorch3d.renderer.cameras import PerspectiveCameras, look_at_view_transform from pytorch3d.renderer.cameras import look_at_view_transform, PerspectiveCameras
from pytorch3d.transforms import axis_angle_to_matrix from pytorch3d.transforms import axis_angle_to_matrix

View File

@ -10,7 +10,7 @@ import torch
from pytorch3d.implicitron.models.base import GenericModel from pytorch3d.implicitron.models.base import GenericModel
from pytorch3d.implicitron.models.renderer.base import EvaluationMode from pytorch3d.implicitron.models.renderer.base import EvaluationMode
from pytorch3d.implicitron.tools.config import expand_args_fields from pytorch3d.implicitron.tools.config import expand_args_fields
from pytorch3d.renderer.cameras import PerspectiveCameras, look_at_view_transform from pytorch3d.renderer.cameras import look_at_view_transform, PerspectiveCameras
class TestGenericModel(unittest.TestCase): class TestGenericModel(unittest.TestCase):

View File

@ -8,7 +8,7 @@ import unittest
from itertools import product from itertools import product
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import sample_points_from_meshes from pytorch3d.ops import sample_points_from_meshes
from pytorch3d.ops.ball_query import ball_query from pytorch3d.ops.ball_query import ball_query
from pytorch3d.ops.knn import _KNN from pytorch3d.ops.knn import _KNN

View File

@ -10,7 +10,7 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops import eyes from pytorch3d.ops import eyes
from pytorch3d.renderer.points.pulsar import Renderer as PulsarRenderer from pytorch3d.renderer.points.pulsar import Renderer as PulsarRenderer
from pytorch3d.transforms import so3_exp_map, so3_log_map from pytorch3d.transforms import so3_exp_map, so3_log_map

View File

@ -11,9 +11,9 @@ import torch
from common_testing import TestCaseMixin from common_testing import TestCaseMixin
from pytorch3d.renderer.camera_utils import camera_to_eye_at_up, rotate_on_spot from pytorch3d.renderer.camera_utils import camera_to_eye_at_up, rotate_on_spot
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
PerspectiveCameras,
get_world_to_view_transform, get_world_to_view_transform,
look_at_view_transform, look_at_view_transform,
PerspectiveCameras,
) )
from pytorch3d.transforms import axis_angle_to_matrix from pytorch3d.transforms import axis_angle_to_matrix
from torch.nn.functional import normalize from torch.nn.functional import normalize

View File

@ -39,19 +39,19 @@ import torch
from common_testing import TestCaseMixin from common_testing import TestCaseMixin
from pytorch3d.renderer.camera_utils import join_cameras_as_batch from pytorch3d.renderer.camera_utils import join_cameras_as_batch
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
camera_position_from_spherical_angles,
CamerasBase, CamerasBase,
FoVOrthographicCameras, FoVOrthographicCameras,
FoVPerspectiveCameras, FoVPerspectiveCameras,
get_world_to_view_transform,
look_at_rotation,
look_at_view_transform,
OpenGLOrthographicCameras, OpenGLOrthographicCameras,
OpenGLPerspectiveCameras, OpenGLPerspectiveCameras,
OrthographicCameras, OrthographicCameras,
PerspectiveCameras, PerspectiveCameras,
SfMOrthographicCameras, SfMOrthographicCameras,
SfMPerspectiveCameras, SfMPerspectiveCameras,
camera_position_from_spherical_angles,
get_world_to_view_transform,
look_at_rotation,
look_at_view_transform,
) )
from pytorch3d.transforms import Transform3d from pytorch3d.transforms import Transform3d
from pytorch3d.transforms.rotation_conversions import random_rotations from pytorch3d.transforms.rotation_conversions import random_rotations

View File

@ -10,7 +10,7 @@ from collections import namedtuple
import numpy as np import numpy as np
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.loss import chamfer_distance from pytorch3d.loss import chamfer_distance
from pytorch3d.structures.pointclouds import Pointclouds from pytorch3d.structures.pointclouds import Pointclouds

View File

@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.renderer.compositing import ( from pytorch3d.renderer.compositing import (
alpha_composite, alpha_composite,
norm_weighted_sum, norm_weighted_sum,

View File

@ -8,7 +8,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import mesh_face_areas_normals from pytorch3d.ops import mesh_face_areas_normals
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes

View File

@ -8,9 +8,9 @@ import unittest
import torch import torch
import torch.nn as nn import torch.nn as nn
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.ops.graph_conv import GraphConv, gather_scatter, gather_scatter_python from pytorch3d.ops.graph_conv import gather_scatter, gather_scatter_python, GraphConv
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes
from pytorch3d.utils import ico_sphere from pytorch3d.utils import ico_sphere

View File

@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.interp_face_attrs import ( from pytorch3d.ops.interp_face_attrs import (
interpolate_face_attributes, interpolate_face_attributes,
interpolate_face_attributes_python, interpolate_face_attributes_python,

View File

@ -9,7 +9,7 @@ from math import radians
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_pytorch3d_dir, get_tests_dir from common_testing import get_pytorch3d_dir, get_tests_dir, TestCaseMixin
from PIL import Image from PIL import Image
from pytorch3d.io import IO from pytorch3d.io import IO
from pytorch3d.io.experimental_gltf_io import MeshGlbFormat from pytorch3d.io.experimental_gltf_io import MeshGlbFormat
@ -17,9 +17,9 @@ from pytorch3d.renderer import (
AmbientLights, AmbientLights,
BlendParams, BlendParams,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
look_at_view_transform,
rotate_on_spot, rotate_on_spot,
) )
from pytorch3d.renderer.mesh import ( from pytorch3d.renderer.mesh import (

View File

@ -14,10 +14,10 @@ from tempfile import NamedTemporaryFile, TemporaryDirectory
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from iopath.common.file_io import PathManager from iopath.common.file_io import PathManager
from pytorch3d.io import IO, load_obj, load_objs_as_meshes, save_obj from pytorch3d.io import IO, load_obj, load_objs_as_meshes, save_obj
@ -27,7 +27,7 @@ from pytorch3d.io.mtl_io import (
_parse_mtl, _parse_mtl,
) )
from pytorch3d.renderer import TexturesAtlas, TexturesUV, TexturesVertex from pytorch3d.renderer import TexturesAtlas, TexturesUV, TexturesVertex
from pytorch3d.structures import Meshes, join_meshes_as_batch from pytorch3d.structures import join_meshes_as_batch, Meshes
from pytorch3d.utils import torus from pytorch3d.utils import torus

View File

@ -11,7 +11,7 @@ from typing import List, Tuple, Union
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
from common_testing import TestCaseMixin, get_random_cuda_device, get_tests_dir from common_testing import get_random_cuda_device, get_tests_dir, TestCaseMixin
from pytorch3d.io import save_obj from pytorch3d.io import save_obj
from pytorch3d.ops.iou_box3d import _box_planes, _box_triangles, box3d_overlap from pytorch3d.ops.iou_box3d import _box_planes, _box_triangles, box3d_overlap
from pytorch3d.transforms.rotation_conversions import random_rotation from pytorch3d.transforms.rotation_conversions import random_rotation

View File

@ -8,7 +8,7 @@ import unittest
from itertools import product from itertools import product
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops.knn import _KNN, knn_gather, knn_points from pytorch3d.ops.knn import _KNN, knn_gather, knn_points

View File

@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import cot_laplacian, laplacian, norm_laplacian from pytorch3d.ops import cot_laplacian, laplacian, norm_laplacian
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes

View File

@ -9,7 +9,7 @@ import pickle
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops.marching_cubes import marching_cubes_naive from pytorch3d.ops.marching_cubes import marching_cubes_naive

View File

@ -8,7 +8,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import taubin_smoothing from pytorch3d.ops import taubin_smoothing
from pytorch3d.structures import Meshes from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere from pytorch3d.utils import ico_sphere

View File

@ -7,7 +7,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.ops import packed_to_padded, padded_to_packed from pytorch3d.ops import packed_to_padded, padded_to_packed
from pytorch3d.structures.meshes import Meshes from pytorch3d.structures.meshes import Meshes

View File

@ -8,10 +8,10 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.loss import point_mesh_edge_distance, point_mesh_face_distance from pytorch3d.loss import point_mesh_edge_distance, point_mesh_face_distance
from pytorch3d.structures import Meshes, Pointclouds, packed_to_list from pytorch3d.structures import Meshes, packed_to_list, Pointclouds
class TestPointMeshDistance(TestCaseMixin, unittest.TestCase): class TestPointMeshDistance(TestCaseMixin, unittest.TestCase):

View File

@ -12,7 +12,7 @@ import numpy as np
import torch import torch
from common_testing import TestCaseMixin from common_testing import TestCaseMixin
from pytorch3d.structures import utils as struct_utils from pytorch3d.structures import utils as struct_utils
from pytorch3d.structures.pointclouds import Pointclouds, join_pointclouds_as_batch from pytorch3d.structures.pointclouds import join_pointclouds_as_batch, Pointclouds
class TestPointclouds(TestCaseMixin, unittest.TestCase): class TestPointclouds(TestCaseMixin, unittest.TestCase):

View File

@ -8,7 +8,7 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir from common_testing import get_tests_dir, TestCaseMixin
from pytorch3d.ops import points_alignment from pytorch3d.ops import points_alignment
from pytorch3d.structures.pointclouds import Pointclouds from pytorch3d.structures.pointclouds import Pointclouds
from pytorch3d.transforms import rotation_conversions from pytorch3d.transforms import rotation_conversions

View File

@ -13,19 +13,19 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir, load_rgb_image from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from PIL import Image from PIL import Image
from pytorch3d.datasets import ( from pytorch3d.datasets import (
R2N2,
BlenderCamera, BlenderCamera,
collate_batched_R2N2, collate_batched_R2N2,
R2N2,
render_cubified_voxels, render_cubified_voxels,
) )
from pytorch3d.renderer import ( from pytorch3d.renderer import (
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
look_at_view_transform,
) )
from pytorch3d.renderer.cameras import get_world_to_view_transform from pytorch3d.renderer.cameras import get_world_to_view_transform
from pytorch3d.transforms import Transform3d from pytorch3d.transforms import Transform3d

View File

@ -8,7 +8,7 @@ import functools
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.renderer import FoVPerspectiveCameras, look_at_view_transform from pytorch3d.renderer import FoVPerspectiveCameras, look_at_view_transform
from pytorch3d.renderer.mesh import MeshRasterizer, RasterizationSettings from pytorch3d.renderer.mesh import MeshRasterizer, RasterizationSettings

View File

@ -9,7 +9,7 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.renderer.points.rasterize_points import ( from pytorch3d.renderer.points.rasterize_points import (
_format_radius, _format_radius,

View File

@ -10,10 +10,10 @@ from itertools import product
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.io import load_obj from pytorch3d.io import load_obj

View File

@ -21,10 +21,10 @@ from pytorch3d.renderer import (
NDCMultinomialRaysampler, NDCMultinomialRaysampler,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
ray_bundle_to_ray_points,
RayBundle, RayBundle,
SoftPhongShader, SoftPhongShader,
TexturesVertex, TexturesVertex,
ray_bundle_to_ray_points,
) )
from pytorch3d.structures import Meshes from pytorch3d.structures import Meshes
from pytorch3d.utils import ico_sphere from pytorch3d.utils import ico_sphere

View File

@ -15,19 +15,19 @@ from collections import namedtuple
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.io import load_obj from pytorch3d.io import load_obj
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
FoVOrthographicCameras, FoVOrthographicCameras,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
OrthographicCameras, OrthographicCameras,
PerspectiveCameras, PerspectiveCameras,
look_at_view_transform,
) )
from pytorch3d.renderer.lighting import AmbientLights, PointLights from pytorch3d.renderer.lighting import AmbientLights, PointLights
from pytorch3d.renderer.materials import Materials from pytorch3d.renderer.materials import Materials
@ -44,9 +44,9 @@ from pytorch3d.renderer.mesh.shader import (
TexturedSoftPhongShader, TexturedSoftPhongShader,
) )
from pytorch3d.structures.meshes import ( from pytorch3d.structures.meshes import (
Meshes,
join_meshes_as_batch, join_meshes_as_batch,
join_meshes_as_scene, join_meshes_as_scene,
Meshes,
) )
from pytorch3d.utils.ico_sphere import ico_sphere from pytorch3d.utils.ico_sphere import ico_sphere
from pytorch3d.utils.torus import torus from pytorch3d.utils.torus import torus

View File

@ -17,19 +17,19 @@ import unittest
import imageio import imageio
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir, load_rgb_image from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from pytorch3d.io import save_obj from pytorch3d.io import save_obj
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
FoVPerspectiveCameras, FoVPerspectiveCameras,
PerspectiveCameras,
look_at_view_transform, look_at_view_transform,
PerspectiveCameras,
) )
from pytorch3d.renderer.lighting import PointLights from pytorch3d.renderer.lighting import PointLights
from pytorch3d.renderer.mesh import ( from pytorch3d.renderer.mesh import (
ClipFrustum,
TexturesUV,
clip_faces, clip_faces,
ClipFrustum,
convert_clipped_rasterization_to_original_faces, convert_clipped_rasterization_to_original_faces,
TexturesUV,
) )
from pytorch3d.renderer.mesh.rasterize_meshes import _RasterizeFaceVerts from pytorch3d.renderer.mesh.rasterize_meshes import _RasterizeFaceVerts
from pytorch3d.renderer.mesh.rasterizer import MeshRasterizer, RasterizationSettings from pytorch3d.renderer.mesh.rasterizer import MeshRasterizer, RasterizationSettings

View File

@ -8,7 +8,7 @@ import unittest
import torch import torch
import torch.nn as nn import torch.nn as nn
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.renderer import ( from pytorch3d.renderer import (
AlphaCompositor, AlphaCompositor,
BlendParams, BlendParams,

View File

@ -15,18 +15,18 @@ from os import path
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_tests_dir, get_tests_dir,
load_rgb_image, load_rgb_image,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.renderer.cameras import ( from pytorch3d.renderer.cameras import (
FoVOrthographicCameras, FoVOrthographicCameras,
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
OrthographicCameras, OrthographicCameras,
PerspectiveCameras, PerspectiveCameras,
look_at_view_transform,
) )
from pytorch3d.renderer.compositing import alpha_composite, norm_weighted_sum from pytorch3d.renderer.compositing import alpha_composite, norm_weighted_sum
from pytorch3d.renderer.points import ( from pytorch3d.renderer.points import (

View File

@ -20,9 +20,9 @@ from pytorch3d.renderer import (
PointsRenderer, PointsRenderer,
) )
from pytorch3d.renderer.utils import ( from pytorch3d.renderer.utils import (
TensorProperties,
ndc_grid_sample, ndc_grid_sample,
ndc_to_grid_sample_coords, ndc_to_grid_sample_coords,
TensorProperties,
) )
from pytorch3d.structures import Pointclouds from pytorch3d.structures import Pointclouds

View File

@ -9,10 +9,10 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_random_cuda_device, get_random_cuda_device,
get_tests_dir, get_tests_dir,
TestCaseMixin,
) )
from pytorch3d.io import load_obj from pytorch3d.io import load_obj
from pytorch3d.ops.sample_farthest_points import ( from pytorch3d.ops.sample_farthest_points import (

View File

@ -10,10 +10,10 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import ( from common_testing import (
TestCaseMixin,
get_pytorch3d_dir, get_pytorch3d_dir,
get_random_cuda_device, get_random_cuda_device,
get_tests_dir, get_tests_dir,
TestCaseMixin,
) )
from PIL import Image from PIL import Image
from pytorch3d.io import load_objs_as_meshes from pytorch3d.io import load_objs_as_meshes

View File

@ -8,7 +8,7 @@ import unittest
import torch import torch
from common_testing import TestCaseMixin from common_testing import TestCaseMixin
from pytorch3d.renderer.cameras import PerspectiveCameras, look_at_view_transform from pytorch3d.renderer.cameras import look_at_view_transform, PerspectiveCameras
from pytorch3d.renderer.mesh.rasterizer import Fragments from pytorch3d.renderer.mesh.rasterizer import Fragments
from pytorch3d.renderer.mesh.shader import ( from pytorch3d.renderer.mesh.shader import (
HardFlatShader, HardFlatShader,

View File

@ -12,14 +12,14 @@ import unittest
import numpy as np import numpy as np
import torch import torch
from common_testing import TestCaseMixin, get_tests_dir, load_rgb_image from common_testing import get_tests_dir, load_rgb_image, TestCaseMixin
from PIL import Image from PIL import Image
from pytorch3d.datasets import ShapeNetCore, collate_batched_meshes from pytorch3d.datasets import collate_batched_meshes, ShapeNetCore
from pytorch3d.renderer import ( from pytorch3d.renderer import (
FoVPerspectiveCameras, FoVPerspectiveCameras,
look_at_view_transform,
PointLights, PointLights,
RasterizationSettings, RasterizationSettings,
look_at_view_transform,
) )
from torch.utils.data import DataLoader from torch.utils.data import DataLoader

View File

@ -8,7 +8,7 @@
import unittest import unittest
import torch import torch
from common_testing import TestCaseMixin, get_random_cuda_device from common_testing import get_random_cuda_device, TestCaseMixin
from pytorch3d.common.workaround import symeig3x3 from pytorch3d.common.workaround import symeig3x3
from pytorch3d.transforms.rotation_conversions import random_rotations from pytorch3d.transforms.rotation_conversions import random_rotations