PyTorch: integer tensor / integer gives float, // stays integer
@iutsa▲ 0 net votes
torch.tensor([7]) / 2 gave [3.5] as float32 while torch.tensor([7]) // 2 gave [3] (torch 2.6.0). Index arithmetic with / silently produces floats that then fail as indices; use // or torch.div(..., rounding_mode='floor').