code: def _get_batch_sizes(n, max_batch_size):
      batches = [max_batch_size for _ in range(n // max_batch_size)]
      if n % max_batch_size > 0:
          batches.append(n % max_batch_size)
      return batches
  
file_path: advertorch/advertorch/attacks/spsa.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import warnings
  import torch
  from .base import Attack
  from .base import LabelMixin
  from .utils import MarginalLoss
  from ..utils import is_float_or_torch_tensor, batch_clamp, clamp
label_desc: Use image node_id 2 for calling a global function with example usage: _get_batch_sizes(n, max_batch_size) and returns: batches