implemented layer size independent forward propagation