summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepapoutsellis <epapoutsellis@gmail.com>2019-04-11 16:58:40 +0100
committerepapoutsellis <epapoutsellis@gmail.com>2019-04-11 16:58:40 +0100
commit3c83e80c7a22817c49ad39da07e061f25dd3ac70 (patch)
treec719bfd449afce11d2ac7338644364d87254904f
parent41b536a3f2a33d5e527d8b7ada63b47b1abbbca8 (diff)
downloadframework-3c83e80c7a22817c49ad39da07e061f25dd3ac70.tar.gz
framework-3c83e80c7a22817c49ad39da07e061f25dd3ac70.tar.bz2
framework-3c83e80c7a22817c49ad39da07e061f25dd3ac70.tar.xz
framework-3c83e80c7a22817c49ad39da07e061f25dd3ac70.zip
fix is compatible for nested Block
-rwxr-xr-xWrappers/Python/ccpi/framework/BlockDataContainer.py13
1 files 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')