The below code produce your  error ‘TypeError: CudaBCECriterion_updateOutput received …’
    batch_size  = 64
    num_classes = 17
    C,H,W = 3,256,256


    inputs = torch.randn(batch_size,C,H,W)
    labels = torch.randn(batch_size,num_classes)
    in_shape = inputs.size()[1:]

    if 1:
        net = densenet121(in_shape=in_shape, num_classes=num_classes).cuda().train()

        x = Variable(inputs)
        logits, probs = net.forward(x.cuda())

        loss = nn.MultiLabelSoftMarginLoss()(logits, Variable(labels))
        loss.backward()

        print(type(net))
        print(net)
        print(probs)


The error can be corrected by
loss = nn.MultiLabelSoftMarginLoss()(logits, Variable(labels.cuda()))