Hi all,
I have a 64x10x3x32x32 tensor g where the first coordinate is the batch_size. For every 10x3x32x32 subtensor I would like to compute the 2-norm and then sum them up. One way do it is like this
    sum_2_normes = torch.zeros(1)
    ......
    for i in range(batch_size):
        sum_2_normes += g[i].norm(p=2)

I was wondering if there is a way to do it in one line and/or more efficiently. I tried torch.norm(g, p=2, dim=0) but, as expected according to the documentation I get a 10x3x32x32 tensor, instead of what I need which is a 64x1 tensor