add getGrad function to Cross