Computing frustration and near-monotonicity in deep neural networks