I have a tensor, let’s say
A, which contains zero rows. I mean rows with all zero elements. There are other rows with non-zero elements as well. I there any elegant way to remove all zero’ed rows? To shed a light on the question, suppose the following example.
A= [ [ [0,0,0,0,0], [0,-0.4,0,-0.9,0], [0,-0.7,0.9,0.2,0], [0,0,0,0,0] ] ]
What I want to get (let’s say tensor B) is the following:
B= [ [ [0,-0.4,0,-0.9,0], [0,-0.7,0.9,0.2,0] ] ]