TensorFlow Quantum 0.5.0 includes new features, bug fixes and minimal API changes.
**New Features/Improvements:**
Added support for Cirq gates that have arbitrary control via the `gate.controlled_by` function. (Gradient support as well)
Added `tfq.math.inner_product` gradient. This op will now provide a gradient via `tf.GradientTape`.
Added `tfq.math.fidelity` op and gradient. This op will now provide a gradient via `tf.GradientTape`.
Added support in `tfq.convert_to_tensor` for circuits containing any Cirq noise channel from [common_channels](https://github.com/quantumlib/Cirq/blob/master/cirq-core/cirq/ops/common_channels.py) .
Added `tfq.noise.expectation` op and support with existing Differentiators for noisy analytic expectation calculation. Noisy simulations done via monte-carlo/trajectory sampling.
Added `tfq.noise.samples` op to draw bitstring samples from noisy circuits.
Added `tfq.noise.sampled_expectation` op and support with existing Differentiators for sample based expectation calculation.
Introduced `get_gradient_circuits` interface method for differentiators for users wanting to define a custom Differentiator.
Updated `tfq.layers.Expectation`, `tfq.layers.Samples`, `tfq.layers.SampledExpectation` with `__init__` parameter `backend=noisy`, `backend='noiseless'` to support noisy circuits.
Added `tfq.layers.NoisyPQC` and `tfq.layers.NoisyControlledPQC` which are noisy equivalents of `tfq.layers.PQC` and `tfq.layers.ControlledPQC`.
New datasets available via `tfq.datasets`.
Improved stability and performance in distributed training with `MultiWorkerMirroredStrategy` and `ParameterServer`.
**Bug fixes**
Fixed an issue where backward passes done on expectation ops with empty input tensors would cause `SEGFAULT`.
Fixed inconsistent output shapes between some ops, when input was the empty tensor.
Fixed randomness sources used for sampling to use thread safe `philox_random` approaches from TF instead of `std::mt19937` from the standard library.
Removed parallel calls to custom Cirq simulators when using `backend != None` inside of any `tfq.layers`. This is to ensure compatibility with high performance remote simulators as well as when running on real devices.
**Breaking changes**
We now depend on `cirq==0.11.0` and `tensorflow==2.4.1`.
A big thanks to all of our contributors for this release:
zaqqwerty , jaeyoo , lamberta , MarkDaoust , MichaelBroughton , therooler , sjerbi, balopat , lockwo, gatorwatt .