Towards efficient deep neural network inference and training for ubiquitous AI