a437991e12a334b40b082fdc8b1b6dcf4a68021f,deepchem/models/tensorgraph/layers.py,NeighborList,get_cells_for_atoms,#NeighborList#Any#Any#,965

Before Change


    tiled_coords = tf.reshape(
        tf.tile(coords, (1, n_cells)), (n_cells * N, ndim))
    // List of N tensors of shape (n_cells, 1)
    tiled_coords = tf.split(tiled_coords, N)

    // Lists of length N 
    coords_rel = [
        tf.to_float(coords) - tf.to_float(cells)
        for (coords, cells) in zip(tiled_coords, tiled_cells)
    ]
    coords_norm = [tf.reduce_sum(rel**2, axis=1) for rel in coords_rel]

    // Lists of length n_cells
    // Get indices of k atoms closest to each cell point
    closest_inds = [tf.nn.top_k(-norm, k=1)[1] for norm in coords_norm]

    // TODO(rbharath): tf.stack for tf 1.0
    return tf.stack(closest_inds)

  def _get_num_nbrs(self):
    Get number of neighbors in current dimensionality space.
    ndim = self.ndim

After Change


    // Shape (N_atoms*n_cells, 1) after tile
    tiled_coords = tf.reshape(
        tf.tile(coords, (1, n_cells)), (n_cells * N_atoms, ndim))
    coords_vec = tf.reduce_sum((tiled_coords-tiled_cells)**2, axis=1)
    coords_norm = tf.reshape(coords_vec, (N_atoms, n_cells))

    closest_inds = tf.nn.top_k(-coords_norm,k=1)[1]
    return closest_inds

  def _get_num_nbrs(self):
    Get number of neighbors in current dimensionality space.
    ndim = self.ndim
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: deepchem/deepchem
Commit Name: a437991e12a334b40b082fdc8b1b6dcf4a68021f
Time: 2017-04-17
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tensorgraph/layers.py
Class Name: NeighborList
Method Name: get_cells_for_atoms


Project Name: cornellius-gp/gpytorch
Commit Name: c517e0b8b34a85b8142b4669c152b6e62c02d8e2
Time: 2019-03-18
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/lazy_tensor.py
Class Name: LazyTensor
Method Name: expand


Project Name: deepchem/deepchem
Commit Name: a437991e12a334b40b082fdc8b1b6dcf4a68021f
Time: 2017-04-17
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tensorgraph/layers.py
Class Name: NeighborList
Method Name: get_cells_for_atoms


Project Name: HyperGAN/HyperGAN
Commit Name: 7089233eb8fe6aaf06575d48c8ad6642faa579ec
Time: 2020-07-01
Author: mikkel@255bits.com
File Name: hypergan/train_hooks/adversarial_norm_train_hook.py
Class Name: AdversarialNormTrainHook
Method Name: regularize_adversarial_norm