code: def state() -> "StateMP":
      r"""Quantum state in the computational basis.
  
      This function accepts no observables and instead instructs the QNode to return its state. A
      ``wires`` argument should *not* be provided since ``state()`` always returns a pure state
      describing all wires in the device.
  
      Note that the output shape of this measurement process depends on the
      number of wires defined for the device.
  
      Returns:
          StateMP: Measurement process instance
  
      **Example:**
  
      .. code-block:: python3
  
          dev = qml.device("default.qubit", wires=2)
  
          @qml.qnode(dev)
          def circuit():
              qml.Hadamard(wires=1)
              return qml.state()
  
      Executing this QNode:
  
      >>> circuit()
      array([0.70710678+0.j, 0.70710678+0.j, 0.        +0.j, 0.        +0.j])
  
      The returned array is in lexicographic order. Hence, we have a :math:`1/\sqrt{2}` amplitude
      in both :math:`|00\rangle` and :math:`|01\rangle`.
  
      .. note::
  
          Differentiating :func:`~pennylane.state` is currently only supported when using the
          classical backpropagation differentiation method (``diff_method="backprop"``) with a
          compatible device.
  
      .. details::
          :title: Usage Details
  
          A QNode with the ``qml.state`` output can be used in a cost function which
          is then differentiated:
  
          >>> dev = qml.device('default.qubit', wires=2)
          >>> @qml.qnode(dev, diff_method="backprop")
          ... def test(x):
          ...     qml.RY(x, wires=[0])
          ...     return qml.state()
          >>> def cost(x):
          ...     return np.abs(test(x)[0])
          >>> cost(x)
          0.9987502603949663
          >>> qml.grad(cost)(x)
          tensor(-0.02498958, requires_grad=True)
      """
      return StateMP()
  
file_path: pennylane/pennylane/measurements/state.py
imports: from typing import Sequence, Optional
  import pennylane
  from pennylane.wires import Wires, WireError
  from .measurements import State, StateMeasurement
label_desc: Use image node_id 1 for calling a global function with example usage: state() and returns: StateMP