How long would this script take to finish its execution without the bottleneck call?
Make sure it’s finishing in a reasonable time, e.g. just use some iterations instead of a lot of epochs.
Could this be an issue for your use case?