DP and DDP returned nan

when i use DP or DDP, my code show error “RuntimeError: Function ‘BmmBackward0’ returned nan values in its 0th output.”, but when single GPU, no error.