<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/quantum/blob/v0.7.6/tensorflow_quantum/python/util.py#L554-L623) |

Compares gates in the allowed TFQ gate set.

    tfq.util.gate_approx_eq(
        gate_true, gate_deser, atol=1e-05
    )

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`](https://quantumai.google/reference/python/cirq/approx_eq) specialized for these kinds of gates so that TFQ can
support approximate equality in gates containing symbols.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `gate_true` | [`cirq.Gate`](https://quantumai.google/reference/python/cirq/Gate) which is in the TFQ gate set. These are gates which are instances of those found in [`tfq.util.get_supported_gates()`](https://www.tensorflow.org/quantum/api_docs/python/tfq/util/get_supported_gates) |
| `gate_deser` | [`cirq.Gate`](https://quantumai.google/reference/python/cirq/Gate) which is in the TFQ gate set. These are gates which are instances of those found in [`tfq.util.get_supported_gates()`](https://www.tensorflow.org/quantum/api_docs/python/tfq/util/get_supported_gates) |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| bool which says if the two gates are approximately equal in the way described above. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If input gates are not of type [`cirq.Gate`](https://quantumai.google/reference/python/cirq/Gate). |
| `ValueError` | If invalid gate types are provided. |

<br />