code: def test_label_logprobs(device):
      assert_allclose(
          label_logprobs(
              logits=torch.tensor([0.0, 0.0]), labels=torch.tensor(1)
          ),
          np.log(1 / 2),
      )
      assert_allclose(
          label_logprobs(
              logits=torch.tensor(
                  [[2.0, 2.0, 2.0], [1.0, 0.0, -np.inf]]
              ),
              labels=torch.tensor([2, 0]),
          ),
          [np.log(1 / 3), np.log(np.e / (np.e + 1))],
      )
      assert_allclose(
          label_logprobs(
              logits=torch.tensor([[[2.0, 2.0]], [[1.0, 0.0]]]),
              labels=torch.tensor([[0], [1]]),
          ),
          [[np.log(1 / 2)], [np.log(1 / (np.e + 1))]],
      )
  
imports: import numpy
  import pytest
  import torch
  from summarize_from_feedback.utils.assertions import assert_eq, assert_allclose
  from summarize_from_feedback.utils.torch_utils import first_true_indices, label_logprobs
label_desc: Use image node_id 2 for calling a global function with example usage: test_label_logprobs(device) without return types