Skip to content

Commit

Permalink
Rm getters, move funcitonality to set shape only
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrudPrimrose committed Dec 21, 2024
1 parent b9698fa commit 9755810
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions dace/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit 9755810

Please sign in to comment.