Skip to content

Commit

Permalink
Remove _C pyre fixmes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
patricklabatut authored and facebook-github-bot committed Jun 23, 2021
1 parent de72049 commit e4039aa
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pytorch3d/loss/mesh_normal_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

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):
Expand Down
1 change: 0 additions & 1 deletion pytorch3d/loss/point_mesh_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# 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.structures import Meshes, Pointclouds
from torch.autograd import Function
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/ops/graph_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import torch
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.function import once_differentiable

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/ops/interp_face_attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

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.function import once_differentiable

Expand Down
4 changes: 2 additions & 2 deletions pytorch3d/ops/knn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Union

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.function import once_differentiable

Expand Down Expand Up @@ -58,7 +58,6 @@ def forward(
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)

# sort KNN in ascending order if K > 1
Expand All @@ -74,6 +73,7 @@ def forward(
dists[mask] = 0
else:
dists, sort_idx = dists.sort(dim=2)
# pyre-fixme[16]: `Tensor` has no attribute `gather`.
idx = idx.gather(2, sort_idx)

ctx.save_for_backward(p1, p2, lengths1, lengths2, idx)
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/ops/mesh_face_areas_normals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

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.function import once_differentiable

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/ops/packed_to_padded.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

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.function import once_differentiable

Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/blending.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import NamedTuple, Sequence, Union

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
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/compositing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

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
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/mesh/rasterize_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import numpy as np
import torch
from pytorch3d import _C # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
from pytorch3d import _C

from .clip import (
ClipFrustum,
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/points/pulsar/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from typing import Optional, Tuple, Union

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


Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/points/rasterize_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np
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


Expand Down

0 comments on commit e4039aa

Please sign in to comment.