mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Avoid plain division involving integers
Summary: To avoid pytorch warnings and future behaviour changes, stop using torch.div and / with tensors of integers. Reviewed By: gkioxari, mruberry Differential Revision: D21857955 fbshipit-source-id: fb9f3000f3d953352cdc721d2a5f73d3a4bbf4b7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
40b068e4bc
commit
5444c53cee
@@ -18,9 +18,9 @@ def unravel_index(idx, dims) -> torch.Tensor:
|
||||
if len(dims) != 4:
|
||||
raise ValueError("Expects a 4-element list.")
|
||||
N, H, W, D = dims
|
||||
n = torch.div(idx, H * W * D)
|
||||
h = torch.div(idx - n * H * W * D, W * D)
|
||||
w = torch.div(idx - n * H * W * D - h * W * D, D)
|
||||
n = idx // (H * W * D)
|
||||
h = (idx - n * H * W * D) // (W * D)
|
||||
w = (idx - n * H * W * D - h * W * D) // D
|
||||
d = idx - n * H * W * D - h * W * D - w * D
|
||||
return torch.stack((n, h, w, d), dim=1)
|
||||
|
||||
|
||||
@@ -1031,7 +1031,7 @@ class Meshes(object):
|
||||
unique_mask[1:] = sorted_hash[1:] != sorted_hash[:-1]
|
||||
unique_idx = sort_idx[unique_mask]
|
||||
|
||||
self._edges_packed = torch.stack([u / V, u % V], dim=1)
|
||||
self._edges_packed = torch.stack([u // V, u % V], dim=1)
|
||||
self._edges_packed_to_mesh_idx = edge_to_mesh[unique_idx]
|
||||
|
||||
face_to_edge = torch.arange(3 * F).view(3, F).t()
|
||||
|
||||
Reference in New Issue
Block a user