I am using the tensorflow2 and using scipy minimize, my code as following
x_init=float(1/500) xopti=tf.fill([p,1],x_init) d