docstr: Copy the weight and bias data from ``other``.
  
  This is especially useful for reproducible initialization and testing.
  
  Equivalent to:
  
  .. code-block:: python
  
      with torch.no_grad():
          self.weight.copy_(other.weight)
          if self.bias is not None:
              self.bias.copy_(other.bias)
  
  .. note::
      If ZeRO-3 is enabled, this is a collective operation and the
      updated parameters of data-parallel rank 0 will be visible on all
      ranks. See :class:`deepspeed.zero.GatheredParameters` for more
      information.
  
  
  Args:
      other (``torch.nn.Linear``): the linear layer to copy from.
docstr_tok: ["Copy","the","weight","and","bias","data","from","``","other","``",".","This","is","especially","useful","for","reproducible","initialization","and","testing",".","Equivalent","to",":","..","code-block",":",":","python","with","torch.no_grad","(",")",":","self.weight.copy_","(","other.weight",")","if","self.bias","is","not","None",":","self.bias.copy_","(","other.bias",")","..","note",":",":","If","ZeRO-3","is","enabled",",","this","is","a","collective","operation","and","the","updated","parameters","of","data-parallel","rank","0","will","be","visible","on","all","ranks",".","See",":","class",":","`","deepspeed.zero.GatheredParameters","`","for","more","information",".","Args",":","other","(","``","torch.nn.Linear","``",")",":","the","linear","layer","to","copy","from","."]
code: def copy_params_from(self, other):
      """Copy the weight and bias data from ``other``.
  
      This is especially useful for reproducible initialization and testing.
  
      Equivalent to:
  
      .. code-block:: python
  
          with torch.no_grad():
              self.weight.copy_(other.weight)
              if self.bias is not None:
                  self.bias.copy_(other.bias)
  
      .. note::
          If ZeRO-3 is enabled, this is a collective operation and the
          updated parameters of data-parallel rank 0 will be visible on all
          ranks. See :class:`deepspeed.zero.GatheredParameters` for more
          information.
  
  
      Args:
          other (``torch.nn.Linear``): the linear layer to copy from.
      """
      assert hasattr(other, "weight")
      assert other.weight.size() == (
          self.out_features,
          self.in_features,
      )
      if self.use_bias:
          assert hasattr(other, "bias")
          assert other.bias is not None
          assert other.bias.size() == (self.out_features,)
      else:
          assert other.bias is None
  
      for row in range(self.out_splits):
          rstart = self.out_parts[row]
          rstop = self.out_parts[row + 1]
  
          for col in range(self.in_splits):
              cstart = self.in_parts[col]
              cstop = self.in_parts[col + 1]
  
              local = self.linears[row][col]
              global_weight = other.weight[rstart:rstop, cstart:cstop]
              with deepspeed.zero.GatheredParameters(
                  local.weight, modifier_rank=0
              ):
                  local.weight.copy_(global_weight)
  
          if local.bias is not None:
              with deepspeed.zero.GatheredParameters(
                  local.bias, modifier_rank=0
              ):
                  local.bias.data.copy_(other.bias[rstart:rstop].data)
  
file_path: DeepSpeed/deepspeed/runtime/zero/tiling.py
imports: import torch
  import deepspeed
  from deepspeed.runtime.utils import partition_uniform
label_desc: Use image node_id 6 for calling the TiledLinear obj's underlying member method code with example usage: obj.copy_params_from(other) without return types