code: def ensure_equal_in_range(
      t: torch.Tensor, start: int, end: int
  ) -> None:
      """
      Make sure that elements in the tensor @t are equal between @start and @end,
      but not beyond.
  
      Args:
          t: The tensor to check.
          start: The start of the equality check.
          end: The end of the equality check.
      """
      prototype = t[start]
      assert torch.all(
          (prototype - t[start:end]).abs() < 1e-3
      ), f"Expected equal values from index {start} to {end}, got tensor {t}."
      assert torch.all(
          prototype != t[end:]
      ), f"Expected values from index {end} onwards not to equal values at {start}, got tensor {t}."
  
imports: import math
  import pytest
  import torch
  from cvnets.layers import token_merging
label_desc: Use image node_id 1 for calling a global function with example usage: ensure_equal_in_range(t, start, end) without return types