By default, the output of BCELoss will be divided by the number of elements in the output. In your example, the first bce loss will be divided by 6 and the second one will be divided by 5, that made the different output.
You can set “reduction” to “none” or “sum” to see different output. For example:
criterion  = nn.BCELoss(reduction='none')
prediction = torch.tensor([[1.],[0.],[0.],[1.], [0.]])
label      = torch.tensor([[0.],[0.],[0.],[1.], [0.]])
loss       = criterion(input=prediction,target=label)
print(loss)

The output would be
tensor([[27.6310],
        [-0.0000],
        [-0.0000],
        [-0.0000],
        [-0.0000]])

For the 6 elements
criterion  = nn.BCELoss(reduction='none')
prediction = torch.tensor([[1.],[0.],[0.],[1.],[0.], [0.]])
label      = torch.tensor([[0.],[0.],[0.],[1.],[0.], [0.]])
loss       = criterion(input=prediction,target=label)
print(loss)

The output would be
tensor([[27.6310],
        [-0.0000],
        [-0.0000],
        [-0.0000],
        [-0.0000],
        [-0.0000]])