class_docstr: Information to be passed and used for a batch of inputs during
  a single model forward
docstr: in-place update block loc mapping based on the sequence length of the inputs in current bath
docstr_tok: ["in-place","update","block","loc","mapping","based","on","the","sequence","length","of","the","inputs","in","current","bath"]
code: def init_block_loc(
      b_loc: torch.Tensor,
      seq_len: torch.Tensor,
      max_len_in_batch: int,
      alloc_mem_index: torch.Tensor,
  ):
      """in-place update block loc mapping based on the sequence length of the inputs in current bath"""
      start_index = 0
      seq_len_numpy = seq_len.cpu().numpy()
      for i, cur_seq_len in enumerate(seq_len_numpy):
          b_loc[
              i, max_len_in_batch - cur_seq_len : max_len_in_batch
          ] = alloc_mem_index[start_index : start_index + cur_seq_len]
          start_index += cur_seq_len
      return
  
file_path: ColossalAI/colossalai/inference/kv_cache/batch_infer_state.py
imports: from dataclasses import dataclass
  import torch
  from transformers.tokenization_utils_base import BatchEncoding
  from .kvcache_manager import MemoryManager
label_desc: Use image node_id 3 for calling the BatchInferState obj's underlying member method code with example usage: obj.init_block_loc(b_loc, seq_len, max_len_in_batch, alloc_mem_index) without return types