File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed 
tutorials/01-basics/feedforward_neural_network Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ def forward(self, x):
5757for  epoch  in  range (num_epochs ):
5858    for  i , (images , labels ) in  enumerate (train_loader ):  
5959        # Convert torch tensor to Variable 
60-         images  =  Variable (images .view (- 1 , 28 * 28 )) .cuda ()
61-         labels  =  Variable (labels ) .cuda ()
60+         images  =  Variable (images .view (- 1 , 28 * 28 ).cuda () )
61+         labels  =  Variable (labels .cuda () )
6262
6363        # Forward + Backward + Optimize 
6464        optimizer .zero_grad ()  # zero the gradient buffer 
@@ -84,4 +84,4 @@ def forward(self, x):
8484print ('Accuracy of the network on the 10000 test images: %d %%'  %  (100  *  correct  /  total ))
8585
8686# Save the Model 
87- torch .save (net .state_dict (), 'model.pkl' )
87+ torch .save (net .state_dict (), 'model.pkl' )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments