From ea18fcb99be6a88d8e883672ed050687498a6140 Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Wed, 6 Jan 2016 16:23:43 -0500 Subject: [PATCH] use as strided --- skimage/future/graph/rag.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skimage/future/graph/rag.py b/skimage/future/graph/rag.py index 4faea16c..dd45f2fc 100644 --- a/skimage/future/graph/rag.py +++ b/skimage/future/graph/rag.py @@ -354,8 +354,8 @@ def rag_boundary(labels, edge_map, connectivity=2): n = np.max(labels_large) + 1 # use a dummy broadcast array as data for RAG - ones = np.broadcast_to(np.ones((1,), dtype=np.int_), - labels_small.shape) + ones = as_strided(np.ones((1,), dtype=np.float), shape=labels_small.shape, + strides=(0,)) count_matrix = sparse.coo_matrix((ones, (labels_small, labels_large)), dtype=np.int_, shape=(n, n)).tocsr() data = np.concatenate((edge_map[boundaries0], edge_map[boundaries1]))