Skip to content

Conversation

spmex
Copy link

@spmex spmex commented May 12, 2025

Summary:
This diff adds validation logic for lengths and offsets of KeyedJaggedTensor. The changes include:

  • Add a new library jagged_tensor_validator and a new test file test_jagged_tensor_validator.py.
  • The validate_keyed_jagged_tensor function checks that at least one of lengths or offsets is provided and the input are valid.

More validation logic & test cases will be added in follow-up diffs.

Reviewed By: TroyGarden

Differential Revision: D71531326

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71531326

Summary:
This diff adds validation logic for lengths and offsets of `KeyedJaggedTensor`. The changes include:
- Add a new library `jagged_tensor_validator` and a new test file `test_jagged_tensor_validator.py`.
- The `validate_keyed_jagged_tensor` function checks the input lengths and/or offsets are valid in non-VBE case, including:
    - At least one of lengths or offsets is provided
    - If both are provided, they are consistent with each other
    - The dimensions of these tensors align with the values tensor
- Generates test cases using Hypothesis to cover corner cases and ensure valid KJTs can successfully pass the validator.

More validation logic & test cases will be added in follow-up diffs.

Reviewed By: TroyGarden

Differential Revision: D71531326
@spmex spmex force-pushed the export-D71531326 branch from f5202ba to 071b925 Compare May 12, 2025 22:35
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D71531326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants