Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

部分涉及property的运算存在问题 #169

@zrr1999

Description

@zrr1999
def foo(cond: paddle.Tensor, x: paddle.Tensor):
    x += 1
    return x + x.size


def main():
    cond = paddle.to_tensor(True)
    x = paddle.to_tensor(0)
    dygraph_out = foo(cond, x)
    print("dygraph_out:", dygraph_out)

    symbolic_translate_out = symbolic_translate(foo)(cond, x)
    print("symbolic_translate_out:", symbolic_translate_out)
    np.testing.assert_allclose(
        dygraph_out.numpy(), symbolic_translate_out.numpy()
    )

期望和动态图有相同结果
image

实际上会报错
image

此时如果是 x + x.size() 结果会是正确的,但是动态图会报错(因为x.size是整数)

@SigureMo @2742195759

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions