I have a matrix that is size ([4, 3, 50, 50, 50]). I’m looking for a way to take each 4 by 3 element and take the inverse of the first 3 channels matrix multiplied by the last channel. I came up with a solution that uses a lot of unbind operations. It uses
z_ls =  for z in torch.unbind(sum_conv, -1): y_ls =  for y in torch.unbind(z, -1): x_ls =  for x in torch.unbind(y,-1): res = torch.inverse(x[:-1,...]).mm(-x[-1,...][...,None])#This should be right x_ls.append(res) x_ls = torch.cat(x_ls, -1) y_ls.append(x_ls) y_ls = torch.stack(y_ls, -1)[...,None] z_ls.append(y_ls) z_ls = torch.cat(z_ls, -1)
I’m wondering if there is a better way to go about this. Is there a way I can perform some sort of convolution operation and then just modify it so I perform other operations instead of normal matrix multiplication?