Open louhz opened 8 months ago
Hi ,can you send the latest version of this code? Thank you very much.
So the code below are the change I made:
mesh_pool.py: line 35 change to :mask = np.ones(mesh.edges_count, dtype=bool)
mesh.py:line 91-95
self.vei = torch.from_numpy(np.concatenate(np.array(self.vei, dtype=object)).ravel()).to(self.device).long()
self.nvsi = torch.Tensor(np.concatenate(np.array(self.nvsi, dtype=object)).ravel()).to(self.device).long()
self.nvsin = torch.from_numpy(np.concatenate(np.array(self.nvsin, dtype=object)).ravel()).to(self.device).long()
ve_in = copy.deepcopy(self.ve)
self.ve_in = torch.from_numpy(np.concatenate(np.array(ve_in, dtype=object)).ravel()).to(self.device).long()
Now maybe you should also change some other lines in mesh.py to make sure all tensors and their indexes are on the same devices.
Here is what I do to make sure all tensors and their indexes are on the same device.
add after mesh.py line 27
self.v_mask = np.ones(len(self.vs), dtype=bool)
self.v_mask = torch.from_numpy(self.v_mask).to(self.device)
replace mesh.py line 368 with:
# face = self.sub_mesh_index[i][face].to(face.device).long()
face = face.to(self.sub_mesh_index[i].device).long()
face = self.sub_mesh_index[i][face]
Hi, I just update this code to pytorch 2.0 and numpy 1.24 by replace the np.bool to bool, adding device consistency for pytorch and also fix the dtype of inhomogeneous array of vei to object.
I test it and the result looks good so if anyone need help for the latest version of this code I can send a pull request