SparseNN: An Energy-Efficient Neural Network Accelerator Exploiting Input and Output Sparsity