Performance issues in your project (by P3)
DLPerf opened this issue · comments
Hello! I've found a performance issue in /tf_encrypted and /examples: batch()
should be called before map()
, which could make your program more efficient. Here is the tensorflow document to support it.
Detailed description is listed below:
- tf_encrypted/protocol/aby3/aby3.py:
.batch(batch_size=batch_size)
(here) should be called before.map(decode)
(here). - examples/securenn/conv_convert.py:
.batch(batch_size)
(here) should be called before.map(decoder)
(here) and.map(normalize)
(here). - examples/federated-learning/run.py:
dataset = dataset.batch(50)
(here) should be called beforedataset = dataset.map(decode)
(here) anddataset = dataset.map(normalize)
(here). - examples/federated-learning/run.py:
dataset = dataset.batch(self.BATCH_SIZE)
(here) should be called beforedataset = dataset.map(decode)
(here) anddataset = dataset.map(normalize)
(here). - examples/federated-learning/convert.py:
.batch(batch_size)
(here) should be called before.map(decode)
(here) and.map(normalize)
(here). - examples/mnist/run.py:
dataset = dataset.batch(self.BATCH_SIZE)
(here) should be called beforedataset = dataset.map(decode)
(here),dataset = dataset.map(normalize)
(here) anddataset = dataset.map(flatten)
(here). - examples/mnist/run.py:
dataset = dataset.batch(self.BATCH_SIZE)
(here) should be called beforedataset = dataset.map(decode)
(here) anddataset = dataset.map(normalize)
(here). - examples/mnist/convert.py:
.batch(batch_size)
(here) should be called before.map(decode)
(here) and.map(normalize)
(here). - examples/notebooks/keras-training/common.py:
.batch(self.batch_size)
(here) should be called before.map(norm)
(here). - examples/notebooks/keras-training/common.py:
.batch(self.test_set_size)
(here) should be called before.map(norm)
(here). - examples/logistic/common.py:
.batch(self.batch_size)
(here) should be called before.map(norm)
(here). - examples/logistic/common.py:
.batch(self.test_set_size)
(here) should be called before.map(norm)
(here). - examples/logistic/data.py:
.batch(batch_size)
(here) should be called before.map(norm)
(here). - examples/logistic/data.py:
.batch(batch_size)
(here) should be called before.map(norm)
(here).
Besides, you need to check the function called in map()
(e.g., norm
called in map()
) whether to be affected or not to make the changed code work properly. For example, if norm
needs data with shape (x, y, z) as its input before fix, it would require data with shape (batch_size, x, y, z).
Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.
@DLPerf Thanks for the suggestion. These indeed make sense. Please create the PR if you can. We will test it, and merge if it boosts the performance.
I will close this issue for now.