Skip to content

Fix indexing in data sampling for training labels#2068

Open
Konat23 wants to merge 1 commit intolululxvi:masterfrom
Konat23:patch-2
Open

Fix indexing in data sampling for training labels#2068
Konat23 wants to merge 1 commit intolululxvi:masterfrom
Konat23:patch-2

Conversation

@Konat23
Copy link
Copy Markdown

@Konat23 Konat23 commented Mar 21, 2026

Hi,

I noticed an issue in TripleCartesianProd.train_next_batch when using tuple batch_size (i.e., separate batch sizes for branch and trunk inputs).

Currently, the code uses:

self.train_y[indices_branch, indices_trunk]

However, this performs NumPy advanced indexing over paired indices instead of selecting the Cartesian product. As a result, it returns a 1D array of shape (batch_size,) instead of the expected 2D submatrix (len(indices_branch), len(indices_trunk)).

Since TripleCartesianProd represents data in Cartesian product form (y_train with shape (N1, N2)), the batch selection should also preserve this structur

Why this matters

This affects training when using:
batch_size = (branch_batch_size, trunk_batch_size)

and may lead to:

  • incorrect target shapes,
  • silent broadcasting issues,
  • or mismatches between model outputs and labels.

@echen5503
Copy link
Copy Markdown
Contributor

Can you provide code that demonstrates this issue?

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.

2 participants