Optimised code for compute_blob_loss_multi and style change in compute_compound_loss #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Changed:
Mostly associated with batch processing and vectorisation. The unit test notebook has the code commented well highlighting the changes.
Sanity Checks (Turn on GPU on colab other wise it throws an error):
Unit Test for the function Change: https://colab.research.google.com/drive/1RWlZ2xGq_5AAhvt-nO02Bqbg3fjetH2r?usp=sharing
Comparing Speed in 3d: https://colab.research.google.com/drive/18WRo84ONO06FkRQX5PSSuBzg0RlVqAPL?usp=sharing
Comparing Speed in 2d: https://colab.research.google.com/drive/1-I-2X_29Hula7UfCIgAGSJnOV_IpVqEP?usp=sharing
Just
run all
in each notebook.TLDR Improvements:
In 2D:
Main Improvement comes from larger batches and images sizes > 32
For smaller batches, and size upto 32 or so, there isnt improvement.
In 3D:
Generally 1.8x - 2.2x Faster (considering a batch size of 2; I imagine bigger batches will lead to more improvement)
Do let me know if there are more tests which need to be run of if something is faulty.