output layer grad refactor