Skip to content

Conversation

@adamya-singh
Copy link

Description:
This PR fixes a PyTorch warning in evaluate_gat_model about slow tensor conversion from a list of NumPy arrays by using np.array(y_prob_all) before torch.tensor(), improving performance and eliminating the warning.

Changes:

  • Added import numpy as np to models/gat_model.py.
  • Updated evaluate_gat_model return to torch.tensor(np.array(y_prob_all)).
  • Added a comment documenting the optimization.

Impact:

  • Reduced conversion time from 0.0057s to 0.0005s (10.94x speedup, averaged over 5 runs).
  • Enhances scalability for larger datasets.

Verification:

  • Outputs match the original implementation.
  • Warning no longer appears.

Notes:

  • Uses existing numpy dependency; no new requirements added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant