I usually recommend broadcasting for outer products. Here you can combine with advanced indexing (.long() makes it an index instead of a mask):
# seq x batch
a = torch.tensor([[-100.,33,99],[39,9,-10000],[1,3,4],[0,0,0]])

magical_number=torch.tensor([[0.5,(0.75)**(0.5)],[1,0]]) # np.power(-1+0j,1/3), 1 ; keep out of function if you want precomputed..
mean_tensor = a.pow(3).mean(0)
magical_number[(mean_tensor>0).long()]*mean_tensor.abs().pow(1/3)[:,None]

It still is much slower than numpy, but it might not be too the overall bottleneck.
Best regards
Thomas
P.S.: Pro tip: Don’t do torch.tensor(...).float() or .cuda() or so, but always use torch.tensor(..., dtype=torch.float, device=...). It’s more efficient and once you add requires_grad, the latter gives you a leaf variable while the former does not.