NNLayer supports sparsity;
also some stylistic modifications to make the NNLayer operations read better and generalize