Orthogonal Transformation of Programs for Neural Networks