Skip to content

Check kernel linear transform slot sizes per ciphertext. - #3424

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_987674972
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_987674972

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Check kernel linear transform slot sizes per ciphertext.

kernel.linear_transform is elementwise over its input: each ciphertext
of a tensor<Kx!ct> is transformed independently with the same diagonals.
The verifier instead compared the diagonals against K * slots, and it
skipped the check for a scalar ciphertext, so the check disappeared after
elementwise-to-affine.

  • Compare diagonal width against a single ciphertext's slot count for both
    scalar and tensor-of-ciphertext inputs; cleartext inputs are unchanged.
  • Share the logic with kernel.apply_linear_transform through
    getInputSlotSize.
  • Reject dynamic dimensions in general

`kernel.linear_transform` is elementwise over its `input`: each ciphertext
of a `tensor<Kx!ct>` is transformed independently with the same diagonals.
The verifier instead compared the diagonals against `K * slots`, and it
skipped the check for a scalar ciphertext, so the check disappeared after
elementwise-to-affine.

* Compare diagonal width against a single ciphertext's slot count for both
  scalar and tensor-of-ciphertext inputs; cleartext inputs are unchanged.
* Share the logic with `kernel.apply_linear_transform` through
  `getInputSlotSize`.
* Reject dynamic dimensions in general

PiperOrigin-RevId: 987674972
@j2kun

j2kun commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

This is a minor cleanup rebased over #3423 (so maybe diff against that branch to see the proper diff, sorry!)

This branch has not been deployed

No deployments
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