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
...@@ -12,13 +12,13 @@ from pytorch3d.io import load_objs_as_meshes ...@@ -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,
) )
......
...@@ -8,7 +8,7 @@ import math ...@@ -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
......
...@@ -8,7 +8,7 @@ from typing import Tuple ...@@ -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):
......
...@@ -9,7 +9,7 @@ from typing import Tuple ...@@ -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):
......
...@@ -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 .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
......
...@@ -19,8 +19,8 @@ from pytorch3d.renderer import HardPhongShader ...@@ -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,
......
...@@ -39,7 +39,7 @@ from PIL import Image ...@@ -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
......
...@@ -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 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
......
...@@ -8,7 +8,7 @@ ...@@ -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
......
...@@ -11,7 +11,7 @@ from typing import List, Optional ...@@ -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
......
# @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
......
...@@ -13,7 +13,7 @@ import torch.nn.functional as F ...@@ -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
......
...@@ -10,7 +10,7 @@ from typing import Optional, Tuple ...@@ -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
......
...@@ -5,7 +5,7 @@ ...@@ -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
......
...@@ -42,18 +42,18 @@ from base64 import b64decode ...@@ -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
......
...@@ -18,11 +18,11 @@ from iopath.common.file_io import PathManager ...@@ -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.
......
...@@ -13,16 +13,16 @@ This format is introduced, for example, at ...@@ -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:
......
...@@ -21,14 +21,14 @@ from typing import List, Optional, Tuple ...@@ -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,
) )
......
...@@ -7,7 +7,7 @@ ...@@ -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
......
...@@ -5,7 +5,7 @@ ...@@ -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
......
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