Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added explicit casting of input in predict pipeline. #1281

Merged
merged 4 commits into from
Jul 16, 2023

Conversation

BloodAxe
Copy link
Collaborator

This is necessary if for some reason the input's preprocessing pipeline does not have normalization, so input stays in uint8 format.
Example:
Input image has [0..255] range for uint8 dtype
Validation dataset do not have normalization/standardization.
torch_inputs in this case would have torch.uint8 dtype and that would crash

Solution: Take the model's dtype of first parameter (That is likely to be the first layer taking the input) and cast input's dtype to this type.

Fixes: #1269

This is necessary if for some reason the input's preprocessing pipeline does not have normalization, so input stays in uint8 format.
This is necessary if for some reason the input's preprocessing pipeline does not have normalization, so input stays in uint8 format.
Copy link
Collaborator

@shaydeci shaydeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shaydeci shaydeci merged commit a5aa4ba into master Jul 16, 2023
6 checks passed
@shaydeci shaydeci deleted the feature/SG-000-fix-dtype branch July 16, 2023 12:24
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.

RuntimeError: Input type (unsigned char) and bias type (struct c10::Half) should be the same
2 participants