code: def compute_normalization_binary_search(
      activations: Tensor, t: float, num_iters: int
  ) -> Tensor:
      """Compute normalization value for each example (t < 1.0).
      Args:
        activations: A multi-dimensional tensor with last dimension `num_classes`.
        t: Temperature 2 (< 1.0 for finite support).
        num_iters: Number of iterations to run the method.
      Return: A tensor of same rank as activation with the last dimension being 1.
      """
      mu, _ = torch.max(activations, -1, keepdim=True)
      normalized_activations = activations - mu
  
      effective_dim = torch.sum(
          (normalized_activations > -1.0 / (1.0 - t)).to(torch.int32),
          dim=-1,
          keepdim=True,
      ).to(activations.dtype)
  
      shape_partition = activations.shape[:-1] + (1,)
      lower = torch.zeros(
          shape_partition,
          dtype=activations.dtype,
          device=activations.device,
      )
      upper = -log_t(1.0 / effective_dim, t) * torch.ones_like(lower)
  
      for _ in range(num_iters):
          logt_partition = (upper + lower) / 2.0
          sum_probs = torch.sum(
              exp_t(normalized_activations - logt_partition, t),
              dim=-1,
              keepdim=True,
          )
          update = (sum_probs < 1.0).to(activations.dtype)
          lower = torch.reshape(
              lower * update + (1.0 - update) * logt_partition,
              shape_partition,
          )
          upper = torch.reshape(
              upper * (1.0 - update) + update * logt_partition,
              shape_partition,
          )
  
      logt_partition = (upper + lower) / 2.0
      return logt_partition + mu
  
imports: from typing import Optional
  import torch
  from torch import nn, Tensor
label_desc: Use image node_id 4 for calling a global function with example usage: compute_normalization_binary_search(activations, t, num_iters) and returns: unknown