Skip to content

Commit 51fd114

Browse files
huydhnfacebook-github-bot
authored andcommitted
Forward fix internal pyre failure from D58983461
Summary: X-link: pytorch/pytorch#129525 Somehow, using underscore alias of some builtin types breaks pyre Reviewed By: malfet, clee2000 Differential Revision: D59029768 fbshipit-source-id: cfa2171b66475727b9545355e57a8297c1dc0bc6
1 parent 8965341 commit 51fd114

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

pytorch3d/implicitron/models/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ def weighted_sum_losses(
121121
return None
122122
loss = sum(losses_weighted)
123123
assert torch.is_tensor(loss)
124-
# pyre-fixme[7]: Expected `Optional[Tensor]` but got `int`.
125124
return loss
126125

127126

pytorch3d/ops/utils.py

-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ def convert_pointclouds_to_tensor(pcl: Union[torch.Tensor, "Pointclouds"]):
143143
elif torch.is_tensor(pcl):
144144
X = pcl
145145
num_points = X.shape[1] * torch.ones( # type: ignore
146-
# pyre-fixme[16]: Item `Pointclouds` of `Union[Pointclouds, Tensor]` has
147-
# no attribute `shape`.
148146
X.shape[0],
149147
device=X.device,
150148
dtype=torch.int64,

pytorch3d/renderer/blending.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ def softmax_rgb_blend(
212212

213213
# Reshape to be compatible with (N, H, W, K) values in fragments
214214
if torch.is_tensor(zfar):
215-
# pyre-fixme[16]
216215
zfar = zfar[:, None, None, None]
217216
if torch.is_tensor(znear):
218-
# pyre-fixme[16]: Item `float` of `Union[float, Tensor]` has no attribute
219-
# `__getitem__`.
220217
znear = znear[:, None, None, None]
221218

219+
# pyre-fixme[6]: Expected `float` but got `Union[float, Tensor]`
222220
z_inv = (zfar - fragments.zbuf) / (zfar - znear) * mask
221+
# pyre-fixme[6]: Expected `Tensor` but got `float`
223222
z_inv_max = torch.max(z_inv, dim=-1).values[..., None].clamp(min=eps)
223+
# pyre-fixme[6]: Expected `Tensor` but got `float`
224224
weights_num = prob_map * torch.exp((z_inv - z_inv_max) / blend_params.gamma)
225225

226226
# Also apply exp normalize trick for the background color weight.

pytorch3d/renderer/cameras.py

-2
Original file line numberDiff line numberDiff line change
@@ -1782,8 +1782,6 @@ def get_ndc_to_screen_transform(
17821782
K = torch.zeros((cameras._N, 4, 4), device=cameras.device, dtype=torch.float32)
17831783
if not torch.is_tensor(image_size):
17841784
image_size = torch.tensor(image_size, device=cameras.device)
1785-
# pyre-fixme[16]: Item `List` of `Union[List[typing.Any], Tensor, Tuple[Any,
1786-
# ...]]` has no attribute `view`.
17871785
image_size = image_size.view(-1, 2) # of shape (1 or B)x2
17881786
height, width = image_size.unbind(1)
17891787

pytorch3d/renderer/utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ def gather_props(self, batch_idx) -> "TensorProperties":
270270
# to have the same shape as the input tensor.
271271
new_dims = len(tensor_dims) - len(idx_dims)
272272
new_shape = idx_dims + (1,) * new_dims
273+
# pyre-fixme[58]: `+` is not supported for operand types
274+
# `Tuple[int]` and `torch._C.Size`
273275
expand_dims = (-1,) + tensor_dims[1:]
274276
_batch_idx = _batch_idx.view(*new_shape)
275277
_batch_idx = _batch_idx.expand(*expand_dims)

0 commit comments

Comments
 (0)