fix(pnnx): widen bool MemoryData attributes to fp32 in .bin (#6855) - #6956
Open
ktz03 wants to merge 1 commit into
Open
fix(pnnx): widen bool MemoryData attributes to fp32 in .bin (#6855)#6956ktz03 wants to merge 1 commit into
ktz03 wants to merge 1 commit into
Conversation
…6855) pnnx wrote bool constants as 1 byte/element while MemoryData::load_model reads float32, desynchronising every subsequent weight. Mirror the int64->int32 widening path by emitting 0.f/1.f per bool element.
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.
Summary
pnnxwrote bool constants as 1 byte/element inmodel.ncnn.bin.MemoryData::load_model()always reads float32, so the bin cursor drifts and every later weight loads shifted data.0.f/1.fon write, mirroring the existing int64→int32 path insave_ncnn.cpp.Test plan
register_buffer(..., dtype=torch.bool))load_param/load_modelsucceed and output matches torch referenceFixes #6855