-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
带dropout op的网络预测多次结果不一致 #9144
Labels
User
用于标记用户问题
Comments
查看了下dropout CPU/GPU实现在test阶段的代码,并没发现问题。 进一步debug,对比下每次dropout输入输出是否一样? |
我这边单独测试了下dropout的test mode,测试了test mode下全1输入经过dropout后的输出(最大和最小值),得到的输出感觉是符合预期的,测试代码如下: import numpy as np
import paddle.v2 as paddle
import paddle.fluid as fluid
data_shape = [64, 32, 512]
is_test = True
def program():
x = fluid.layers.data(name='x', shape=data_shape, dtype='float32', append_batch_size=False)
out = fluid.layers.dropout(x, dropout_prob=0.1, is_test=is_test)
return out
def main():
# place = fluid.CPUPlace()
place = fluid.CUDAPlace(0)
exe = fluid.Executor(place)
out = program()
data_input = {}
in_tensor = fluid.LoDTensor()
in_tensor.set(np.ones(data_shape, dtype="float32"), place)
data_input['x'] = in_tensor
for i in range(10):
out_ = exe.run(fluid.framework.default_main_program(), feed=data_input, fetch_list=[out])[0]
print np.max(out_), np.min(out_)
if __name__ == "__main__":
main() 输出如下:
可否再尝试下fetch出来dropout的输入,确认下是否是输入的差异导致的。 |
Related #8654 |
更新了主干,主题中遇到的问题没有再出现,关闭该issue。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
实验条件:
结论:
表1 带dropout op的实验结果
表2 不带dropout op的实验结果
The text was updated successfully, but these errors were encountered: