shlogg · Early preview
Super Kai (Kazuya Ito) @superkai_kazuya

Masked_select() In PyTorch: Selecting Elements With Masks

masked_select() gets elements from tensor with masks. It's used with torch or a tensor, taking input and mask as arguments. Example: `torch.masked_select(input=my_tensor, mask=torch.tensor([True, True, False]))` returns selected elements.

Buy Me a Coffee☕
*Memos:

My post explains select().
My post explains index_select().

masked_select() can get the 1D tensor of the zero or more elements selected with zero or more masks from the 0D or more D tensor of zero or more elements as shown below:
*Memos:regularization

masked_select() can be used with torch or a tensor.
The 1st argument(input) with torch or using a tensor(Required-Type:tensor of int, float, complex or bool). *It must be the 0D or more D tensor of zero or more elements.
The 2nd argument with torch or the 1st argument with a tensor is mask(Required-Type:tensor of bool...