google / qhbm-library

Quantum Hamiltonian-Based Models built on TensorFlow Quantum
https://qhbm-library.readthedocs.io/en/latest/
Apache License 2.0
40 stars 15 forks source link

Refactor the delta expectation function #205

Closed zaqqwerty closed 2 years ago

zaqqwerty commented 2 years ago

In our derivative tests, we often use a function delta_expectations_func(k, var, delta). This function wraps a target function, and returns its value after perturbing the kth entry of the tf.Variable var by delta. This subroutine should be made into a functional that accepts the target function, moved to test_util.py, and tested. Part of #171