Skip to content

Fix CNN tensor multihot input - #1208

Open
fbonc wants to merge 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-cnn-tensor-multihot-input
Open

Fix CNN tensor multihot input#1208
fbonc wants to merge 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-cnn-tensor-multihot-input

Conversation

@fbonc

@fbonc fbonc commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Issue

CNN’s one-dimensional convolution path expects embedded features shaped [batch, sequence_length, embedding_dim]. Sequence processors produce that shape, but MultiHotProcessor and one-dimensional TensorProcessor inputs produce one embedding per sample, shaped [batch, embedding_dim]. Because the sequence axis is absent, CNN rejects these otherwise-supported inputs as two-dimensional tensors.

Fix

For the Conv1d path, normalize a [batch, embedding_dim] embedding to [batch, 1, embedding_dim] before validating and permuting dimensions. The existing permutation then gives Conv1d its required [batch, embedding_dim, 1] input. Inputs that already contain a sequence dimension are unchanged.

Notes

The regression test runs CNN with both a multi-hot feature and a one-dimensional tensor feature and verifies that forward and backward propagation complete successfully.

fbonc added 2 commits August 26, 2026 23:02
CNN.forward hardcoded a 3-D expectation for spatial_dim=1 features, but
MultiHotProcessor and 1D TensorProcessor inputs embed to [batch,
embedding_dim] with no sequence axis. Treat these as a length-1 sequence.
@fbonc fbonc changed the title Fix cnn tensor multihot input Fix CNN tensor multihot input Aug 27, 2026
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.

1 participant