Replies: 1 comment 1 reply
-
Check the example of inverse PDE problems. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to solve the equation of tv denoising, there is one item in the loss function that is u-u_0, this u_0 is a noisy image, an array. I don't know how to deal with this situation (I am wondering if I want to convert u_0 into a function when I def pde?)
`x = np.arange(noise_image.shape[0])
y = np.arange(noise_image.shape[1])
func = RegularGridInterpolator((x, y), noise_image, method='linear')
def pde(x, u): #x=(x1,x2,t)
du_dx1 = dde.grad.jacobian(u, x, j=0)
du_dx2 = dde.grad.jacobian(u, x, j=1)
du_t = dde.grad.jacobian(u, x, j=2)
grad_u = tf.concat([du_dx1, du_dx2], axis=-1)
norm_grad_u = tf.norm(grad_u, axis=-1, keepdims=True) # 梯度的模
v1 = du_dx1 / norm_grad_u
v2 = du_dx2 / norm_grad_u
dv1_dx1 = dde.grad.jacobian(v1, x, j=0)
dv2_dx2 = dde.grad.jacobian(v2, x, j=1)
w = -(u-func)
return du_t - dv1_dx1-dv2_dx2 + w`
I get a typeerror:
TypeError: Expected float32 passed to parameter 'y' of op 'Sub', got <scipy.interpolate._rgi.RegularGridInterpolator object at 0x00000215AD5F00A0> of type 'RegularGridInterpolator' instead. Error: Expected float32, but got <scipy.interpolate._rgi.RegularGridInterpolator object at 0x00000215AD5F00A0> of type 'RegularGridInterpolator'.
Beta Was this translation helpful? Give feedback.
All reactions