mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
Add pyre typeshed information for Tensor.ndim and nn.ConvTranspose2d
Summary: Adding some appropriate methods into pyre typeshed. Removing corresponding pyre-ignore and pyre-fixme messages. Differential Revision: D22949138 fbshipit-source-id: add8acdd4611ab698954868832594d062cd58f88
This commit is contained in:
parent
701bbef4f3
commit
14f015d8bf
@ -41,7 +41,6 @@ def _handle_pointcloud_input(
|
||||
lengths = points.num_points_per_cloud()
|
||||
normals = points.normals_padded() # either a tensor or None
|
||||
elif torch.is_tensor(points):
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if points.ndim != 3:
|
||||
raise ValueError("Expected points to be of shape (N, P, D)")
|
||||
X = points
|
||||
|
@ -52,7 +52,6 @@ def _list_to_padded_wrapper(
|
||||
x_padded: tensor consisting of padded input tensors
|
||||
"""
|
||||
N = len(x)
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
dims = x[0].ndim
|
||||
reshape_dims = x[0].shape[1:]
|
||||
D = torch.prod(torch.tensor(reshape_dims)).item()
|
||||
@ -598,7 +597,6 @@ class TexturesUV(TexturesBase):
|
||||
self.align_corners = align_corners
|
||||
if isinstance(faces_uvs, (list, tuple)):
|
||||
for fv in faces_uvs:
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if fv.ndim != 2 or fv.shape[-1] != 3:
|
||||
msg = "Expected faces_uvs to be of shape (F, 3); got %r"
|
||||
raise ValueError(msg % repr(fv.shape))
|
||||
@ -1129,9 +1127,7 @@ class TexturesVertex(TexturesBase):
|
||||
"""
|
||||
if isinstance(verts_features, (tuple, list)):
|
||||
correct_shape = all(
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
(torch.is_tensor(v) and v.ndim == 2)
|
||||
for v in verts_features
|
||||
(torch.is_tensor(v) and v.ndim == 2) for v in verts_features
|
||||
)
|
||||
if not correct_shape:
|
||||
raise ValueError(
|
||||
|
@ -48,7 +48,6 @@ def list_to_padded(
|
||||
)
|
||||
for i, y in enumerate(x):
|
||||
if len(y) > 0:
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if y.ndim != 2:
|
||||
raise ValueError("Supports only 2-dimensional tensor items")
|
||||
x_padded[i, : y.shape[0], : y.shape[1]] = y
|
||||
@ -70,7 +69,6 @@ def padded_to_list(x: torch.Tensor, split_size: Union[list, tuple, None] = None)
|
||||
Returns:
|
||||
x_list: a list of tensors
|
||||
"""
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if x.ndim != 3:
|
||||
raise ValueError("Supports only 3-dimensional input tensors")
|
||||
|
||||
@ -178,7 +176,6 @@ def padded_to_packed(
|
||||
Returns:
|
||||
x_packed: a packed tensor.
|
||||
"""
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if x.ndim != 3:
|
||||
raise ValueError("Supports only 3-dimensional input tensors")
|
||||
|
||||
|
@ -155,7 +155,6 @@ class Transform3d:
|
||||
if matrix is None:
|
||||
self._matrix = torch.eye(4, dtype=dtype, device=device).view(1, 4, 4)
|
||||
else:
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `ndim`.
|
||||
if matrix.ndim not in (2, 3):
|
||||
raise ValueError('"matrix" has to be a 2- or a 3-dimensional tensor.')
|
||||
if matrix.shape[-2] != 4 or matrix.shape[-1] != 4:
|
||||
|
Loading…
x
Reference in New Issue
Block a user