TarrySingh / Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials

A comprehensive list of Deep Learning / Artificial Intelligence and Machine Learning tutorials - rapidly expanding into areas of AI/Deep Learning / Machine Vision / NLP and industry specific areas such as Climate / Energy, Automotives, Retail, Pharma, Medicine, Healthcare, Policy, Ethics and more.
https://deepkapha.ai
Other
3.72k stars 1.62k forks source link

Performance issues in Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials #192

Open DLPerf opened 3 years ago

DLPerf commented 3 years ago

Hello! I've found two types of performance issues in your program:

You can make your program more efficient by fixing the above two problems. Here are the tensorflow document and the Stack Overflow post to support this.

Below are detailed issues about batch() should be called before map():

Besides, you need to check the function called in map()(e.g., _parse_line called in dataset = dataset.map(_parse_line)) whether to be affected or not to make the changed code work properly. For example, if _parse_line needs data with shape (x, y, z) as its input before fix, it would require data with shape (batch_size, x, y, z).

Below are detailed issues about tf.Session being defined repeatedly:

If you define tf.Session out of the loop and pass tf.Session as a parameter to the loop, your program would be much more efficient.

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

DLPerf commented 2 years ago

Hello, I'm looking forward to your reply~