Beispiel #1
0
def make_expr_group(*exprs):
    if len(exprs) == 1:
        if isinstance(exprs[0], (list, tuple)):
            exprs = exprs[0]
        elif isinstance(exprs[0], ti.Matrix):
            mat = exprs[0]
            assert mat.m == 1
            exprs = mat.entries
    expr_group = _ti_core.ExprGroup()
    for i in exprs:
        if isinstance(i, ti.Matrix):
            assert i.local_tensor_proxy is not None
            expr_group.push_back(i.local_tensor_proxy)
        else:
            expr_group.push_back(Expr(i).ptr)
    return expr_group
Beispiel #2
0
def make_expr_group(*exprs):
    from taichi.lang.matrix import Matrix  # pylint: disable=C0415
    if len(exprs) == 1:
        if isinstance(exprs[0], (list, tuple)):
            exprs = exprs[0]
        elif isinstance(exprs[0], Matrix):
            mat = exprs[0]
            assert mat.m == 1
            exprs = mat.entries
    expr_group = _ti_core.ExprGroup()
    for i in exprs:
        if isinstance(i, Matrix):
            assert i.local_tensor_proxy is not None
            expr_group.push_back(i.local_tensor_proxy)
        else:
            expr_group.push_back(Expr(i).ptr)
    return expr_group