Initialize gradient vector on device