diff --git a/models/layers/mesh_pool.py b/models/layers/mesh_pool.py index 394d0fc9..ac3fafd1 100644 --- a/models/layers/mesh_pool.py +++ b/models/layers/mesh_pool.py @@ -44,7 +44,7 @@ def __pool_main(self, mesh_index): # recycle = [] # last_queue_len = len(queue) last_count = mesh.edges_count + 1 - mask = np.ones(mesh.edges_count, dtype=np.bool) + mask = np.ones(mesh.edges_count, dtype=bool) edge_groups = MeshUnion(mesh.edges_count, self.__fe.device) while mesh.edges_count > self.__out_target: value, edge_id = heappop(queue) diff --git a/models/layers/mesh_prepare.py b/models/layers/mesh_prepare.py index 47e827c7..b4d8cf6f 100644 --- a/models/layers/mesh_prepare.py +++ b/models/layers/mesh_prepare.py @@ -9,11 +9,13 @@ def fill_mesh(mesh2fill, file: str, opt): mesh_data = np.load(load_path, encoding='latin1', allow_pickle=True) else: mesh_data = from_scratch(file, opt) + np.savez_compressed(load_path, gemm_edges=mesh_data.gemm_edges, vs=mesh_data.vs, edges=mesh_data.edges, - edges_count=mesh_data.edges_count, ve=mesh_data.ve, v_mask=mesh_data.v_mask, + edges_count=mesh_data.edges_count, ve=np.array(mesh_data.ve, dtype=object), v_mask=mesh_data.v_mask, filename=mesh_data.filename, sides=mesh_data.sides, edge_lengths=mesh_data.edge_lengths, edge_areas=mesh_data.edge_areas, features=mesh_data.features) + mesh2fill.vs = mesh_data['vs'] mesh2fill.edges = mesh_data['edges'] mesh2fill.gemm_edges = mesh_data['gemm_edges'] diff --git a/util/mesh_viewer.py b/util/mesh_viewer.py index c7214fb8..1edd3b72 100644 --- a/util/mesh_viewer.py +++ b/util/mesh_viewer.py @@ -17,13 +17,13 @@ def init_plot(): ax = pl.figure().add_subplot(111, projection='3d') # hide axis, thank to # https://stackoverflow.com/questions/29041326/3d-plot-with-matplotlib-hide-axes-but-keep-axis-labels/ - ax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) - ax.w_yaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) - ax.w_zaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) + ax.xaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) + ax.yaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) + ax.zaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) # Get rid of the spines - ax.w_xaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) - ax.w_yaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) - ax.w_zaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) + ax.xaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) + ax.yaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) + ax.zaxis.line.set_color((1.0, 1.0, 1.0, 0.0)) # Get rid of the ticks ax.set_xticks([]) ax.set_yticks([]) diff --git a/util/util.py b/util/util.py index 2e5c9cc0..b559b89a 100644 --- a/util/util.py +++ b/util/util.py @@ -135,6 +135,6 @@ def myindexrowselect(groups, mask_index, device): #Create new tensor groups = torch.sparse_coo_tensor(indices=allNewIndices, values=torch.ones(allNewIndices.shape[1], dtype=torch.float), - size=(len(mask_index), groups.shape[1])) + size=(len(mask_index), groups.shape[1]), device=device) return groups