policy_data, value_data, action_mask = policy_data.cuda(non_blocking=True), value_data.cuda(non_blocking=True), action_mask.cuda(non_blocking=True)
rewards, regret_probs = rewards.cuda(non_blocking=True), regret_probs.cuda(non_blocking=True)
return action_probs.cpu(), sample_probs.cpu(), sample_indices.cpu(), update
I am doing some RL work and am wondering whether it would be possible to speed up fragments like the above by launching the data transfer to the GPU on different streams before waiting on them together. Does PyTorch have any functions that would make this easier? I'd rather ask here before I dive into the minutiae of optimizing data transfers.