I usually just loop over the input by slice. Assuming your input is (batch, channels, depth, height, width) and target is (batch, depth, height, width):
loss = 0
for i in range(input.size()[2]):
    loss += F.cross_entropy(input[:, :, i], target[:, i])