Reimplemented ElementwiseLayer using only a single scan.