From 9755810a3d4f6a23cbc563902144056ff4a78d1c Mon Sep 17 00:00:00 2001 From: Yakup Budanaz Date: Sat, 21 Dec 2024 15:48:53 +0100 Subject: [PATCH] Rm getters, move funcitonality to set shape only --- dace/data.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/dace/data.py b/dace/data.py index 1d62c45f0b..4082b97fd4 100644 --- a/dace/data.py +++ b/dace/data.py @@ -354,13 +354,6 @@ def add(X: dace.float32[10, 10] @ dace.StorageType.GPU_Global): new_desc.storage = storage return new_desc - @property - def shape(self): - return self._shape - - @shape.setter - def shape(self, value): - self._shape = value def _arrays_to_json(arrays): if arrays is None: @@ -1590,7 +1583,7 @@ def used_symbols(self, all_symbols: bool) -> Set[symbolic.SymbolicType]: def free_symbols(self): return self.used_symbols(all_symbols=True) - def _set_shape_dependent_properties(self, shape, strides, total_size, offset, sdfg): + def _set_shape_dependent_properties(self, shape, strides, total_size, offset, sdfg=None): """ Used to set properties which depend on the shape of the array either to their default value, which depends on the shape, or @@ -1616,8 +1609,7 @@ def _set_shape_dependent_properties(self, shape, strides, total_size, offset, sd self.offset = [0] * len(shape) if self.is_deferred_array and sdfg is not None: - size_desc = sdfg.arrays[self.size_desc_name] - size_desc.shape = (len(shape), ) + sdfg.arrays[self.size_desc_name].set_shape(new_shape=(len(shape),)) def set_shape( self, @@ -1631,18 +1623,15 @@ def set_shape( Updates the shape of an array. """ self.shape = new_shape - self._set_shape_dependent_properties(new_shape, strides, total_size, offset, sdfg) + self._set_shape_dependent_properties( + shape=new_shape, + strides=strides, + total_size=total_size, + offset=offset, + sdfg=sdfg + ) self.validate() - @property - def shape(self): - return self._shape - - @shape.setter - def shape(self, value): - self._shape = value - - @make_properties class Stream(Data):