Fix PR gh-90

If cause import crash in some cases.
Merge pull request #1275 from nouiz/fix_force_device_cpu

Fix PR gh-90