def _validate_rates(qubits: set[cirq.Qid], rates: dict[cirq.Qid, np.ndarray]) -> None:
    """Check all rate matrices are square and of appropriate dimension.

    We check rates are positive in the class validator.
    """
    if qubits != set(rates):
        raise ValueError('qubits for rates inconsistent with those through qubit_dims')
    for q in rates:
        if rates[q].shape != (q.dimension, q.dimension):
            raise ValueError(
                f'Invalid shape for rate matrix: should be ({q.dimension}, {q.dimension}), '
                f'but got {rates[q].shape}'
            )
Check all rate matrices are square and of appropriate dimension.

    We check rates are positive in the class validator.
    
cirq-core/cirq/devices/thermal_noise_model.py