Remove _C pyre fixmes

Summary:
Get rid of pyre fixmes related to importing a native module:
- add stub file for the `_C` native extension to the internal typeshed
- add initial annotations to the new stub file
- remove the now unnecessary pyre ignores

Reviewed By: nikhilaravi

Differential Revision: D28929467

fbshipit-source-id: 6525e15c8f27215a3ff6f78392925fd0ed6ec2ac
This commit is contained in:
Patrick Labatut 2021-06-22 18:35:17 -07:00 committed by Facebook GitHub Bot
parent de72049fe5
commit e4039aa570
12 changed files with 12 additions and 13 deletions

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
def mesh_normal_consistency(meshes): def mesh_normal_consistency(meshes):

View File

@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the # This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
# pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
from pytorch3d import _C from pytorch3d import _C
from pytorch3d.structures import Meshes, Pointclouds from pytorch3d.structures import Meshes, Pointclouds
from torch.autograd import Function from torch.autograd import Function

View File

@ -7,7 +7,7 @@
import torch import torch
import torch.nn as nn import torch.nn as nn
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from torch.autograd import Function from torch.autograd import Function
from torch.autograd.function import once_differentiable from torch.autograd.function import once_differentiable

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from torch.autograd import Function from torch.autograd import Function
from torch.autograd.function import once_differentiable from torch.autograd.function import once_differentiable

View File

@ -8,7 +8,7 @@ from collections import namedtuple
from typing import Union from typing import Union
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from torch.autograd import Function from torch.autograd import Function
from torch.autograd.function import once_differentiable from torch.autograd.function import once_differentiable
@ -58,7 +58,6 @@ class _knn_points(Function):
in p2 has fewer than K points and where a cloud in p1 has fewer than P1 points. in p2 has fewer than K points and where a cloud in p1 has fewer than P1 points.
""" """
# pyre-fixme[16]: Module `pytorch3d` has no attribute `_C`.
idx, dists = _C.knn_points_idx(p1, p2, lengths1, lengths2, K, version) idx, dists = _C.knn_points_idx(p1, p2, lengths1, lengths2, K, version)
# sort KNN in ascending order if K > 1 # sort KNN in ascending order if K > 1
@ -74,6 +73,7 @@ class _knn_points(Function):
dists[mask] = 0 dists[mask] = 0
else: else:
dists, sort_idx = dists.sort(dim=2) dists, sort_idx = dists.sort(dim=2)
# pyre-fixme[16]: `Tensor` has no attribute `gather`.
idx = idx.gather(2, sort_idx) idx = idx.gather(2, sort_idx)
ctx.save_for_backward(p1, p2, lengths1, lengths2, idx) ctx.save_for_backward(p1, p2, lengths1, lengths2, idx)

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from torch.autograd import Function from torch.autograd import Function
from torch.autograd.function import once_differentiable from torch.autograd.function import once_differentiable

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from torch.autograd import Function from torch.autograd import Function
from torch.autograd.function import once_differentiable from torch.autograd.function import once_differentiable

View File

@ -8,7 +8,7 @@
from typing import NamedTuple, Sequence, Union from typing import NamedTuple, Sequence, Union
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
# Example functions for blending the top K colors per pixel using the outputs # Example functions for blending the top K colors per pixel using the outputs

View File

@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree. # LICENSE file in the root directory of this source tree.
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
# Example functions for blending the top K features per pixel using the outputs # Example functions for blending the top K features per pixel using the outputs

View File

@ -9,7 +9,7 @@ from typing import List, Optional, Tuple, Union
import numpy as np import numpy as np
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from .clip import ( from .clip import (
ClipFrustum, ClipFrustum,

View File

@ -16,7 +16,7 @@ import warnings
from typing import Optional, Tuple, Union from typing import Optional, Tuple, Union
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from pytorch3d.transforms import axis_angle_to_matrix, rotation_6d_to_matrix from pytorch3d.transforms import axis_angle_to_matrix, rotation_6d_to_matrix

View File

@ -8,7 +8,7 @@ from typing import List, Optional, Tuple, Union
import numpy as np import numpy as np
import torch import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`. from pytorch3d import _C
from pytorch3d.renderer.mesh.rasterize_meshes import pix_to_non_square_ndc from pytorch3d.renderer.mesh.rasterize_meshes import pix_to_non_square_ndc