code: def promote_partial_block_types(
      block_table,
      narrow_blocks,
      dst_blocks,
      dst_fields_loc,
      data_manager: DataManager,
      inplace=True,
  ):
      def _mapper(
          blocks,
          narrow_loc: list = None,
          dst_bids: list = None,
          dst_loc: List[Tuple[str, str]] = None,
          dm: DataManager = None,
          inp: bool = True,
      ):
          ret_blocks = []
          for block in blocks:
              if inp:
                  if isinstance(block, torch.Tensor):
                      ret_blocks.append(block.clone())
                  else:
                      ret_blocks.append(block.copy())
              else:
                  ret_blocks.append(block)
  
          for i in range(len(ret_blocks), dm.block_num):
              ret_blocks.append([])
  
          for bid, offsets in narrow_loc:
              ret_blocks[bid] = ret_blocks[bid][:, offsets]
  
          for dst_bid, (src_bid, src_offset) in zip(dst_bids, dst_loc):
              block_values = blocks[src_bid][:, [src_offset]]
              ret_blocks[dst_bid] = dm.blocks[dst_bid].convert_block(
                  block_values
              )
  
          return ret_blocks
  
      _mapper_func = functools.partial(
          _mapper,
          narrow_loc=narrow_blocks,
          dst_bids=dst_blocks,
          dst_loc=dst_fields_loc,
          dm=data_manager,
          inp=inplace,
      )
  
      return block_table.mapValues(_mapper_func)
  
imports: import functools
  import torch
  from ..manager import DataManager
  from ..manager.block_manager import Block
  from typing import List, Tuple
label_desc: Use image node_id 2 for calling a global function with example usage: promote_partial_block_types(block_table, narrow_blocks, dst_blocks, dst_fields_loc, data_manager, inplace) and returns: block_table, ret_blocks