Watch keynotes, product sessions, workshops, and more from Google I/O See playlist

tfq.util.gate_approx_eq

Compares gates in the allowed TFQ gate set.

Gates in TFQ support symbols, numbers or a single product of a real number and a symbol as their parameters. This function behaves like cirq.approx_eq specialized for these kinds of gates so that TFQ can support approximate equality in gates containing symbols.

gate_true cirq.Gate which is in the TFQ gate set. These are gates which are instances of those found in tfq.util.get_supported_gates()
gate_deser cirq.Gate which is in the TFQ gate set. These are gates which are instances of those found in tfq.util.get_supported_gates()

bool which says if the two gates are approximately equal in the way described above.

TypeError If input gates are not of type cirq.Gate.
ValueError If invalid gate types are provided.