Skip to content

Conversation

@Aurelius84
Copy link
Contributor

@Aurelius84 Aurelius84 commented Mar 26, 2021

PR types

Bug fixes

PR changes

APIs

Describe

Fix segment Fault from set_value

背景

set_value 在 append_op时,始终是根据self.block进行添加的,这导致在 sub_block中 inplace 修改一个来自 global_block 的 var 会出现 op 误塞到 global_block中,导致提前非法访问了子block中未经初始化的Tensor,出现segmention Faule,引起极度难以排查的bug。

一个触发bug的样例:

# while_loop
def cond(i, x):
    return i < 1

def body(i, x):
    x[i] = self.value
    i = i+1
    return i, x

i = paddle.zeros(shape=(1,), dtype='int32')
i, x = paddle.fluid.layers.while_loop(cond, body, [i, x])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@liym27 liym27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aurelius84 Aurelius84 merged commit c4b60ef into PaddlePaddle:develop Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants