code: def get_next_idx(next_idx):
      with next_idx.get_lock():
          idx = next_idx.value
          next_idx.value += 1
      return idx
  
file_path: BigDL/python/nano/src/bigdl/nano/pytorch/inference/multi_instance.py
imports: from typing import Union, List
  import torch
  from torch.utils.data.dataset import TensorDataset
  from torch.utils.data.dataloader import DataLoader
  from bigdl.nano.utils.common import invalidInputError, invalidOperationError
  from bigdl.nano.pytorch.model import AcceleratedLightningModule
label_desc: Use image node_id 3 for calling a global function with example usage: get_next_idx(next_idx) and returns: idx