You need to sign in or sign up before continuing.
Commit 51fd114d authored by Huy Do's avatar Huy Do Committed by Facebook GitHub Bot
Browse files

Forward fix internal pyre failure from D58983461

Summary:
X-link: https://github.com/pytorch/pytorch/pull/129525

Somehow, using underscore alias of some builtin types breaks pyre

Reviewed By: malfet, clee2000

Differential Revision: D59029768

fbshipit-source-id: cfa2171b66475727b9545355e57a8297c1dc0bc6
parent 89653419
...@@ -121,7 +121,6 @@ def weighted_sum_losses( ...@@ -121,7 +121,6 @@ def weighted_sum_losses(
return None return None
loss = sum(losses_weighted) loss = sum(losses_weighted)
assert torch.is_tensor(loss) assert torch.is_tensor(loss)
# pyre-fixme[7]: Expected `Optional[Tensor]` but got `int`.
return loss return loss
......
...@@ -143,8 +143,6 @@ def convert_pointclouds_to_tensor(pcl: Union[torch.Tensor, "Pointclouds"]): ...@@ -143,8 +143,6 @@ def convert_pointclouds_to_tensor(pcl: Union[torch.Tensor, "Pointclouds"]):
elif torch.is_tensor(pcl): elif torch.is_tensor(pcl):
X = pcl X = pcl
num_points = X.shape[1] * torch.ones( # type: ignore num_points = X.shape[1] * torch.ones( # type: ignore
# pyre-fixme[16]: Item `Pointclouds` of `Union[Pointclouds, Tensor]` has
# no attribute `shape`.
X.shape[0], X.shape[0],
device=X.device, device=X.device,
dtype=torch.int64, dtype=torch.int64,
......
...@@ -212,15 +212,15 @@ def softmax_rgb_blend( ...@@ -212,15 +212,15 @@ def softmax_rgb_blend(
# Reshape to be compatible with (N, H, W, K) values in fragments # Reshape to be compatible with (N, H, W, K) values in fragments
if torch.is_tensor(zfar): if torch.is_tensor(zfar):
# pyre-fixme[16]
zfar = zfar[:, None, None, None] zfar = zfar[:, None, None, None]
if torch.is_tensor(znear): if torch.is_tensor(znear):
# pyre-fixme[16]: Item `float` of `Union[float, Tensor]` has no attribute
# `__getitem__`.
znear = znear[:, None, None, None] znear = znear[:, None, None, None]
# pyre-fixme[6]: Expected `float` but got `Union[float, Tensor]`
z_inv = (zfar - fragments.zbuf) / (zfar - znear) * mask z_inv = (zfar - fragments.zbuf) / (zfar - znear) * mask
# pyre-fixme[6]: Expected `Tensor` but got `float`
z_inv_max = torch.max(z_inv, dim=-1).values[..., None].clamp(min=eps) z_inv_max = torch.max(z_inv, dim=-1).values[..., None].clamp(min=eps)
# pyre-fixme[6]: Expected `Tensor` but got `float`
weights_num = prob_map * torch.exp((z_inv - z_inv_max) / blend_params.gamma) weights_num = prob_map * torch.exp((z_inv - z_inv_max) / blend_params.gamma)
# Also apply exp normalize trick for the background color weight. # Also apply exp normalize trick for the background color weight.
......
...@@ -1782,8 +1782,6 @@ def get_ndc_to_screen_transform( ...@@ -1782,8 +1782,6 @@ def get_ndc_to_screen_transform(
K = torch.zeros((cameras._N, 4, 4), device=cameras.device, dtype=torch.float32) K = torch.zeros((cameras._N, 4, 4), device=cameras.device, dtype=torch.float32)
if not torch.is_tensor(image_size): if not torch.is_tensor(image_size):
image_size = torch.tensor(image_size, device=cameras.device) image_size = torch.tensor(image_size, device=cameras.device)
# pyre-fixme[16]: Item `List` of `Union[List[typing.Any], Tensor, Tuple[Any,
# ...]]` has no attribute `view`.
image_size = image_size.view(-1, 2) # of shape (1 or B)x2 image_size = image_size.view(-1, 2) # of shape (1 or B)x2
height, width = image_size.unbind(1) height, width = image_size.unbind(1)
......
...@@ -270,6 +270,8 @@ class TensorProperties(nn.Module): ...@@ -270,6 +270,8 @@ class TensorProperties(nn.Module):
# to have the same shape as the input tensor. # to have the same shape as the input tensor.
new_dims = len(tensor_dims) - len(idx_dims) new_dims = len(tensor_dims) - len(idx_dims)
new_shape = idx_dims + (1,) * new_dims new_shape = idx_dims + (1,) * new_dims
# pyre-fixme[58]: `+` is not supported for operand types
# `Tuple[int]` and `torch._C.Size`
expand_dims = (-1,) + tensor_dims[1:] expand_dims = (-1,) + tensor_dims[1:]
_batch_idx = _batch_idx.view(*new_shape) _batch_idx = _batch_idx.view(*new_shape)
_batch_idx = _batch_idx.expand(*expand_dims) _batch_idx = _batch_idx.expand(*expand_dims)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment