mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									89653419d0
								
							
						
					
					
						commit
						51fd114d8b
					
				@ -121,7 +121,6 @@ def weighted_sum_losses(
 | 
			
		||||
        return None
 | 
			
		||||
    loss = sum(losses_weighted)
 | 
			
		||||
    assert torch.is_tensor(loss)
 | 
			
		||||
    # pyre-fixme[7]: Expected `Optional[Tensor]` but got `int`.
 | 
			
		||||
    return loss
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -143,8 +143,6 @@ def convert_pointclouds_to_tensor(pcl: Union[torch.Tensor, "Pointclouds"]):
 | 
			
		||||
    elif torch.is_tensor(pcl):
 | 
			
		||||
        X = pcl
 | 
			
		||||
        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],
 | 
			
		||||
            device=X.device,
 | 
			
		||||
            dtype=torch.int64,
 | 
			
		||||
 | 
			
		||||
@ -212,15 +212,15 @@ def softmax_rgb_blend(
 | 
			
		||||
 | 
			
		||||
    # Reshape to be compatible with (N, H, W, K) values in fragments
 | 
			
		||||
    if torch.is_tensor(zfar):
 | 
			
		||||
        # pyre-fixme[16]
 | 
			
		||||
        zfar = zfar[:, None, None, None]
 | 
			
		||||
    if torch.is_tensor(znear):
 | 
			
		||||
        # pyre-fixme[16]: Item `float` of `Union[float, Tensor]` has no attribute
 | 
			
		||||
        #  `__getitem__`.
 | 
			
		||||
        znear = znear[:, None, None, None]
 | 
			
		||||
 | 
			
		||||
    # pyre-fixme[6]: Expected `float` but got `Union[float, Tensor]`
 | 
			
		||||
    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)
 | 
			
		||||
    # pyre-fixme[6]: Expected `Tensor` but got `float`
 | 
			
		||||
    weights_num = prob_map * torch.exp((z_inv - z_inv_max) / blend_params.gamma)
 | 
			
		||||
 | 
			
		||||
    # Also apply exp normalize trick for the background color weight.
 | 
			
		||||
 | 
			
		||||
@ -1782,8 +1782,6 @@ def get_ndc_to_screen_transform(
 | 
			
		||||
    K = torch.zeros((cameras._N, 4, 4), device=cameras.device, dtype=torch.float32)
 | 
			
		||||
    if not torch.is_tensor(image_size):
 | 
			
		||||
        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
 | 
			
		||||
    height, width = image_size.unbind(1)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -270,6 +270,8 @@ class TensorProperties(nn.Module):
 | 
			
		||||
                        # to have the same shape as the input tensor.
 | 
			
		||||
                        new_dims = len(tensor_dims) - len(idx_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:]
 | 
			
		||||
                        _batch_idx = _batch_idx.view(*new_shape)
 | 
			
		||||
                        _batch_idx = _batch_idx.expand(*expand_dims)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user