class_docstr: Tests for the expand_matrix helper function.
class_docstr_tok: ["Tests","for","the","expand_matrix","helper","function","."]
docstr: Expand a single-qubit matrix to two qubits where the
  matrix acts on the latter qubit.
docstr_tok: ["Expand","a","single-qubit","matrix","to","two","qubits","where","the","matrix","acts","on","the","latter","qubit","."]
code: def func_for_autodiff(mat):
      """Expand a single-qubit matrix to two qubits where the
      matrix acts on the latter qubit."""
      return qml.math.expand_matrix(mat, wires=[2], wire_order=[0, 2])
  
imports: from functools import reduce
  import numpy
  import pytest
  from gate_data import CNOT, II, SWAP, I, Toffoli
  from scipy.sparse import csr_matrix
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 8 for calling the TestExpandMatrix obj's underlying member method code with example usage: obj.func_for_autodiff(mat) and returns: qml