mindflow.pde.Poisson
- class mindflow.pde.Poisson(model, loss_fn='mse')[source]
Base class for Poisson 2-D problem based on PDEWithLoss.
- Parameters
model (mindspore.nn.Cell) – network for training.
loss_fn (Union[str, Cell]) – Define the loss function. Default:
"mse"
.
- Supported Platforms:
Ascend
GPU
Examples
>>> from mindflow.pde import Poisson >>> 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 = Poisson(model) >>> print(problem.pde()) poisson: Derivative(u(x, y), (x, 2)) + Derivative(u(x, y), (y, 2)) + 1.0 Item numbers of current derivative formula nodes: 3 {'poisson': Derivative(u(x, y), (x, 2)) + Derivative(u(x, y), (y, 2)) + 1.0}