code: def test_information_content(shape, seed):
      # test all reductions of coding cost
      # also check base-2 and base-10
      rng = numpy.random.default_rng(seed)
      probabilities = torch.tensor(rng.uniform(size=shape))
  
      def batch_el_reduction(x):
          return torch.stack([torch.sum(el) for el in x])
  
      base_ops = {2: torch.log2, 10: torch.log10}
      reduction_ops = {
          "sum": torch.sum,
          "batch_el": batch_el_reduction,
          "none": lambda x: x,
      }
  
      for base in (2, 10):
          for reduction in ("sum", "batch_el", "none"):
              torch_cost = -1 * reduction_ops[reduction](
                  base_ops[base](probabilities)
              )
              assert torch.allclose(
                  information_content(
                      probabilities, reduction=reduction, base=base
                  ),
                  torch_cost,
              )
  
imports: import numpy
  import pytest
  import torch
  from neuralcompression.functional import information_content
label_desc: Use image node_id 1 for calling a global function with example usage: test_information_content(shape, seed) and returns: torch