Fixed GPU detection on CPU only environment (#4711)
### What problem does this PR solve?
Fixed GPU detection on CPU only environment. Close #4692
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
`eval(op_name)` -> `getattr(operators, op_name)`
### What problem does this PR solve?
Using `eval()` can lead to code injections and is entirely unnecessary
here.
### Type of change
- [x] Other (please describe):
Best practice code improvement, preventing the possibility of code
injection.
### What problem does this PR solve?
Added static check at PR CI
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Refactoring