runtime error : Found dtype Long but expected Float
real_cpu = data[ 0 ].to(device) b_size = real_cpu.size( 0 ) label = torch.full((b_size,), real_label, device = device) output = netD(real_cpu).view( - 1 ) output = output.type(torch.FloatTensor) 추가해도 저는 똑같네요 Starting Training Loop... --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) in 23 output = output . type ( torch . FloatTensor ) 24 ---> 25 errD_real = criterion ( output , label ) 26 errD_real . backward ( ) 27 D_x = output . mean ( ) . item ( ) ~\anaconda3\envs\pytorch3.7\lib\site-packages\torch\nn\modules\module.py in _call_impl (self, *input, **kwargs) 725 result = self . _slow_forward ( * input , ** kwargs ) 726 else : --> 727 result = self . forward ( * input , ** kwargs ) 728 for hook in itertools.chain( 729 _global_forward_hooks . values ( ) , ~\anaconda3\envs\pytorch3.7\lib\site-packages\torch\nn\modules\loss.py in forward (self, input, target) 528 529 def forward ( self , input : Tensor , target : Tensor ) -> Tensor : --> 530 return F . binary_cross_entropy ( input , target , weight = self . weight , reduction = self . reduction ) 531 532 ~\anaconda3\envs\pytorch3.7\lib\site-packages\torch\nn\functional.py in binary_cross_entropy (input, target, weight, size_average, reduce, reduction) 2524 2525 return torch._C._nn.binary_cross_entropy( -> 2526 input, target, weight, reduction_enum) 2527 2528 RuntimeError : Found dtype Long but expected Float