提交 34bbb3ad 编辑于 作者: Tim Hatch's avatar Tim Hatch 提交者: Facebook GitHub Bot
浏览文件

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
显示 30 个添加30 个删除
+30 -30
......@@ -12,13 +12,13 @@ from pytorch3d.io import load_objs_as_meshes
from pytorch3d.renderer import (
BlendParams,
FoVPerspectiveCameras,
look_at_view_transform,
MeshRasterizer,
MeshRenderer,
PointLights,
RasterizationSettings,
SoftPhongShader,
SoftSilhouetteShader,
look_at_view_transform,
)
......
......@@ -8,7 +8,7 @@ import math
from typing import Tuple
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
......
......@@ -8,7 +8,7 @@ from typing import Tuple
import torch
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):
......
......@@ -9,7 +9,7 @@ from typing import Tuple
import torch
import torch.nn.functional as F
from torch.nn import Parameter, init
from torch.nn import init, Parameter
class LinearWithRepeat(torch.nn.Module):
......
......@@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the
# 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 .utils import collate_batched_meshes
......
......@@ -19,8 +19,8 @@ from pytorch3d.renderer import HardPhongShader
from tabulate import tabulate
from .utils import (
BlenderCamera,
align_bbox,
BlenderCamera,
compute_extrinsic_matrix,
read_binvox_coords,
voxelize,
......
......@@ -39,7 +39,7 @@ from PIL import Image
from pytorch3d.io import IO
from pytorch3d.renderer.camera_utils import join_cameras_as_batch
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
......
......@@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional, Tuple, cast
from typing import cast, Optional, Tuple
import torch
from pytorch3d.implicitron.tools.point_cloud_utils import get_rgbd_point_cloud
......
......@@ -8,7 +8,7 @@
import copy
import dataclasses
import os
from typing import Optional, cast
from typing import cast, Optional
import lpips
import torch
......
......@@ -11,7 +11,7 @@ from typing import List, Optional
import torch
from pytorch3d.common.linear_with_repeat import LinearWithRepeat
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.implicit import HarmonicEmbedding
......
# @lint-ignore-every LICENSELINT
# Adapted from https://github.com/vsitzmann/scene-representation-networks
# Copyright (c) 2019 Vincent Sitzmann
from typing import Any, Optional, Tuple, cast
from typing import Any, cast, Optional, Tuple
import torch
from pytorch3d.common.linear_with_repeat import LinearWithRepeat
from pytorch3d.implicitron.third_party import hyperlayers, pytorch_prototyping
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.implicit import HarmonicEmbedding
......
......@@ -13,7 +13,7 @@ import torch.nn.functional as F
from pytorch3d.implicitron.models.view_pooling.view_sampling import (
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.renderer.cameras import CamerasBase
......
......@@ -10,7 +10,7 @@ from typing import Optional, Tuple
import torch
from pytorch3d.common.compat import eigh
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
......
......@@ -5,7 +5,7 @@
# 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.nn.functional as Fu
......
......@@ -42,18 +42,18 @@ from base64 import b64decode
from collections import deque
from enum import IntEnum
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 torch
from iopath.common.file_io import PathManager
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.structures import Meshes, join_meshes_as_scene
from pytorch3d.transforms import Transform3d, quaternion_to_matrix
from pytorch3d.structures import join_meshes_as_scene, Meshes
from pytorch3d.transforms import quaternion_to_matrix, Transform3d
from .pluggable_formats import MeshFormatInterpreter, endswith
from .pluggable_formats import endswith, MeshFormatInterpreter
_GLTF_MAGIC = 0x46546C67
......
......@@ -18,11 +18,11 @@ from iopath.common.file_io import PathManager
from PIL import Image
from pytorch3d.common.datatypes import Device
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.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.
......
......@@ -13,16 +13,16 @@ This format is introduced, for example, at
http://www.geomview.org/docs/html/OFF.html .
"""
import warnings
from typing import Optional, Tuple, Union, cast
from typing import cast, Optional, Tuple, Union
import numpy as np
import torch
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.structures import Meshes
from .pluggable_formats import MeshFormatInterpreter, endswith
from .pluggable_formats import endswith, MeshFormatInterpreter
def _is_line_empty(line: Union[str, bytes]) -> bool:
......
......@@ -21,14 +21,14 @@ from typing import List, Optional, Tuple
import numpy as np
import torch
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.structures import Meshes, Pointclouds
from .pluggable_formats import (
endswith,
MeshFormatInterpreter,
PointcloudFormatInterpreter,
endswith,
)
......
......@@ -7,7 +7,7 @@
import contextlib
import pathlib
import warnings
from typing import IO, ContextManager, Optional, Union
from typing import ContextManager, IO, Optional, Union
import numpy as np
import torch
......
......@@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.
import warnings
from typing import TYPE_CHECKING, List, NamedTuple, Optional, Union
from typing import List, NamedTuple, Optional, TYPE_CHECKING, Union
import torch
from pytorch3d.ops import knn_points
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册