Skip to content

Commit

Permalink
rename types to avoid clash
Browse files Browse the repository at this point in the history
Summary: There are cases where importing pytorch3d seems to fail (internally at Meta) because of a clash between the builtin types module and ours, so rename ours.

Reviewed By: patricklabatut

Differential Revision: D34426817

fbshipit-source-id: f175448db6a4967a9a3f7bb6f595aad2ffb36455
  • Loading branch information
bottler authored and facebook-github-bot committed Feb 25, 2022
1 parent 0e88b21 commit f816568
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pytorch3d/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 .types import Device, get_device, make_device
from .datatypes import Device, get_device, make_device


__all__ = [k for k in globals().keys() if not k.startswith("_")]
File renamed without changes.
2 changes: 1 addition & 1 deletion pytorch3d/datasets/r2n2/r2n2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import numpy as np
import torch
from PIL import Image
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.datasets.shapenet_base import ShapeNetBase
from pytorch3d.renderer import HardPhongShader
from tabulate import tabulate
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/datasets/r2n2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import numpy as np
import torch
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.datasets.utils import collate_batched_meshes
from pytorch3d.ops import cubify
from pytorch3d.renderer import (
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/datasets/shapenet_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Dict, List, Optional, Tuple

import torch
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.io import load_obj
from pytorch3d.renderer import (
FoVPerspectiveCameras,
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/io/mtl_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import torch
import torch.nn.functional as F
from iopath.common.file_io import PathManager
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.io.utils import _open_file, _read_image


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/io/obj_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import torch
from iopath.common.file_io import PathManager
from PIL import Image
from pytorch3d.common.types import Device
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.renderer import TexturesAtlas, TexturesUV
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/io/pluggable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import Deque, Optional, Union

from iopath.common.file_io import PathManager
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.structures import Meshes, Pointclouds

from .obj_io import MeshObjFormat
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/io/pluggable_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Optional, Tuple

from iopath.common.file_io import PathManager
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.io.utils import PathOrStr
from pytorch3d.structures import Meshes, Pointclouds

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from iopath.common.file_io import PathManager
from PIL import Image

from ..common.types import Device
from ..common.datatypes import Device


@contextlib.contextmanager
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
import torch
import torch.nn.functional as F
from pytorch3d.common.types import Device
from pytorch3d.common.datatypes import Device
from pytorch3d.transforms import Rotate, Transform3d, Translate

from .utils import TensorProperties, convert_to_tensors_and_broadcast
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/lighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch
import torch.nn.functional as F

from ..common.types import Device
from ..common.datatypes import Device
from .utils import TensorProperties, convert_to_tensors_and_broadcast


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import torch

from ..common.types import Device
from ..common.datatypes import Device
from .utils import TensorProperties


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/mesh/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import torch
import torch.nn as nn

from ...common.types import Device
from ...common.datatypes import Device
from ...structures.meshes import Meshes
from ..blending import (
BlendParams,
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import torch
import torch.nn as nn

from ..common.types import Device, make_device
from ..common.datatypes import Device, make_device


class TensorAccessor(nn.Module):
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/structures/meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import torch

from ..common.types import Device, make_device
from ..common.datatypes import Device, make_device
from . import utils as struct_utils


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/structures/pointclouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import torch

from ..common.types import Device, make_device
from ..common.datatypes import Device, make_device
from . import utils as struct_utils


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/structures/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import torch

from ..common.types import Device, make_device
from ..common.datatypes import Device, make_device
from ..transforms import Scale, Transform3d
from . import utils as struct_utils

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/transforms/rotation_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import torch
import torch.nn.functional as F

from ..common.types import Device
from ..common.datatypes import Device


"""
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/transforms/transform3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import torch

from ..common.types import Device, get_device, make_device
from ..common.datatypes import Device, get_device, make_device
from ..common.workaround import _safe_det_3x3
from .rotation_conversions import _axis_angle_rotation

Expand Down

0 comments on commit f816568

Please sign in to comment.