class_docstr: Implements an arbitrary state preparation on the specified wires.
  
  An arbitrary state on :math:`n` wires is parametrized by :math:`2^{n+1} - 2`
  independent real parameters. This templates uses Pauli word rotations to
  parametrize the unitary.
  
  Args:
      weights (tensor_like): Angles of the Pauli word rotations. Needs to have length :math:`2^{n+1} - 2`
          where :math:`n` is the number of wires the template acts upon.
      wires (Iterable): wires that the template acts on
  
  **Example**
  
  ArbitraryStatePreparation can be used to train state preparations,
  for example using a circuit with some measurement observable ``H``:
  
  .. code-block:: python
  
      dev = qml.device("default.qubit", wires=4)
  
      @qml.qnode(dev)
      def vqe(weights):
          qml.ArbitraryStatePreparation(weights, wires=[0, 1, 2, 3])
  
          return qml.expval(qml.Hermitian(H, wires=[0, 1, 2, 3]))
  
  The shape of the weights parameter can be computed as follows:
  
  .. code-block:: python
  
      shape = qml.ArbitraryStatePreparation.shape(n_wires=4)
docstr: Representation of the operator as a product of other operators.
  
  .. math:: O = O_1 O_2 \dots O_n.
  
  
  
  .. seealso:: :meth:`~.ArbitraryStatePreparation.decomposition`.
  
  Args:
      weights (tensor_like): Angles of the Pauli word rotations. Needs to have length :math:`2^{n+1} - 2`
          where :math:`n` is the number of wires the template acts upon.
      wires (Any or Iterable[Any]): wires that the operator acts on
  
  Returns:
      list[.Operator]: decomposition of the operator
  
  **Example**
  
  >>> weights = torch.tensor([1., 2., 3., 4., 5., 6.])
  >>> qml.ArbitraryStatePreparation.compute_decomposition(weights, wires=["a", "b"])
  [PauliRot(tensor(1.), 'XI', wires=['a', 'b']),
   PauliRot(tensor(2.), 'YI', wires=['a', 'b']),
   PauliRot(tensor(3.), 'IX', wires=['a', 'b']),
   PauliRot(tensor(4.), 'IY', wires=['a', 'b']),
   PauliRot(tensor(5.), 'XX', wires=['a', 'b']),
   PauliRot(tensor(6.), 'XY', wires=['a', 'b'])]
docstr_tok: ["Representation","of","the","operator","as","a","product","of","other","operators",".","..","math",":",":","O","=","O_1","O_2","\\dots","O_n",".","..","seealso",":",":",":","meth",":","`","~.ArbitraryStatePreparation.decomposition","`",".","Args",":","weights","(","tensor_like",")",":","Angles","of","the","Pauli","word","rotations",".","Needs","to","have","length",":","math",":","`","2^","{","n+1","}","-","2","`","where",":","math",":","`","n","`","is","the","number","of","wires","the","template","acts","upon",".","wires","(","Any","or","Iterable","[","Any","]",")",":","wires","that","the","operator","acts","on","Returns",":","list","[",".Operator","]",":","decomposition","of","the","operator","*","*","Example","*","*",">",">",">","weights","=","torch.tensor","(","[","1.",",","2.",",","3.",",","4.",",","5.",",","6",".","]",")",">",">",">","qml.ArbitraryStatePreparation.compute_decomposition","(","weights",",","wires=","[","``","a","''",",","``","b","''","]",")","[","PauliRot","(","tensor","(","1",".",")",",","'XI","'",",","wires=","[","'","a","'",",","'","b","'","]",")",",","PauliRot","(","tensor","(","2",".",")",",","'YI","'",",","wires=","[","'","a","'",",","'","b","'","]",")",",","PauliRot","(","tensor","(","3",".",")",",","'IX","'",",","wires=","[","'","a","'",",","'","b","'","]",")",",","PauliRot","(","tensor","(","4",".",")",",","'IY","'",",","wires=","[","'","a","'",",","'","b","'","]",")",",","PauliRot","(","tensor","(","5",".",")",",","'XX","'",",","wires=","[","'","a","'",",","'","b","'","]",")",",","PauliRot","(","tensor","(","6",".",")",",","'XY","'",",","wires=","[","'","a","'",",","'","b","'","]",")","]"]
code: def compute_decomposition(
      weights, wires
  ):  # pylint: disable=arguments-differ
      r"""Representation of the operator as a product of other operators.
  
      .. math:: O = O_1 O_2 \dots O_n.
  
  
  
      .. seealso:: :meth:`~.ArbitraryStatePreparation.decomposition`.
  
      Args:
          weights (tensor_like): Angles of the Pauli word rotations. Needs to have length :math:`2^{n+1} - 2`
              where :math:`n` is the number of wires the template acts upon.
          wires (Any or Iterable[Any]): wires that the operator acts on
  
      Returns:
          list[.Operator]: decomposition of the operator
  
      **Example**
  
      >>> weights = torch.tensor([1., 2., 3., 4., 5., 6.])
      >>> qml.ArbitraryStatePreparation.compute_decomposition(weights, wires=["a", "b"])
      [PauliRot(tensor(1.), 'XI', wires=['a', 'b']),
       PauliRot(tensor(2.), 'YI', wires=['a', 'b']),
       PauliRot(tensor(3.), 'IX', wires=['a', 'b']),
       PauliRot(tensor(4.), 'IY', wires=['a', 'b']),
       PauliRot(tensor(5.), 'XX', wires=['a', 'b']),
       PauliRot(tensor(6.), 'XY', wires=['a', 'b'])]
      """
      op_list = []
      for i, pauli_word in enumerate(
          _state_preparation_pauli_words(len(wires))
      ):
          op_list.append(
              qml.PauliRot(weights[i], pauli_word, wires=wires)
          )
  
      return op_list
  
file_path: pennylane/pennylane/templates/state_preparations/arbitrary_state_preparation.py
imports: import functools
  import pennylane
  from pennylane.operation import Operation, AnyWires
label_desc: Use image node_id 3 for calling the ArbitraryStatePreparation obj's underlying member method code with example usage: obj.compute_decomposition(weights, wires) and returns: op_list