Ptrblck,
I am really confuse. I try to use the L1 from pytorch package not mine, and forget about numpy, again gives me the same error , would you please help me more with that. I would appreciate your time.
(AttributeError: ‘NoneType’ object has no attribute ‘data’)
Is there any thing wrong with my model? or layers? weights initialization?
      criterion2=nn.L1Loss()

        for p in netG.parameters():
            p.requires_grad = True
            
        netG.zero_grad()   
        label.fill_(real_label)  
        label=label.to(device)
        output = netD(fake).view(-1)

        xxx=torch.histc(CMBMASKGaussy.squeeze(1).view(-1).cpu(),100, min=0, max=1, out=None)
        ddGaussy=xxx/xxx.sum()


        xxx1=torch.histc(fake.squeeze(1).view(-1).cpu(),100, min=0, max=1, out=None)
        ddFake=xxx1/xxx1.sum()

        MSECMBSS=criterion2(ddFake,ddGaussy)


        ## ----- total loss --------------------------

        loss2=Variable(MSECMBSS,requires_grad=True)
        loss2.backward()
   
        for param in netG.parameters():
            print(param.grad.data.sum())

        optimizerG.step()