preamble
In pytorch, I want to delete the specified rows and columns in the tensor, originally I thought there is a function or directly assign a row to [], but it turns out it's not that simple, so I used a curve-breaking method, I hope if there is a more direct method, please point it out.
code
Essentially the specified line is deleted using mask and then redirected.
a = (4, 2) print(a) idx = 1 a = a[((0))!=1] print(a) """ tensor([[2.7775e-01, 3.7430e-01], [9.0373e-01, 8.1220e-02], [9.8638e-01, 8.6293e-01], [9.8139e-04, 9.8460e-02]]) tensor([[2.7775e-01, 3.7430e-01], [9.8638e-01, 8.6293e-01], [9.8139e-04, 9.8460e-02]]) """
Above this pytorch implementation of deleting the specified rows and columns in the tensor is all I have to share with you, I hope to give you a reference, and I hope you will support me more.