I’ve tried changing it to
state_out = state.clone().detach()
state_out[:,self.qubits] = torch.matmul(self.U, state[:,self.qubits])
however this still gives the same error. I’ve also tried with just .clone() or .detach()
Unfortunately the matrix multiplication is key here, and torch.bmm won’t work since state is a 5D tensor. Are there other functions i’ve missed?