parameters: (strategy)
return_statement: return train_map
docstring: Convert ParallelLayouts object to specified list.
docstring_summary: Convert ParallelLayouts object to specified list.
docstring_tokens: Convert ParallelLayouts object to specified list .
function: def _convert_to_list(strategy):
      """Convert ParallelLayouts object to specified list."""
      train_map = {}
      for param_name in strategy.keys():
          try:
              layout = strategy.get(param_name)
              dev_mat = list(layout.dev_matrix[0].dim)
              tensor_map = list(layout.tensor_map[0].dim)
              param_split_shape = list(layout.param_split_shape[0].dim)
              field_size = int(layout.field)
              shard_stride = int(layout.opt_weight_shard_step)
              shard_size = int(layout.opt_weight_shard_size)
              train_map[param_name] = [dev_mat, tensor_map, param_split_shape, field_size, shard_stride, shard_size]
          except BaseException as e:
              raise ValueError(f"{e.__str__()}. For 'load_distributed_checkpoint', convert layout strategy to list "
                               f"failed, please make sure that strategy matches the node_strategy.proto, you can "
                               f"check whether 'train_strategy_filename' is correct.")
      return train_map
function_tokens: def _convert_to_list ( strategy ) : train_map = { } for param_name in strategy . keys ( ) : try : layout = strategy . get ( param_name ) dev_mat = list ( layout . dev_matrix [ 0 ] . dim ) tensor_map = list ( layout . tensor_map [ 0 ] . dim ) param_split_shape = list ( layout . param_split_shape [ 0 ] . dim ) field_size = int ( layout . field ) shard_stride = int ( layout . opt_weight_shard_step ) shard_size = int ( layout . opt_weight_shard_size ) train_map [ param_name ] = [ dev_mat , tensor_map , param_split_shape , field_size , shard_stride , shard_size ] except BaseException as e : raise ValueError ( f"{e.__str__()}. For 'load_distributed_checkpoint', convert layout strategy to list " f"failed, please make sure that strategy matches the node_strategy.proto, you can " f"check whether 'train_strategy_filename' is correct." ) return train_map