Skip to content

Conversation

robin-p-schmitt
Copy link
Contributor

@robin-p-schmitt robin-p-schmitt commented Oct 11, 2025

Right now, CombinedDataset always returns an array of size (0,). With this fix, it returns an array of size (0, dim) instead, where dim is the expected dimension of the data key.

Fix #1772

Comment on lines +1351 to +1355
data_dim = self.data_dims[data_key]
if data_dim[1] == 1:
# sparse data
return numpy.zeros((0,), dtype=self.data_dtypes[data_key])
return numpy.zeros((0, data_dim[0]), dtype=self.data_dtypes[data_key])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data_dim = self.data_dims[data_key]
if data_dim[1] == 1:
# sparse data
return numpy.zeros((0,), dtype=self.data_dtypes[data_key])
return numpy.zeros((0, data_dim[0]), dtype=self.data_dtypes[data_key])
shape: List[Union[None, int]] = [0] * self.num_outputs[data_key][1]
if shape and not self.is_data_sparse(data_key):
shape[-1] = self.get_data_dim(data_key)
return numpy.zeros(shape, dtype=self.data_dtypes[data_key])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with CombinedDataset: serialization and invalid shape

3 participants