[ 仅 API 调用方式不一致 ]torch.cuda.StreamContext
torch.cuda.StreamContext
torch.cuda.StreamContext(stream)
转写示例
# PyTorch 写法
with torch.cuda.StreamContext(stream=s1):
result = a + b
# Paddle 写法
with paddle.device.stream_guard(stream=s1):
result = a + b