code: def apply_to_all(
      module: nn.Module,
      parameter_sharding_generator: ParameterShardingGenerator,
      sharder: Optional[ModuleSharder[nn.Module]] = None,
  ) -> Dict[str, ParameterShardingGenerator]:
      """
      Convenience function to apply a sharding scheme generator for all modules in construct_module_sharding_plan.
  
      Example::
  
          ebc = EmbeddingBagCollection(...)
          sharder = EmbeddingBagCollectionSharder()
          plan = construct_parameter_sharding_plan(
              ebc,
              apply_to_all(ebc, row_wise(), sharder),
          )
      """
      if sharder is None:
          sharder = get_module_to_default_sharders().get(
              type(module), None
          )
      else:
          assert isinstance(
              module, sharder.module_type
          ), f"Incorrect sharder for module type {type(module)}"
  
      assert (
          sharder is not None
      ), f"Could not find a valid sharder type for {type(module)}"
  
      shardable_parameters = sharder.shardable_parameters(module)
      return {
          param_name: parameter_sharding_generator
          for param_name in shardable_parameters
      }
  
imports: import math
  import warnings
  from typing import Callable, cast, Dict, List, Optional, Tuple, Type
  import torch
  from torch import distributed, nn
  from torchrec.distributed.comm import get_local_size
  from torchrec.distributed.embedding import EmbeddingCollectionSharder
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.embeddingbag import EmbeddingBagCollectionSharder
  from torchrec.distributed.fp_embeddingbag import FeatureProcessedEmbeddingBagCollectionSharder
  from torchrec.distributed.fused_embeddingbag import FusedEmbeddingBagCollectionSharder
  from torchrec.distributed.mc_embedding import ManagedCollisionEmbeddingCollectionSharder
  from torchrec.distributed.mc_embeddingbag import ManagedCollisionEmbeddingBagCollectionSharder
  from torchrec.distributed.planner.constants import MIN_CW_DIM
  from torchrec.distributed.quant_embedding import QuantEmbeddingCollectionSharder
  from torchrec.distributed.quant_embeddingbag import QuantEmbeddingBagCollectionSharder
  from torchrec.distributed.types import EmbeddingModuleShardingPlan, EnumerableShardingSpec, ModuleSharder, ParameterSharding, ShardingType, ShardMetadata
  from torchrec.distributed.utils import none_throws
label_desc: Use image node_id 16 for calling a global function with example usage: apply_to_all(module, parameter_sharding_generator, sharder) and returns: unknown