76b2432b1c1ee03c80895a5c7d49cde485323102,qucumber/nn_states/complex_wavefunction.py,ComplexWaveFunction,rotated_gradient,#ComplexWaveFunction#,163
Before Change
// since grad_vp0/1 are real, can just treat the scalar multiplication
// and addition as a matrix multiplication
torch.matmul(Upsi_v, grad_vp0, out=rotated_grad[0])
torch.matmul(Upsi_v, grad_vp1, out=rotated_grad[1] )
grad = [
cplx.real(cplx.scalar_divide(rotated_grad[0], Upsi)), // Real
After Change
)
vr = v.reshape(-1, v.shape[-1])
raw_grads = [
self.am_grads(vr).reshape(2, *v.shape[:-1], -1),
self.ph_grads(vr).reshape(2, *v.shape[:-1], -1),
]
rotated_grad = [cplx.einsum("s...,s...g->...g", Upsi_v, g) for g in raw_grads]
grad = [
cplx.real(cplx.scalar_divide(rotated_grad[0], Upsi)),
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: PIQuIL/QuCumber
Commit Name: 76b2432b1c1ee03c80895a5c7d49cde485323102
Time: 2019-12-22
Author: emerali@users.noreply.github.com
File Name: qucumber/nn_states/complex_wavefunction.py
Class Name: ComplexWaveFunction
Method Name: rotated_gradient
Project Name: PIQuIL/QuCumber
Commit Name: d1dc3a229f48d677dac83fb13eef84145cd640ea
Time: 2019-12-22
Author: emerali@users.noreply.github.com
File Name: qucumber/nn_states/complex_wavefunction.py
Class Name: ComplexWaveFunction
Method Name: rotated_gradient
Project Name: PIQuIL/QuCumber
Commit Name: 960f18e759ac0ed76bb9193f29527a209bfd2b1a
Time: 2019-12-19
Author: emerali@users.noreply.github.com
File Name: qucumber/nn_states/density_matrix.py
Class Name: DensityMatrix
Method Name: rotated_gradient