示例#1
0
def transform_sum(expr):
    x = only_arg(expr)
    m, n = dims(x)

    if not expr.has_axis:
        return expression.linear_map(linear_map.sum(m, n), transform_expr(x))

    if expr.axis == 0:
        return expression.linear_map(linear_map.sum_left(m, n), transform_expr(x))

    if expr.axis == 1:
        return expression.linear_map(linear_map.sum_right(m, n), transform_expr(x))

    raise TransformError("unknown axis attribute", expr)
示例#2
0
文件: linear.py 项目: mfouda/epsilon
def transform_sum(expr):
    x = only_arg(expr)
    m, n = dims(x)

    if not expr.has_axis:
        return expression.linear_map(linear_map.sum(m, n), transform_expr(x))

    if expr.axis == 0:
        return expression.linear_map(linear_map.sum_left(m, n),
                                     transform_expr(x))

    if expr.axis == 1:
        return expression.linear_map(linear_map.sum_right(m, n),
                                     transform_expr(x))

    raise TransformError("unknown axis attribute", expr)
示例#3
0
文件: linear.py 项目: silky/epsilon
def transform_sum(expr):
    return expression.linear_map(
        linear_map.sum(dim(only_arg(expr))),
        transform_expr(only_arg(expr)))