First i changed the pytoch version from 0.4.0 to 1.1.0
Then i started getting error like

RuntimeError: value cannot be converted to type float without overflow:

step_size was coming as complex for me. Changing it to np.real(step_size) helpe me to resolve this.