I ve checked .

cuda_visible_devices works fine, it exclude the other gpu,I confirmed by create tensor on the excluded gpu order number and torch.cuda APIs.
the in-use gpu usage stay unchanged when i run the commented code(comments the residual for loop it runs),and the gpus I exposed, their usage increases from 0 to 5Gb,both two gpu have data flowed in.