Skip to content

Commit 5494898

Browse files
Update with min and with_max to handle change from ragged to fixed
1 parent b329001 commit 5494898

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

merlin/dtypes/shape.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,16 @@ def with_dim(self, index, value):
187187
return replace(self, dims=tuple(new_dims))
188188

189189
def with_dim_min(self, index, value):
190-
return self.with_dim(index, self.dims[index].with_min(value))
190+
new_dim = self.dims[index].with_min(value)
191+
if new_dim.is_uniform:
192+
new_dim = Dimension(value)
193+
return self.with_dim(index, new_dim)
191194

192195
def with_dim_max(self, index, value):
193-
return self.with_dim(index, self.dims[index].with_max(value))
196+
new_dim = self.dims[index].with_max(value)
197+
if new_dim.is_uniform:
198+
new_dim = Dimension(value)
199+
return self.with_dim(index, new_dim)
194200

195201
@property
196202
def min(self) -> Tuple:

0 commit comments

Comments
 (0)