Pytorch, Optimization, Deep Learning, Artificial Intelligence, Tensorboard.
following three lines were modified from the original # to use PyTorch indexing rather than torch.gather stride = L * torch.unsqueeze(torch.arange(B, device=x.device), 1) keep_indices = (stride + keep_indices).flatten() x = x.reshape(B * L, -1)[keep_indices].view(B, num_keep, -1) x =