"tests/python/pytorch/nn/test_nn.py" did not exist on "8005978e1eebd1b0dbbafb4dada66f5dd504d7ec"
Commit 34bbb3ad authored by Tim Hatch's avatar Tim Hatch Committed by Facebook GitHub Bot
Browse files

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
parent df08ea8e
...@@ -4,7 +4,7 @@ ...@@ -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
......
...@@ -11,19 +11,19 @@ from .blending import ( ...@@ -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 ( ...@@ -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 ( ...@@ -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 ( ...@@ -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,
) )
......
...@@ -15,9 +15,9 @@ from .raysampling import ( ...@@ -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,
) )
......
...@@ -9,7 +9,7 @@ import torch ...@@ -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:
......
...@@ -6,16 +6,15 @@ ...@@ -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 ( ...@@ -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("_")]
...@@ -12,8 +12,8 @@ import torch ...@@ -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,
) )
......
...@@ -4,7 +4,7 @@ ...@@ -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
......
...@@ -11,14 +11,14 @@ import plotly.graph_objects as go ...@@ -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]
......
...@@ -13,7 +13,7 @@ from typing import List, Optional ...@@ -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]:
......
...@@ -13,18 +13,18 @@ from typing import Any, List, Optional, Set, Tuple ...@@ -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,
) )
......
...@@ -11,7 +11,7 @@ import torch ...@@ -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
......
...@@ -10,7 +10,7 @@ import torch ...@@ -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):
......
...@@ -8,7 +8,7 @@ import unittest ...@@ -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
......
...@@ -10,7 +10,7 @@ import unittest ...@@ -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
......
...@@ -11,9 +11,9 @@ import torch ...@@ -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
......
...@@ -39,19 +39,19 @@ import torch ...@@ -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
......
...@@ -10,7 +10,7 @@ from collections import namedtuple ...@@ -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
......
...@@ -7,7 +7,7 @@ ...@@ -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,
......
...@@ -8,7 +8,7 @@ ...@@ -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
......
...@@ -8,9 +8,9 @@ import unittest ...@@ -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
......
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