spcl / ncc

Neural Code Comprehension: A Learnable Representation of Code Semantics
BSD 3-Clause "New" or "Revised" License
206 stars 51 forks source link

Matrix multiplication operator change affects H dictionary creation #51

Closed John-Tenet3 closed 3 months ago

John-Tenet3 commented 4 months ago

https://github.com/spcl/ncc/blob/45c3619ba193585579c7feedbe046bac3ff9e7b5/inst2vec/inst2vec_vocabulary.py#L349

https://github.com/spcl/ncc/blob/45c3619ba193585579c7feedbe046bac3ff9e7b5/inst2vec/inst2vec_vocabulary.py#L354

I'm not completely clear on when the switch over to the array interface in was made, but some years ago there was a change to scipy sparse matrix multiplication such that the * operator performs element-wise multiplication, breaking the code logic here somewhat invisibly. The matmul (@) operator was implemented way back in 0.17.0 so it might be worth switching to that operator to avoid getting caught out, if it's not already affected.

tbennun commented 4 months ago

@John-Tenet3 That sounds right. Feel free to post a pull request that changes it.