Speed Up Your Code with Loop Hoisting : Data Science Code

preview_player
Показать описание
How to use loop hoisting to speed up your code!
Рекомендации по теме
Комментарии
Автор

If you want to keep the inefficiency, but solve the correctness issue, you could read from one buffer and write to another, then swap, like double buffer behaviour.

Although I don’t see this as a performance issue at all, because there should not really be a correctness issue to begin with, I like that you pointed it out, as it is a potential trap you could fall for if you are mindlessly programming this thing, or probably mostly with beginners.

roygalaasen
Автор

tic = time()
mean = np.mean(myImg, axis=1, keepdims=True)
std = np.std(myImg, axis=1, keepdims=True)
myImgCopy = (myImg - mean) / (std + 1e-6)
toc = ime()
print('Full Vectorization Time : ', toc-tic)

sungchulyonseiackr
Автор

Thanks, informative video!


Please be sure to turn off auto-focusing of the camera in the future though.

DefconZero
join shbcf.ru