imgclsmob icon indicating copy to clipboard operation
imgclsmob copied to clipboard

Performance issues in your project (by P3)

Open DLPerf opened this issue 4 years ago • 1 comments

Hello! I've found a performance issue in your project:

  • tf.Session being defined repeatedly leads to incremental overhead.

You can make your program more efficient by fixing this bug. Here is the Stack Overflow post to support it.

Below is detailed description about tf.Session being defined repeatedly:

  • tensorflow_/tensorflowcv/models/resnext.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/shufflenetv2b.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/zfnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/igcv3.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/densenet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/squeezenet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/mobilenet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/menet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/darknet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/seresnext.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/seresnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/mobilenetv2.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/sepreresnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/resnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/shufflenetv2.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/vgg.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/preresnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/channelnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/darknet53.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/shufflenet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/senet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/alexnet.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tensorflow_/tensorflowcv/models/squeezenext.py: with tf.Session() as sess(here) is repeatedly called in the loop for model in models(here).
  • tests/convert_gl2tf_batchnorm.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_conv1x1.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_maxpool2d.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_gconv2d.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_conv2d.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_avgpool2d.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_dwconv2d.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).
  • tests/convert_gl2tf_dense.py: with tf.Session() as sess(here) is repeatedly called in the loop for i in range(10)(here).

tf.Session being defined repeatedly could lead to incremental overhead. 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 avatar Aug 25 '21 06:08 DLPerf

Thanks, but this is not necessary. It's all the test and seldom-used parts of the code.

osmr avatar Aug 25 '21 10:08 osmr