A simple problem for which Julia is a better choice than Python
import torch
x = torch.randn(4000, 4000, device='cuda:0')
y = torch.randn(4000, 4000, device='cuda:0')
z = torch.einsum('ij,jk->ijk', x, y).relu().sum(dim=1)
we will likely run out of memory, because the tensor product of x and y consists of 4000 x 4000 x 4000 = 64 billion floating-point values, and we must evaluate the relu() function on each of them before summing them over index j (dim 1).And we can't solve this problem with a nice for-loop that iterates over 64 billion elements in Python -- it would be waaaaay too slow. Python and PyTorch force us to drop down to a fast, low-level, compiled language.
The same is true for TensorFlow and other similar "vectorized" frameworks. Our choices are to store 64 billion floating-point values simultaneously in memory, or drop down to a low-level language. No fun.
But solving this in Julia is trivial: We just write the loops.