File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 29
29
test_loader = DataLoader (test_dataset , batch_size = batch_size , shuffle = False )
30
30
31
31
# 定义 Logistic Regression 模型
32
- class logsticRegression (nn .Module ):
32
+ class Logistic_Regression (nn .Module ):
33
33
def __init__ (self , in_dim , n_class ):
34
- super (logsticRegression , self ).__init__ ()
35
- self .logstic = nn .Linear (in_dim , n_class )
34
+ super (Logistic_Regression , self ).__init__ ()
35
+ self .logistic = nn .Linear (in_dim , n_class )
36
36
37
37
def forward (self , x ):
38
- out = self .logstic (x )
38
+ out = self .logistic (x )
39
39
return out
40
40
41
- model = logsticRegression (28 * 28 , 10 ) # 图片大小是28x28
41
+
42
+ model = Logistic_Regression (28 * 28 , 10 ) # 图片大小是28x28
42
43
use_gpu = torch .cuda .is_available () # 判断是否有GPU加速
43
44
if use_gpu :
44
45
model = model .cuda ()
You can’t perform that action at this time.
0 commit comments