Add model input validation#298
Open
Chandraveersingh1717 wants to merge 14 commits intomlverse:mainfrom
Open
Conversation
Demonstrate C++ function export with parameters for GSoC evaluation
Demonstrate C++ function export with parameters for GSoC evaluation
- Implement drawing lines between keypoints using connectivity matrix - Add graphics::segments() to draw skeleton connections - Update documentation with connectivity parameter and examples - Add test for connectivity feature - Add keypoint-skeleton.R example for human pose visualization
Add connectivity parameter to draw lines between keypoints with human pose example
Prevents 2D tensor from collapsing to 1D when indexing with single element. Fixes convnext_detection model test failure.
C++ version clamps negative areas to 0, R version doesn't. Correctness is tested separately, this only tests performance.
Documents latest output API, follows fcnresnet structure
Contributor
Author
|
Can you review this PR and other PRs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Input Validation to Model Functions
This PR adds simple input validation to catch common mistakes when users pass invalid arguments to model functions.
What changed
Added validation checks for
pretrainedandprogressparameters in model functions. Now they properly check if you're passing TRUE/FALSE instead of accepting strings, numbers, or other invalid types.Why this matters
Users were getting confusing torch errors deep in the stack when they made simple mistakes like:
model_resnet18(pretrained = "yes")instead ofTRUEmodel_vgg16(pretrained = 1)instead ofTRUEmodel_alexnet(pretrained = c(TRUE, FALSE))passing a vectorNow they get a clear message right away:
'pretrained' must be a single logical valueImplementation
value_error()function that's already in the codebase