microsoft / tf2-gnn

TensorFlow 2 library implementing Graph Neural Networks
MIT License
371 stars 73 forks source link

Performance issu in the definition of calculate_type_to_num_incoming_edges, tf2_gnn/layers/message_passing/message_passing.py(P1)) #51

Closed DLPerf closed 3 years ago

DLPerf commented 3 years ago

Hello, I found a performance issue in the definition ofcalculate_type_to_num_incoming_edges, tf2_gnn/layers/message_passing/message_passing.py, tf.shape(node_embeddings)[0] will be calculated repeatedly during the program execution, resulting in reduced efficiency. I think it should be created before the loop.

Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.

mmjb commented 3 years ago

This is not a noticable performance issue anyway, and should be taken care of by the TF2 graph compilation.