Skip to content

Commit

Permalink
fix: workaround negative strides issue when converting to torch tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
RemyLau committed Oct 17, 2023
1 parent 38899d5 commit a2a944e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/obnb/transform/node_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ class SVD(BaseNodeFeatureTransform):
def _prepare_feat(self, dataset):
sparse_adj = sp.csr_matrix(dataset.get_adj())
feat, _, _ = sp.linalg.svds(sparse_adj, k=self.dim, which="LM")
return feat
# Work around for potential negative strides by making a copy of the array
# https://discuss.pytorch.org/t/negative-strides-in-tensor-error/134287/2
return feat.copy()


@register_nodefeat
Expand Down

0 comments on commit a2a944e

Please sign in to comment.