Maybe one of the layers in your CNN does the conversion. Can you include the code for the CNN?
In the general case you can convert like so:
  if use_cuda:
        lgr.info ("Using the GPU")            
         Y = Variable(torch.from_numpy(y_data_np).type(torch.LongTensor).cuda())       
    else:
        lgr.info ("Using the CPU")        
         Y = Variable(torch.squeeze (torch.from_numpy(y_data_np).type(torch.LongTensor)))  #         

Also,  BCEloss requires Floats in Y (e.g. targets) so maybe this is the case in your cost function too.