b11d724e27ce608da0b38565f2a697b1da98d799,qucumber/quantum_reconstruction.py,QuantumReconstruction,compute_batch_gradients,#QuantumReconstruction#Any#Any#Any#,49

Before Change


                    if (bases_batch[i][j] != "Z"):
                        b_flag = 1
                if (b_flag == 0):
                    for par in getattr(self.nn_state, "rbm_am").state_dict():
                        grad_data["rbm_am"][par] += self.nn_state.gradient(samples_batch[i])["rbm_am"][par]
                else:
                    rotated_grad = self.nn_state.rotate_grad(bases_batch[i],samples_batch[i])
                    for net in self.nn_state.networks:
                        for par in getattr(self.nn_state, net).state_dict():
                            grad_data[net][par] += rotated_grad[net][par]
            

After Change


                grad[net][par] = grad_data[net][par]/float(samples_batch.shape[0])

        self.nn_state.sample(k)
        grad_model = {"rbm_am": self.nn_state.rbm_am.effective_energy_gradient(self.nn_state.visible_state)}
        for par in grad_data["rbm_am"].keys():
            grad["rbm_am"][par] -= grad_model["rbm_am"][par]/float(self.nn_state.visible_state.shape[0])
        return grad
        
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: PIQuIL/QuCumber
Commit Name: b11d724e27ce608da0b38565f2a697b1da98d799
Time: 2018-07-29
Author: gtorlai@uwaterloo.ca
File Name: qucumber/quantum_reconstruction.py
Class Name: QuantumReconstruction
Method Name: compute_batch_gradients


Project Name: PIQuIL/QuCumber
Commit Name: 4caabb4385de3cfd3c5d6d48f94fbc202d756fd4
Time: 2018-06-13
Author: emerali@users.noreply.github.com
File Name: rbm/rbm.py
Class Name: RBM
Method Name: save


Project Name: PIQuIL/QuCumber
Commit Name: ffcd8e8aaff01e291e48d86fd83ee410f24bfdd3
Time: 2018-06-18
Author: emerali@users.noreply.github.com
File Name: rbm/rbm.py
Class Name: RBM
Method Name: save