mindflow.pde.sympy_to_mindspore
- mindflow.pde.sympy_to_mindspore(equations, in_vars, out_vars, params=None)[source]
The sympy expression to create an identifier for mindspore.
- Parameters
equations (dict) – the item in equations contains the key defined by user and the value is sympy expression.
in_vars (list[sympy.core.Symbol]) – list of all input variable symbols, consistent with the dimension of the input data.
out_vars (list[sympy.core.Function]) – list of all output variable symbols, consistent with the dimension of the output data.
params (list[sympy.core.Function]) – list of all parameter variable symbols.
- Returns
List([FormulaNode]), list of expressions node can be identified by mindspore.
- Supported Platforms:
Ascend
GPU
Examples
>>> from mindflow.pde import sympy_to_mindspore >>> from sympy import symbols, Function, diff >>> x, y = symbols('x, y') >>> u = Function('u')(x, y) >>> in_vars = [x, y] >>> out_vars = [u] >>> eq1 = x + y >>> eq2 = diff(u, (x, 1)) + diff(u, (y, 1)) >>> equations = {"eq1": eq1, "eq2": eq2} >>> res = sympy_to_mindspore(equations, in_vars, out_vars) >>> print(len(res)) eq1: x + y Item numbers of current derivative formula nodes: 2 eq2: Derivative(u(x, y), x) + Derivative(u(x, y), y) Item numbers of current derivative formula nodes: 2 2