Skip to content

Commit 98c0d63

Browse files
hawkinspcopybara-github
authored andcommitted
[NumPy] Remove references to deprecated NumPy type aliases.
This change replaces references to a number of deprecated NumPy type aliases (np.bool, np.int, np.float, np.complex, np.object, np.str) with their recommended replacement (bool, int, float, complex, object, str). NumPy 1.24 drops the deprecated aliases, so we must remove uses before updating NumPy. PiperOrigin-RevId: 497174980
1 parent 89a50fa commit 98c0d63

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tensorflow_graphics/projects/local_implicit_grid/core/evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def eval_grid(self, grid):
311311
"""
312312
# initialize output feature grid
313313
ogrid = np.zeros([self.ijk.shape[0], self.codelen])
314-
niters = np.ceil(self.ijk.shape[0] / self.grid_batch).astype(np.int)
314+
niters = np.ceil(self.ijk.shape[0] / self.grid_batch).astype(int)
315315
for idx in range(niters):
316316
sid = idx * self.grid_batch
317317
eid = min(sid + self.grid_batch, self.ijk.shape[0])
@@ -580,7 +580,7 @@ def evaluate_feature_grid(self, feature_grid, mask, res_per_part=4,
580580
output_grid = np.ones([res_per_part*s[0],
581581
res_per_part*s[1],
582582
res_per_part*s[2]], dtype=np.float32).reshape(-1)
583-
mask = mask.astype(np.bool)
583+
mask = mask.astype(bool)
584584
if self.overlap:
585585
mask = np.stack([mask[:-1, :-1, :-1],
586586
mask[:-1, :-1, 1:],

tensorflow_graphics/projects/local_implicit_grid/core/point_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def np_shifted_crop(v, idx_grid, shift, crop_size, ntarget):
9191
vall = v.copy()
9292
point_idxs = np.arange(v.shape[0])
9393
point_grid_idx = np.floor(vxyz / crop_size).astype(np.int32)
94-
valid_mask = np.ones(point_grid_idx.shape[0]).astype(np.bool)
94+
valid_mask = np.ones(point_grid_idx.shape[0]).astype(bool)
9595
for i in range(3):
9696
valid_mask = np.logical_and(valid_mask, point_grid_idx[:, i] >= 0)
9797
valid_mask = np.logical_and(valid_mask,

tensorflow_graphics/projects/local_implicit_grid/core/reconstruction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def feature_grid(self):
241241

242242

243243
def occupancy_sparse_to_dense(occ_idx, grid_shape):
244-
dense = np.zeros(grid_shape, dtype=np.bool).ravel()
244+
dense = np.zeros(grid_shape, dtype=bool).ravel()
245245
occ_idx_f = (occ_idx[:, 0] * grid_shape[1] * grid_shape[2] +
246246
occ_idx[:, 1] * grid_shape[2] + occ_idx[:, 2])
247247
dense[occ_idx_f] = True

0 commit comments

Comments
 (0)