You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Estou iniciando agora no DeepXDE e estou com um pouco de dificuldade em entender meu erro. Segui o passo a passo da documentação e o exemplo dele, mas da erro. Segue o Código:
`import deepxde as dde
import matplotlib.pyplot as plt
import numpy as np
x = geom.uniform_points(1000, True)
y = model.predict(x, operator=pde)
plt.figure()
plt.plot(x, y)
plt.xlabel("x")
plt.ylabel("PDE residual")
plt.show()`
O seguinte erro aparece:
"Traceback (most recent call last):
File "d:\import deepxde as dde.py", line 46, in
losshistory, train_state = model.train(iterations=10000)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\utils\internal.py", line 22, in wrapper
result = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 636, in train
self._test()
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 845, in _test
self.train_state.metrics_test = [
^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 846, in
m(self.train_state.y_test, self.train_state.y_pred_test)
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\metrics.py", line 12, in l2_relative_error
return np.linalg.norm(y_true - y_pred) / np.linalg.norm(y_true)
~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Estou iniciando agora no DeepXDE e estou com um pouco de dificuldade em entender meu erro. Segui o passo a passo da documentação e o exemplo dele, mas da erro. Segue o Código:
`import deepxde as dde
import matplotlib.pyplot as plt
import numpy as np
def pde(x, y):
dy_xx = dde.grad.hessian(y,x)
return dy_xx
def boundary1(x, _):
return dde.utils.isclose(x[0], 0)
def boundary2(x, _):
return dde.utils.isclose(x[0], 0.1)
def func1(x):
return 100
def func2(x):
return 20
geom = dde.geometry.Interval(0, 0.1)
bc1 = dde.icbc.DirichletBC(geom, func1, boundary1)
bc2 = dde.icbc.DirichletBC(geom, func2, boundary2)
data = dde.data.PDE(geom, pde, [bc1,bc2], 16, 2, num_test=100)
layer_size = [1] + [50] * 3 + [1]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.nn.FNN(layer_size, activation, initializer)
model = dde.Model(data, net)
model.compile("adam", lr=0.001, metrics=["l2 relative error"])
losshistory, train_state = model.train(iterations=10000)
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
x = geom.uniform_points(1000, True)
y = model.predict(x, operator=pde)
plt.figure()
plt.plot(x, y)
plt.xlabel("x")
plt.ylabel("PDE residual")
plt.show()`
O seguinte erro aparece:
"Traceback (most recent call last):
File "d:\import deepxde as dde.py", line 46, in
losshistory, train_state = model.train(iterations=10000)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\utils\internal.py", line 22, in wrapper
result = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 636, in train
self._test()
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 845, in _test
self.train_state.metrics_test = [
^
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\model.py", line 846, in
m(self.train_state.y_test, self.train_state.y_pred_test)
File "C:\Users\costa\AppData\Roaming\Python\Python311\site-packages\deepxde\metrics.py", line 12, in l2_relative_error
return np.linalg.norm(y_true - y_pred) / np.linalg.norm(y_true)
~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'"
Se alguém puder me ajudar agradeço demais.
Beta Was this translation helpful? Give feedback.
All reactions