code: def test_rank_builder(
      batch_shape: Sequence[int],
      num_batches: int,
      partial_num_choices: int,
  ):
      """Test for rank builder."""
      generator = torch.manual_seed(seed=42)
      y_true = torch.rand(size=batch_shape, generator=generator)
      # initialize
      builder = pykeen.evaluation.ranks.RankBuilder(y_true=y_true)
      # update with batches
      total = 0
      for _ in range(num_batches):
          y_pred = torch.rand(
              size=(*batch_shape, partial_num_choices),
              generator=generator,
          )
          builder = builder.update(y_pred=y_pred)
          total += partial_num_choices
          assert (builder.total == total).all()
          assert builder.larger.shape == batch_shape
      ranks = builder.compute()
      assert isinstance(ranks, pykeen.evaluation.ranks.Ranks)
  
imports: from typing import Sequence
  import pytest
  import torch
  import pykeen.evaluation.ranks
label_desc: Use image node_id 1 for calling a global function with example usage: test_rank_builder(batch_shape, num_batches, partial_num_choices) without return types