我有一个名为“LoadDataClassForImageClassification”的函数,我不希望用户一次又一次地输入它......我试过了
def LoadDataClassForImageClassification():
print('Loading...')
## ML THINGS
x = LoadDataClassForImageClassification()
x()
Run Code Online (Sandbox Code Playgroud) 我是 Pytorch 的初学者,想将这个语句作为一个整体输入 if else 语句:-
torch.device('cuda' if torch.cuda.is_available() else 'cpu')
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我吗?
python ×2
function ×1
gpu ×1
if-statement ×1
python-2.7 ×1
python-3.x ×1
pytorch ×1
variables ×1