From 3c83e80c7a22817c49ad39da07e061f25dd3ac70 Mon Sep 17 00:00:00 2001 From: epapoutsellis Date: Thu, 11 Apr 2019 16:58:40 +0100 Subject: fix is compatible for nested Block --- Wrappers/Python/ccpi/framework/BlockDataContainer.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Wrappers/Python/ccpi/framework/BlockDataContainer.py b/Wrappers/Python/ccpi/framework/BlockDataContainer.py index 8934f49..9bec1fe 100755 --- a/Wrappers/Python/ccpi/framework/BlockDataContainer.py +++ b/Wrappers/Python/ccpi/framework/BlockDataContainer.py @@ -70,8 +70,17 @@ class BlockDataContainer(object): return len(self.containers) == len(other) elif isinstance(other, numpy.ndarray): return len(self.containers) == len(other) + elif issubclass(other.__class__, DataContainer): - return self.get_item(0).shape == other.shape + ret = True + for i, el in enumerate(self.containers): + if isinstance(el, BlockDataContainer): + a = el.is_compatible(other) + else: + a = el.shape == other.shape + ret = ret and a + return ret + return len(self.containers) == len(other.containers) def get_item(self, row): @@ -344,7 +353,7 @@ class BlockDataContainer(object): if __name__ == '__main__': M, N, K = 2,3,5 - from ccpi.framework import ImageGeometry, BlockGeometry, BlockDataContainer + from ccpi.framework import ImageGeometry, BlockGeometry ig = ImageGeometry(N, M) u = ig.allocate('random_int') -- cgit v1.2.3