3040d26d11096c12daf417cd46912bb30f5dafab,pyro/infer/mcmc/hmc.py,HMC,_kinetic_energy,#HMC#Any#,141

Before Change



    def _kinetic_energy(self, r):
        r_flat = torch.cat([r[site_name].reshape(-1) for site_name in sorted(r)])
        if self.inverse_mass_matrix.dim() == 2:
            return 0.5 * self.inverse_mass_matrix.matmul(r_flat).dot(r_flat)
        else:
            return 0.5 * self.inverse_mass_matrix.dot(r_flat ** 2)

    def _energy(self, z, r):
        return self._kinetic_energy(r) + self.potential_fn(z)

    def _reset(self):

After Change


            if inv_mass_matrix.dim() == 1:
                energy = energy + 0.5 * inv_mass_matrix.dot(r_flat ** 2)
            else:
                energy = energy + 0.5 * inv_mass_matrix.matmul(r_flat).dot(r_flat)
        return energy

    def _energy(self, z, r):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: uber/pyro
Commit Name: 3040d26d11096c12daf417cd46912bb30f5dafab
Time: 2020-04-21
Author: fehiepsi@gmail.com
File Name: pyro/infer/mcmc/hmc.py
Class Name: HMC
Method Name: _kinetic_energy


Project Name: allenai/allennlp
Commit Name: bbfbfce5c8c18b39d541d912ffb11182f7d06dfd
Time: 2017-08-06
Author: markn@allenai.org
File Name: allennlp/modules/similarity_functions/linear.py
Class Name: LinearSimilarity
Method Name: forward


Project Name: rusty1s/pytorch_geometric
Commit Name: 4e43734dd0b7f1c026069af64151a8f52f41060d
Time: 2019-07-03
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/conv/sage_conv.py
Class Name: SAGEConv
Method Name: forward