mindflow.pde.Burgers

class mindflow.pde.Burgers(model, loss_fn='mse')[源代码]

基于PDEWithLoss定义的一维Burgers方程求解问题。

参数:
  • model (mindspore.nn.Cell) - 用于训练的网络模型。

  • loss_fn (Union[str, Cell]) - 损失函数。默认值: "mse"

支持平台:

Ascend GPU

样例:

>>> from mindflow.pde import Burgers
>>> from mindspore import nn, ops
>>> class Net(nn.Cell):
...     def __init__(self, cin=2, cout=1, hidden=10):
...         super().__init__()
...         self.fc1 = nn.Dense(cin, hidden)
...         self.fc2 = nn.Dense(hidden, hidden)
...         self.fcout = nn.Dense(hidden, cout)
...         self.act = ops.Tanh()
...
...     def construct(self, x):
...         x = self.act(self.fc1(x))
...         x = self.act(self.fc2(x))
...         x = self.fcout(x)
...         return x
>>> model = Net()
>>> problem = Burgers(model)
>>> print(problem.pde())
burgers: u(x, t)Derivative(u(x, t), x) + Derivative(u(x, t), t) - 0.00318309897556901Derivative(u(x, t), (x, 2))
Item numbers of current derivative formula nodes: 3
{'burgers': u(x, t)Derivative(u(x, t), x) + Derivative(u(x, t), t) - 0.00318309897556901Derivative(u(x, t),
(x, 2))}
pde()[源代码]

抽象方法,基于sympy定义的一维Burgers控制方程。

返回:

dict,自定义sympy符号方程。