deepxde icon indicating copy to clipboard operation
deepxde copied to clipboard

Cannot convert a symbolic tf.Tensor (Placeholder_6:0) to a numpy array

Open yuan743470957 opened this issue 10 months ago • 4 comments

def pde2(x, y):
    dy_x = dde.grad.jacobian(y, x, i=0, j=0)
    dy_t = dde.grad.jacobian(y, x, i=0, j=1)
    dy_xx = dde.grad.hessian(y, x, i=0, j=0)
    y_pred_value = model.predict(x)
    return dy_t + y_pred_value * dy_x - 0.01 / np.pi * dy_xx

NotImplementedError: Cannot convert a symbolic tf.Tensor (Placeholder_6:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported.

yuan743470957 avatar Apr 28 '24 10:04 yuan743470957

This is the problem.

y_pred_value = model.predict(x)

Can you show me your PDE please?

praksharma avatar May 02 '24 11:05 praksharma

def pde(x, y):
    dy_x = dde.grad.jacobian(y, x, i=0, j=0)
    dy_t = dde.grad.jacobian(y, x, i=0, j=1)

    dy_xx = dde.grad.hessian(y, x, i=0, j=0)
    return  dy_t + y * dy_x - 0.01 / np.pi * dy_xx

yuan743470957 avatar May 07 '24 22:05 yuan743470957

You cannot use model.predict in PDE definition.

lululxvi avatar Jun 22 '24 21:06 lululxvi

You cannot use model.predict in PDE definition.

I want to use two networks, where the prediction value of one network appears in the loss function of the other network. How should I write the code for this

yuan743470957 avatar Jun 23 '24 00:06 yuan743470957