face areas backward

Summary:
Added backward for mesh face areas & normals. Exposed it as a layer. Replaced the computation with the new op in Meshes and in Sample Points.

Current issue: Circular imports. I moved the import of the op in meshes inside the function scope.

Reviewed By: jcjohnson

Differential Revision: D19920082

fbshipit-source-id: d213226d5e1d19a0c8452f4d32771d07e8b91c0a
This commit is contained in:
Georgia Gkioxari
2020-02-20 11:10:04 -08:00
committed by Facebook Github Bot
parent 9ca5489107
commit a3baa367e3
11 changed files with 513 additions and 63 deletions

View File

@@ -4,8 +4,6 @@
from typing import List
import torch
from pytorch3d import _C
from . import utils as struct_utils
from .textures import Textures
@@ -761,6 +759,8 @@ class Meshes(object):
refresh: Set to True to force recomputation of face areas.
Default: False.
"""
from ..ops.mesh_face_areas_normals import mesh_face_areas_normals
if not (
refresh
or any(
@@ -771,7 +771,7 @@ class Meshes(object):
return
faces_packed = self.faces_packed()
verts_packed = self.verts_packed()
face_areas, face_normals = _C.face_areas_normals(
face_areas, face_normals = mesh_face_areas_normals(
verts_packed, faces_packed
)
self._faces_areas_packed = face_areas