Skip to content

Commit 92e0095

Browse files
committed
perf(util): 辅助函数get_deivce:返回gpu或cpu device
1 parent 523d1e7 commit 92e0095

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/lib/utils/util.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
import torch
1212

1313

14+
def get_device():
15+
return torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
16+
17+
1418
def iou(pred_box, target_box):
1519
"""
1620
计算候选建议和标注边界框的IoU

0 commit comments

Comments
 (0)