docstr: Length of Random Batch Sampler.
  
  ..note::
      When `rampup_batch_size` is enabled, the return value can be not exactly precise.
docstr_tok: ["Length","of","Random","Batch","Sampler",".","..","note",":",":","When","`","rampup_batch_size","`","is","enabled",",","the","return","value","can","be","not","exactly","precise","."]
code: def __len__(self) -> int:
      """Length of Random Batch Sampler.
  
      ..note::
          When `rampup_batch_size` is enabled, the return value can be not exactly precise.
  
      """
      active_total_samples = self.total_samples - self.last_batch_size
      num_available_samples = (
          active_total_samples
          * (1 + (self.consumed_samples // active_total_samples))
      ) - self.consumed_samples
      if self.drop_last:
          return num_available_samples // self.global_batch_size
      else:
          return (
              num_available_samples + self.global_batch_size - 1
          ) // self.global_batch_size
  
imports: import abc
  import warnings
  from typing import Tuple
  import torch
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 2 for calling the MegatronPretrainingRandomBatchSampler obj's underlying member method code with example usage: obj.__len__() and returns: unknown, unknown