Thank you @KFrank for taking some time out to answer. I am getting an error while using torch.ger().
Error message:
 RuntimeError: _th_addr_out not supported on CPUType for Bool
Could it be because of pytorch version? I have the latest one installed.
I actually had a naive (or a long) approach to it:
import torch
A = torch.FloatTensor( [ [0,0,0,0], [0,-0.4,0,-0.9], [0,-0.7,0.9,0.2], [0,0,0,0] ] )
idx = []
idx_removed = []
for i in range(4):
    flag = 0
    for j in range(4):
        if A[i,j] != 0:
            flag = 1
    if flag == 1:
        idx.append(i)
    else:
        idx_removed.append(i)

count = len(idx_removed)

A = A[idx,:]
A = A[:,idx]
A

count gives the number of zero_rows and idx gives the rows and columns to keep and idx_removed are indices to be removed. and if you just want number of zero rows then:
count = np.count_nonzero(torch.sum(torch.abs(A),dim = -1)==0)
Sorry for the making it this long as I have switched from C++ to python not very long ago. Your approach is much more time efficient, right? Thanks!