add dual device support for forwards pass