added multi layer gradient computation; scaleout version for new gradient parameter avging coming next