0c241128fc008e89745690bd58e91e754aa40514,deepchem/models/tensorgraph/models/graph_models.py,MPNNModel,default_generator,#MPNNModel#Any#Any#Any#Any#Any#,778

Before Change


          pad_batches=False):

        X_b = pad_features(self.batch_size, X_b)
        feed_dict = dict()
        if y_b is not None:
          if self.mode == "classification":
            feed_dict[self.labels[0]] = to_one_hot(y_b.flatten(),
                                                   self.n_classes).reshape(
                                                       -1, self.n_tasks,
                                                       self.n_classes)
          else:
            feed_dict[self.labels[0]] = y_b
        if w_b is not None:
          feed_dict[self.task_weights[0]] = w_b

        atom_feat = []
        pair_feat = []
        atom_split = []
        atom_to_pair = []
        pair_split = []
        start = 0
        for im, mol in enumerate(X_b):
          n_atoms = mol.get_num_atoms()
          // number of atoms in each molecule
          atom_split.extend([im] * n_atoms)
          // index of pair features
          C0, C1 = np.meshgrid(np.arange(n_atoms), np.arange(n_atoms))
          atom_to_pair.append(
              np.transpose(
                  np.array([C1.flatten() + start,
                            C0.flatten() + start])))
          // number of pairs for each atom
          pair_split.extend(C1.flatten() + start)
          start = start + n_atoms

          // atom features
          atom_feat.append(mol.get_atom_features())
          // pair features
          pair_feat.append(
              np.reshape(mol.get_pair_features(),
                         (n_atoms * n_atoms, self.n_pair_feat)))

        feed_dict[self.atom_features] = np.concatenate(atom_feat, axis=0)
        feed_dict[self.pair_features] = np.concatenate(pair_feat, axis=0)
        feed_dict[self.atom_split] = np.array(atom_split)
        feed_dict[self.atom_to_pair] = np.concatenate(atom_to_pair, axis=0)
        yield feed_dict


//////////////////////////////////////// Deprecation warnings for renamed TensorGraph models ////////////////////////////////////////

After Change


            np.array(atom_split),
            np.concatenate(atom_to_pair, axis=0), n_samples
        ]
        yield (inputs, [y_b], [w_b])


//////////////////////////////////////// Deprecation warnings for renamed TensorGraph models ////////////////////////////////////////
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 31

Instances


Project Name: deepchem/deepchem
Commit Name: 0c241128fc008e89745690bd58e91e754aa40514
Time: 2019-05-10
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: MPNNModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: 0c241128fc008e89745690bd58e91e754aa40514
Time: 2019-05-10
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: MPNNModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: 1533d1db4d1c0ebf278e2e963c05ef8ffd92cd52
Time: 2019-05-10
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: DAGModel
Method Name: default_generator


Project Name: deepchem/deepchem
Commit Name: 1533d1db4d1c0ebf278e2e963c05ef8ffd92cd52
Time: 2019-05-10
Author: peastman@stanford.edu
File Name: deepchem/models/tensorgraph/models/graph_models.py
Class Name: DTNNModel
Method Name: default_generator