Tensor of bool type in pytorch as index

The bool type in pytorch can be used as an index, and also supports operations such as sum.
When indexing, it is equivalent to taking out the elements at positions such as True and forming a new tensor.
Insert image description here

Guess you like

Origin blog.csdn.net/mch2869253130/article/details/118088278