IntelLabs / nlp-architect

A model library for exploring state-of-the-art deep learning topologies and techniques for optimizing Natural Language Processing neural networks
https://intellabs.github.io/nlp-architect
Apache License 2.0
2.94k stars 448 forks source link

Performance issue in the definition of _inference, examples/memn2n_dialogue/memn2n_dialogue.py(P1) #227

Open DLPerf opened 3 years ago

DLPerf commented 3 years ago

Hello, I found a performance issue in the difinition of_inference, examples/memn2n_dialogue/memn2n_dialogue.py, tf.nn.embedding_lookup will be calculated repeately during the program execution, resulting in reduced efficiency. So I think it should be created before the loop.

The same issue exist in tf.reduce_sum in line 187 and 200.

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

DLPerf commented 3 years ago

@danielkorat Hi, my friend, could you consider my issue?

peteriz commented 3 years ago

Hi @DLPerf, thanks for letting us know about the issue. You can open a PR to fix the issue if you wish. Any contribution is welcome.