3cb22adccb2deed60e56cd46491b26ed4209d6f4,qucumber/quantum_reconstruction.py,QuantumReconstruction,compute_batch_gradients,#QuantumReconstruction#Any#Any#Any#,50
Before Change
// Positive Phase
for i in range(samples_batch.shape[0]):
if bases_batch is None:
for par in rbm.state_dict():
grad["rbm_am"][par] += self.nn_state.gradient(samples_batch[i])["rbm_am"][par]/float(samples_batch.shape[0])
else:
b_flag = 0
for j in range(self.nn_state.num_visible):
if (bases_batch[i][j] != "Z"):
After Change
for net in self.nn_state.networks:
for par in grad_data[net].keys():
grad[net][par] = grad_data[net][par]/float(samples_batch.shape[0])// - grad_model[net][par]/float(self.nn_state.visible_state.shape[0])
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
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: PIQuIL/QuCumber
Commit Name: 3cb22adccb2deed60e56cd46491b26ed4209d6f4
Time: 2018-07-25
Author: gtorlai@uwaterloo.ca
File Name: qucumber/quantum_reconstruction.py
Class Name: QuantumReconstruction
Method Name: compute_batch_gradients
Project Name: facebookresearch/ParlAI
Commit Name: 028405190df7a8798b821d1fb1c28cb62f54d7d9
Time: 2017-05-12
Author: adamfisch15@gmail.com
File Name: parlai/agents/drqa/agents.py
Class Name: DocReaderAgent
Method Name: save
Project Name: pytorch/fairseq
Commit Name: 6d23cc7e7c32d1a6aa1d2d4a4c94abe50c980126
Time: 2021-03-04
Author: myleott@fb.com
File Name: fairseq/trainer.py
Class Name: Trainer
Method Name: save_checkpoint