Fix ifelse crash and gpu support

- [x] fix ifelse crash
- [ ] gpu/cpu support
I would not make the CPU/GPU distinction for node_memory_saved_by_view and node_memory_saved_by_inplace. I  don't think this information is useful.