code: def state_fidelity(state0: State, state1: State) -> bk.BKTensor:
      
      assert state0.qubits == state1.qubits   # FIXME
      tensor = bk.absolute(bk.inner(state0.tensor, state1.tensor))**bk.fcast(2)
      return tensor
docs: Return the quantum fidelity between pure states.