diff --git a/pytorch3d/renderer/cameras.py b/pytorch3d/renderer/cameras.py index 4f5f1615..ed1d4371 100644 --- a/pytorch3d/renderer/cameras.py +++ b/pytorch3d/renderer/cameras.py @@ -905,7 +905,7 @@ def get_world_to_view_transform(R=r, T=t) -> Transform3d: raise ValueError(msg % repr(T.shape)) if R.dim() != 3 or R.shape[1:] != (3, 3): msg = "Expected R to have shape (N, 3, 3); got %r" - raise ValueError(msg % R.shape) + raise ValueError(msg % repr(R.shape)) # Create a Transform3d object T = Translate(T, device=T.device) diff --git a/pytorch3d/renderer/mesh/utils.py b/pytorch3d/renderer/mesh/utils.py index a82f10ca..2179b2ec 100644 --- a/pytorch3d/renderer/mesh/utils.py +++ b/pytorch3d/renderer/mesh/utils.py @@ -19,7 +19,7 @@ def _clip_barycentric_coordinates(bary) -> torch.Tensor: """ if bary.shape[-1] != 3: msg = "Expected barycentric coords to have last dim = 3; got %r" - raise ValueError(msg % bary.shape) + raise ValueError(msg % (bary.shape,)) clipped = bary.clamp(min=0.0) clipped_sum = torch.clamp(clipped.sum(dim=-1, keepdim=True), min=1e-5) clipped = clipped / clipped_sum @@ -57,7 +57,7 @@ def interpolate_face_attributes( N, H, W, K, _ = barycentric_coords.shape if pix_to_face.shape != (N, H, W, K): msg = "pix_to_face must have shape (batch_size, H, W, K); got %r" - raise ValueError(msg % pix_to_face.shape) + raise ValueError(msg % (pix_to_face.shape,)) # Replace empty pixels in pix_to_face with 0 in order to interpolate. mask = pix_to_face == -1 diff --git a/pytorch3d/structures/textures.py b/pytorch3d/structures/textures.py index 0f30f0aa..eb057ba2 100644 --- a/pytorch3d/structures/textures.py +++ b/pytorch3d/structures/textures.py @@ -103,7 +103,7 @@ class Textures(object): raise ValueError(msg % repr(faces_uvs.shape)) if verts_rgb is not None and verts_rgb.ndim != 3: msg = "Expected verts_rgb to be of shape (N, V, 3); got %r" - raise ValueError(msg % verts_rgb.shape) + raise ValueError(msg % repr(verts_rgb.shape)) if maps is not None: if torch.is_tensor(maps) and maps.ndim != 4: msg = "Expected maps to be of shape (N, H, W, 3); got %r" diff --git a/pytorch3d/transforms/transform3d.py b/pytorch3d/transforms/transform3d.py index cd901f98..34cfd395 100644 --- a/pytorch3d/transforms/transform3d.py +++ b/pytorch3d/transforms/transform3d.py @@ -275,7 +275,7 @@ class Transform3d: points_batch = points_batch[None] # (P, 3) -> (1, P, 3) if points_batch.dim() != 3: msg = "Expected points to have dim = 2 or dim = 3: got shape %r" - raise ValueError(msg % points.shape) + raise ValueError(msg % repr(points.shape)) N, P, _3 = points_batch.shape ones = torch.ones(N, P, 1, dtype=points.dtype, device=points.device) @@ -309,7 +309,7 @@ class Transform3d: """ if normals.dim() not in [2, 3]: msg = "Expected normals to have dim = 2 or dim = 3: got shape %r" - raise ValueError(msg % normals.shape) + raise ValueError(msg % (normals.shape,)) composed_matrix = self.get_matrix() # TODO: inverse is bad! Solve a linear system instead