Skip to content

Commit

Permalink
Edges: avoid copies
Browse files Browse the repository at this point in the history
  • Loading branch information
nkemnitz committed Sep 3, 2023
1 parent 68bb4ca commit 82b0e9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pychunkedgraph/graph/edges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ def __init__(
areas: Optional[np.ndarray] = None,
fake_edges=False,
):
self.node_ids1 = np.array(node_ids1, dtype=basetypes.NODE_ID)
self.node_ids2 = np.array(node_ids2, dtype=basetypes.NODE_ID)
self.node_ids1 = np.array(node_ids1, dtype=basetypes.NODE_ID, copy=False)
self.node_ids2 = np.array(node_ids2, dtype=basetypes.NODE_ID, copy=False)
assert self.node_ids1.size == self.node_ids2.size

self._as_pairs = None
self._fake_edges = fake_edges

if affinities is not None and len(affinities) > 0:
self._affinities = np.array(affinities, dtype=basetypes.EDGE_AFFINITY)
self._affinities = np.array(affinities, dtype=basetypes.EDGE_AFFINITY, copy=False)
assert self.node_ids1.size == self._affinities.size
else:
self._affinities = np.full(len(self.node_ids1), DEFAULT_AFFINITY)

if areas is not None and len(areas) > 0:
self._areas = np.array(areas, dtype=basetypes.EDGE_AREA)
self._areas = np.array(areas, dtype=basetypes.EDGE_AREA, copy=False)
assert self.node_ids1.size == self._areas.size
else:
self._areas = np.full(len(self.node_ids1), DEFAULT_AREA)
Expand Down

0 comments on commit 82b0e9c

Please sign in to comment.