Skip to content

Commit f816568

Browse files
bottlerfacebook-github-bot
authored andcommitted
rename types to avoid clash
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
1 parent 0e88b21 commit f816568

20 files changed

+19
-19
lines changed

pytorch3d/common/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
from .types import Device, get_device, make_device
7+
from .datatypes import Device, get_device, make_device
88

99

1010
__all__ = [k for k in globals().keys() if not k.startswith("_")]
File renamed without changes.

pytorch3d/datasets/r2n2/r2n2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import numpy as np
1414
import torch
1515
from PIL import Image
16-
from pytorch3d.common.types import Device
16+
from pytorch3d.common.datatypes import Device
1717
from pytorch3d.datasets.shapenet_base import ShapeNetBase
1818
from pytorch3d.renderer import HardPhongShader
1919
from tabulate import tabulate

pytorch3d/datasets/r2n2/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import numpy as np
1111
import torch
12-
from pytorch3d.common.types import Device
12+
from pytorch3d.common.datatypes import Device
1313
from pytorch3d.datasets.utils import collate_batched_meshes
1414
from pytorch3d.ops import cubify
1515
from pytorch3d.renderer import (

pytorch3d/datasets/shapenet_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Dict, List, Optional, Tuple
99

1010
import torch
11-
from pytorch3d.common.types import Device
11+
from pytorch3d.common.datatypes import Device
1212
from pytorch3d.io import load_obj
1313
from pytorch3d.renderer import (
1414
FoVPerspectiveCameras,

pytorch3d/io/mtl_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import torch
1414
import torch.nn.functional as F
1515
from iopath.common.file_io import PathManager
16-
from pytorch3d.common.types import Device
16+
from pytorch3d.common.datatypes import Device
1717
from pytorch3d.io.utils import _open_file, _read_image
1818

1919

pytorch3d/io/obj_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import torch
1717
from iopath.common.file_io import PathManager
1818
from PIL import Image
19-
from pytorch3d.common.types import Device
19+
from pytorch3d.common.datatypes import Device
2020
from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas
2121
from pytorch3d.io.utils import PathOrStr, _check_faces_indices, _make_tensor, _open_file
2222
from pytorch3d.renderer import TexturesAtlas, TexturesUV

pytorch3d/io/pluggable.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import Deque, Optional, Union
1111

1212
from iopath.common.file_io import PathManager
13-
from pytorch3d.common.types import Device
13+
from pytorch3d.common.datatypes import Device
1414
from pytorch3d.structures import Meshes, Pointclouds
1515

1616
from .obj_io import MeshObjFormat

pytorch3d/io/pluggable_formats.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import Optional, Tuple
1010

1111
from iopath.common.file_io import PathManager
12-
from pytorch3d.common.types import Device
12+
from pytorch3d.common.datatypes import Device
1313
from pytorch3d.io.utils import PathOrStr
1414
from pytorch3d.structures import Meshes, Pointclouds
1515

pytorch3d/io/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from iopath.common.file_io import PathManager
1515
from PIL import Image
1616

17-
from ..common.types import Device
17+
from ..common.datatypes import Device
1818

1919

2020
@contextlib.contextmanager

pytorch3d/renderer/cameras.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import numpy as np
1212
import torch
1313
import torch.nn.functional as F
14-
from pytorch3d.common.types import Device
14+
from pytorch3d.common.datatypes import Device
1515
from pytorch3d.transforms import Rotate, Transform3d, Translate
1616

1717
from .utils import TensorProperties, convert_to_tensors_and_broadcast

pytorch3d/renderer/lighting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import torch
99
import torch.nn.functional as F
1010

11-
from ..common.types import Device
11+
from ..common.datatypes import Device
1212
from .utils import TensorProperties, convert_to_tensors_and_broadcast
1313

1414

pytorch3d/renderer/materials.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import torch
99

10-
from ..common.types import Device
10+
from ..common.datatypes import Device
1111
from .utils import TensorProperties
1212

1313

pytorch3d/renderer/mesh/shader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import torch
1111
import torch.nn as nn
1212

13-
from ...common.types import Device
13+
from ...common.datatypes import Device
1414
from ...structures.meshes import Meshes
1515
from ..blending import (
1616
BlendParams,

pytorch3d/renderer/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import torch
1515
import torch.nn as nn
1616

17-
from ..common.types import Device, make_device
17+
from ..common.datatypes import Device, make_device
1818

1919

2020
class TensorAccessor(nn.Module):

pytorch3d/structures/meshes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import torch
1010

11-
from ..common.types import Device, make_device
11+
from ..common.datatypes import Device, make_device
1212
from . import utils as struct_utils
1313

1414

pytorch3d/structures/pointclouds.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import numpy as np
1111
import torch
1212

13-
from ..common.types import Device, make_device
13+
from ..common.datatypes import Device, make_device
1414
from . import utils as struct_utils
1515

1616

pytorch3d/structures/volumes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import torch
1111

12-
from ..common.types import Device, make_device
12+
from ..common.datatypes import Device, make_device
1313
from ..transforms import Scale, Transform3d
1414
from . import utils as struct_utils
1515

pytorch3d/transforms/rotation_conversions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import torch
1010
import torch.nn.functional as F
1111

12-
from ..common.types import Device
12+
from ..common.datatypes import Device
1313

1414

1515
"""

pytorch3d/transforms/transform3d.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import torch
1212

13-
from ..common.types import Device, get_device, make_device
13+
from ..common.datatypes import Device, get_device, make_device
1414
from ..common.workaround import _safe_det_3x3
1515
from .rotation_conversions import _axis_angle_rotation
1616

0 commit comments

Comments
 (0)