Created
December 30, 2020 23:17
-
-
Save franckjay/6c3eba31d389ab5f80105f947c47668c to your computer and use it in GitHub Desktop.
Build a Sparse Tenor
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
indices = torch.LongTensor( | |
train[[user_id_col, item_id_col]].values | |
) | |
values = torch.ones(indices.shape[0]) | |
torch.sparse.FloatTensor(indices.t(), values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment