Created
October 14, 2024 10:32
-
-
Save sailfish009/518054b476232ae221f13206b0abca6f to your computer and use it in GitHub Desktop.
AttributeError: 'int' object has no attribute 'type'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/open-mmlab/mmdetection/issues/10720 | |
from torch import Tensor | |
from torch.nn.parallel._functions import _get_stream | |
from packaging import version | |
def scatter(input: Union[List, Tensor], | |
devices: List, | |
@@ -72,7 +74,10 @@ def forward(target_gpus: List[int], input: Union[List, Tensor]) -> tuple: | |
streams = None | |
if input_device == -1 and target_gpus != [-1]: | |
# Perform CPU to GPU copies in a background stream | |
streams = [_get_stream(device) for device in target_gpus] | |
if version.parse(torch.__version__) >= version.parse('2.1.0'): | |
streams = [_get_stream(torch.device("cuda", device)) for device in target_gpus] | |
else: | |
streams = [_get_stream(device) for device in target_gpus] | |
outputs = scatter(input, target_gpus, streams) | |
# Synchronize with the copy stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment