class_docstr: This class manages scope driven way of parameter sharing across different
  NameScopes.
class_docstr_tok: ["This","class","manages","scope","driven","way","of","parameter","sharing","across","different","NameScopes","."]
docstr: Recursively resolves all scope overrides, i.e multiple steps of
  override can be used.
  
  For example, if one provides following scope overrides:
  {'scope_b': 'scope_a'} and within 'scope_b' - {'shared_child': ''},
  then name 'w' will get resolved to the following blobs depending on the
  namescope:
    a. 'scope_a' -> 'scope_a/w'
    b. 'scope_b' -> 'scope_a/w'
    c. 'scope_c' -> 'scope_c/w'
    d. 'scope_b/shared_child' -> 'scope_a/w'
    d. 'scope_b/unshared_child' -> 'scope_a/unshared_child/w'
docstr_tok: ["Recursively","resolves","all","scope","overrides",",","i.e","multiple","steps","of","override","can","be","used",".","For","example",",","if","one","provides","following","scope","overrides",":","{","'scope_b","'",":","'scope_a","'","}","and","within","'scope_b","'","-","{","'shared_child","'",":","``","}",",","then","name","'","w","'","will","get","resolved","to","the","following","blobs","depending","on","the","namescope",":","a",".","'scope_a","'","-",">","'scope_a\/w'","b",".","'scope_b","'","-",">","'scope_a\/w'","c.","'scope_c","'","-",">","'scope_c\/w'","d.","'scope_b\/shared_child","'","-",">","'scope_a\/w'","d.","'scope_b\/unshared_child","'","-",">","'scope_a\/unshared_child\/w","'"]
code: def _resolve_scope_overrides(self, candidate_scope):
      """
      Recursively resolves all scope overrides, i.e multiple steps of
      override can be used.
  
      For example, if one provides following scope overrides:
      {'scope_b': 'scope_a'} and within 'scope_b' - {'shared_child': ''},
      then name 'w' will get resolved to the following blobs depending on the
      namescope:
        a. 'scope_a' -> 'scope_a/w'
        b. 'scope_b' -> 'scope_a/w'
        c. 'scope_c' -> 'scope_c/w'
        d. 'scope_b/shared_child' -> 'scope_a/w'
        d. 'scope_b/unshared_child' -> 'scope_a/unshared_child/w'
      """
      best_scope = candidate_scope
      best_scope_idx = 0
      sub_scopes = candidate_scope.split(scope._NAMESCOPE_SEPARATOR)
  
      cur_scope = ""
      for idx, sub_scope in enumerate(sub_scopes):
          cur_scope = cur_scope + sub_scope + scope._NAMESCOPE_SEPARATOR
          if cur_scope in self._scope_overrides:
              best_scope = self._scope_overrides[cur_scope]
              best_scope_idx = idx
      if best_scope == candidate_scope:
          return candidate_scope
      else:
          return self._resolve_scope_overrides(
              best_scope
          ) + scope._NAMESCOPE_SEPARATOR.join(
              sub_scopes[best_scope_idx + 1 :]
          )
  
file_path: pytorch/caffe2/python/modeling/parameter_sharing.py
imports: from caffe2.python import scope
  import contextlib
  import logging
label_desc: Use image node_id 2 for calling the ParameterSharingContext obj's underlying member method code with example usage: obj._resolve_scope_overrides(candidate_scope) and returns: candidate_scope, unknown