def _create_vec_field(fval, gradf, d1x, d2x, color_axis, smooth=<NUM_LIT:0>):
if color_axis == <NUM_LIT:2>:<EOL><INDENT>gradf = _transpose_image(gradf)<EOL><DEDENT>c, h, w = gradf.shape  <EOL>alpha1 = np.sum(gradf * d1x, axis=<NUM_LIT:0>)<EOL>alpha2 = np.sum(gradf * d2x, axis=<NUM_LIT:0>)<EOL>norm_squared_alpha = (alpha1 ** <NUM_LIT:2>).sum() + (alpha2 ** <NUM_LIT:2>).sum()<EOL>if smooth > <NUM_LIT:0>:<EOL><INDENT>alpha1 = gaussian_filter(alpha1, smooth)<EOL>alpha2 = gaussian_filter(alpha2, smooth)<EOL>norm_squared_alpha = (alpha1 ** <NUM_LIT:2>).sum() + (alpha2 ** <NUM_LIT:2>).sum()<EOL>alpha1 = gaussian_filter(alpha1, smooth)<EOL>alpha2 = gaussian_filter(alpha2, smooth)<EOL><DEDENT>vec_field = np.empty((h, w, <NUM_LIT:2>))<EOL>vec_field[:, :, <NUM_LIT:0>] = -fval * alpha1 / norm_squared_alpha<EOL>vec_field[:, :, <NUM_LIT:1>] = -fval * alpha2 / norm_squared_alpha<EOL>return vec_field<EOL>
Calculate the deformation vector field
    In:
    fval: float
    gradf: numpy.ndarray
        of shape C x h x w with C = 3 or C = 1
        (color channels), h, w >= 1.
    d1x: numpy.ndarray
        of shape C x h x w and [type] = 'Float' or 'Double'.
    d2x: numpy.ndarray
        of shape C x h x w and [type] = 'Float' or 'Double'.
    smooth: float
        Width of the Gaussian kernel used for smoothing
        (default is 0 for no smoothing).
    Out:
    vec_field: numpy.ndarray
        of shape (2, h, w).