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.
Tensor of bool type in pytorch as index
Guess you like
Origin blog.csdn.net/mch2869253130/article/details/118088278
Recommended
Ranking