I am trying to build two qudit CX (d-dim) gate.
There is no issue in the unitary matrix. Please suggest to resolve the error.
_qid_shape_
should return (self.d, self.d)
instead of (self.d * self.d,)
. You're currently asking or one $d^2$-level object instead of two $d$-level objects.
If you specify qid shape, you don't have to specify num qubits.