We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d40f920 commit 92f7296Copy full SHA for 92f7296
segment_anything_fast/utils/amg.py
@@ -114,7 +114,10 @@ def mask_to_rle_pytorch_2(tensor: torch.Tensor) -> List[Dict[str, Any]]:
114
115
# Compute change indices
116
diff = tensor[:, 1:] ^ tensor[:, :-1]
117
- a = torch.tensor([[True]]).pin_memory().cuda().expand_as(diff.narrow(1, 0, 1))
+ a = torch.tensor([[True]])
118
+ if diff.is_cuda:
119
+ a = a.pin_memory().cuda()
120
+ a = a.expand_as(diff.narrow(1, 0, 1))
121
diff = torch.cat([a, diff, a], dim=1)
122
change_indices = diff.nonzero()
123
0 commit comments