Fix process_weights_for_netuid edge case #94
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.
This is a bugfix for #93 (issue provides a detailed description of where and how the bug occurs)
The edge case occurs when there is only a single non-zero weight to be processed, which results in
len
being called on an array scalar. The fix is to reshape said array scaler to make it a sized object.Here is a recreation of the bug and it's fix:
![Screenshot 2024-06-06 at 3 02 27 PM](https://private-user-images.githubusercontent.com/18313059/337452072-8d90c9f2-9c21-4929-99a8-f7fb7fb9b81b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5ODc2ODMsIm5iZiI6MTczODk4NzM4MywicGF0aCI6Ii8xODMxMzA1OS8zMzc0NTIwNzItOGQ5MGM5ZjItOWMyMS00OTI5LTk5YTgtZjdmYjdmYjliODFiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA0MDMwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMyOTAxZGUyNDk5ZDNjNDZjZTg0MTA1MjQ0ODlkMGZmOWE0NDMwNGYxMTVhZjYwZTI1NDU5N2U1ZDNhN2UyZDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JXgUPJ0iAtXCFxreBiLN1jnL9Op4n1Gpr9Jh9QhAwes)