How can I vectorize the operation where all non zero values in a PyTorch Tensor are copied to the left most position without any gaps?

后端 未结 0 1746
青春惊慌失措
青春惊慌失措 2021-01-23 06:21

I have a PyTorch tensor with 0 and non 0 values, and I want to copy the non zero values in a new tensor such that it is as compact as possible. ie its shape is [num_rows,max([nu

相关标签:
回答
  • 消灭零回复
提交回复
热议问题