db395e855ad7911453da943eee40fbb2a5379353,deepchem/models/tensorgraph/layers.py,Layer,copy,#Layer#Any#Any#Any#,222

Before Change


      This means the newly created layers will share variables with the original
      ones.
    
    if tfe.in_eager_mode():
      raise ValueError("copy() is not supported in eager mode")
    if self in replacements:
      return replacements[self]
    copied_inputs = [
        layer.copy(replacements, variables_graph, shared)
        for layer in self.in_layers
    ]
    if shared:
      copy = self.shared(copied_inputs)
    else:
      copy = self.clone(copied_inputs)
    if variables_graph is not None:
      if shared:
        raise ValueError("Cannot specify variables_graph when shared==True")
      variables = variables_graph.get_layer_variables(self)
      if len(variables) > 0:
        with variables_graph._get_tf("Graph").as_default():
          values = variables_graph.session.run(variables)
          copy.set_variable_initial_values(values)
    return copy

  def _as_graph_element(self):

After Change


      variables = variables_graph.get_layer_variables(self)
      if len(variables) > 0:
        with variables_graph._get_tf("Graph").as_default():
          if tfe.in_eager_mode():
            values = [v.numpy() for v in variables]
          else:
            values = variables_graph.session.run(variables)
          copy.set_variable_initial_values(values)
    return copy

  def _as_graph_element(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: deepchem/deepchem
Commit Name: db395e855ad7911453da943eee40fbb2a5379353
Time: 2018-03-28
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/layers.py
Class Name: Layer
Method Name: copy


Project Name: deepchem/deepchem
Commit Name: eaff287af9039f2ba1bbf86182a0457799de4033
Time: 2018-03-27
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/layers.py
Class Name: GraphConv
Method Name: create_tensor


Project Name: deepchem/deepchem
Commit Name: eaff287af9039f2ba1bbf86182a0457799de4033
Time: 2018-03-27
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/layers.py
Class Name: LSTMStep
Method Name: create_tensor