class_docstr: Adam optimizer with ZeRO algorithm
  
  Child class of Apex DistributedFusedAdam, with optimizations for
  NeMo-Megatron.
  
  Arguments:
      params (iterable): iterable of parameters to optimize or dicts
          defining parameter groups.
      disable_distributed_parameters (bool, optional): use standard
          data-parallel communication instead of ZeRO.
          (default: False)
      **kwargs: keyword arguments to pass to Apex
          DistributedFusedAdam.
docstr: Update parameter fragments with values from parameter buckets
  
  For FP8 params, values are copied directly into the FP8 data
  buffer.
docstr_tok: ["Update","parameter","fragments","with","values","from","parameter","buckets","For","FP8","params",",","values","are","copied","directly","into","the","FP8","data","buffer","."]
code: def _param_copy_fragments(
      self, fragments: Iterable[DistributedFusedAdam.ParameterFragment]
  ) -> None:
      """Update parameter fragments with values from parameter buckets
  
      For FP8 params, values are copied directly into the FP8 data
      buffer.
  
      """
  
      # Figure out corresponding positions in param buckets and params
      buffers_in = []
      buffers_out = []
      fragments = list(fragments)
      for fragment in fragments:
          # Check if fragment needs to be updated
          bucket_id = fragment.bucket_id
          bucket_start, bucket_end = fragment.bucket_range
          param_start, param_end = fragment.param_range
          if (
              param_end <= param_start
              or bucket_id not in self._params_buckets
          ):
              continue
  
          # Corresponding positions in bucket and param
          param_bucket = self._params_buckets[bucket_id]
          param = self.parameter(fragment)
          buffer_in = param_bucket.params_bucket[
              bucket_start:bucket_end
          ]
          if _is_fp8_tensor(param):
              # Copy into FP8 params's data buffer
              assert (
                  param_bucket.params_bucket.dtype == torch.uint8
              ), "Expected FP8 params to perform param sync in UINT8"
              buffer_out = param._data.view(-1)[param_start:param_end]
              buffers_in.append(buffer_in)
              buffers_out.append(buffer_out)
          elif torch.is_floating_point(
              buffer_in
          ) and torch.is_floating_point(param):
              # Cast between floating-point dtypes
              buffer_out = param.detach().view(-1)[
                  param_start:param_end
              ]
              buffers_in.append(buffer_in)
              buffers_out.append(buffer_out)
          else:
              # Copy most significant bytes for non-floating-point
              # dtypes
              # Note: Assume dtypes are little-endian
              buffer_out = param.detach().view(-1)[
                  param_start:param_end
              ]
              in_bytes = buffer_in.unsqueeze(-1).view(torch.uint8)
              out_bytes = buffer_out.unsqueeze(-1).view(torch.uint8)
              copy_size = min(in_bytes.size(-1), out_bytes.size(-1))
              buffers_in.append(in_bytes[..., -copy_size:])
              buffers_out.append(out_bytes[..., -copy_size:])
              if copy_size < out_bytes.size(-1):
                  out_bytes[..., :-copy_size].zero_()
  
      # Copy data from parameter buckets to parameters
      _multi_tensor_copy(
          buffers_in,
          buffers_out,
          dummy_overflow_buf=self._dummy_overflow_buf,
      )
  
      # Update transpose caches
      params = set(self.parameter(fragment) for fragment in fragments)
      for param in params:
          if _is_fp8_tensor(param):
              param.transpose(update_cache=True)
  
imports: import collections
  from typing import Callable, Dict, Iterable, Optional, Union
  import torch
  from apex.contrib.optimizers.distributed_fused_adam import DistributedFusedAdam, _disable_pre_forward_hook, _multi_tensor_copy
  from megatron.core import parallel_state
  from megatron.core.dist_checkpointing.dict_utils import dict_list_map_inplace
  from megatron.core.dist_checkpointing.mapping import ShardedTensor
  from megatron.core.dist_checkpointing.optimizer import get_param_id_to_sharded_param_map, optim_state_to_sharding_state
  from nemo.utils import str_to_dtype
label_desc: Use image node_id 11 for calling the MegatronDistributedFusedAdam obj's underlying member method code with example usage: obj._param_copy_fragments(fragments) without return types