Enhancing the Security and Reliability of Deep Learning Systems under Attacks and Hardware Faults