997875ab4734f08b153db53f4f3e546a7740a233,opennmt/utils/misc.py,,get_variable_name,#Any#Any#Any#,66

Before Change


  variables_to_names, _ = get_variables_name_mapping(root, root_key=model_key)
  // In case of a MirroredVariable, look up the primary variable
  variable = get_primary_variable(variable)
  return variables_to_names.get(variable.ref())

def get_primary_variable(variable):
  If :obj:`variable` is distributed, returns the primary component.

After Change


def get_variable_name(variable, root, model_key="model"):
  Gets the variable name in the object-based representation.
  names_to_variables = get_variables_name_mapping(root, root_key=model_key)
  for name, var in names_to_variables.items():
    if var is variable:
      return name
  return None

def get_primary_variable(variable):
  If :obj:`variable` is distributed, returns the primary component.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 997875ab4734f08b153db53f4f3e546a7740a233
Time: 2020-11-04
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/utils/misc.py
Class Name:
Method Name: get_variable_name


Project Name: brian-team/brian2
Commit Name: 8f355b48ef1cd40dc6483a4a7d827f9405b4623c
Time: 2018-03-29
Author: marcel.stimberg@inserm.fr
File Name: brian2/utils/caching.py
Class Name:
Method Name: _hashable


Project Name: brian-team/brian2
Commit Name: bf72974b7eb2229b6f4f4d7ae6b654693785d71f
Time: 2014-09-19
Author: marcel.stimberg@ens.fr
File Name: brian2/core/magic.py
Class Name: MagicNetwork
Method Name: _update_magic_objects