class_docstr: Proposes sharding plans in greedy fashion.
  
  Sorts sharding options for each shardable parameter by perf.
  On each iteration, finds parameter with largest current storage usage and tries its
  next sharding option.
  
  Args:
      use_depth (bool): When enabled, sharding_options of a fqn are sorted based on
          `max(shard.perf.total)`, otherwise sharding_options are sorted by
          `sum(shard.perf.total)`.
      threshold (Optional[int]): Threshold for early stopping. When specified, the
          proposer stops proposing when the proposals have consecutive worse perf_rating
          than best_perf_rating.
class_docstr_tok: ["Proposes","sharding","plans","in","greedy","fashion",".","Sorts","sharding","options","for","each","shardable","parameter","by","perf",".","On","each","iteration",",","finds","parameter","with","largest","current","storage","usage","and","tries","its","next","sharding","option",".","Args",":","use_depth","(","bool",")",":","When","enabled",",","sharding_options","of","a","fqn","are","sorted","based","on","`","max","(","shard.perf.total",")","`",",","otherwise","sharding_options","are","sorted","by","`","sum","(","shard.perf.total",")","`",".","threshold","(","Optional","[","int","]",")",":","Threshold","for","early","stopping",".","When","specified",",","the","proposer","stops","proposing","when","the","proposals","have","consecutive","worse","perf_rating","than","best_perf_rating","."]
code: def load(
      self,
      search_space: List[ShardingOption],
      enumerator: Optional[Enumerator] = None,
  ) -> None:
      self._reset()
      for sharding_option in search_space:
          fqn = sharding_option.fqn
          if fqn not in self._sharding_options_by_fqn:
              self._sharding_options_by_fqn[fqn] = []
          self._sharding_options_by_fqn[fqn].append(sharding_option)
  
      for sharding_options in self._sharding_options_by_fqn.values():
          sharding_options.sort(
              key=lambda x: _sharding_option_score(x, self._use_depth)
          )
  
      self._current_proposal = {
          fqn: 0 for fqn in self._sharding_options_by_fqn.keys()
      }
  
imports: import copy
  import itertools
  import logging
  from decimal import Decimal
  from typing import cast, Dict, List, Optional, Set, Tuple, Union
  import torch
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.planner.types import Enumerator, Perf, Proposer, ShardingOption, Topology
  from torchrec.distributed.planner.utils import BinarySearchPredicate, bytes_to_gb, prod
label_desc: Use image node_id 2 for calling the GreedyProposer obj's underlying member method code with example usage: obj.load(search_space, enumerator) without return types