choose device automatically
This commit is contained in:
		
							parent
							
								
									6d7f5d5c23
								
							
						
					
					
						commit
						bbeb915b02
					
				| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
*
 | 
			
		||||
!*.py
 | 
			
		||||
!.gitignore
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ class BnDeepNet(nn.Module):
 | 
			
		|||
model = DeepNet('tanh')
 | 
			
		||||
# model = BnDeepNet('relu')
 | 
			
		||||
 | 
			
		||||
device=torch.device("cuda")
 | 
			
		||||
device=torch.device("cuda" if torch.cuda.is_available() else "cpu")
 | 
			
		||||
model.to(device)
 | 
			
		||||
criterion = nn.CrossEntropyLoss()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue