models
models copied to clipboard
Resnet 中 elementwise_add 的顺序影响显存大小?
使用 Resnet 训练分类模型,发现 elementwise_add layer 中变量x 和 y 的顺序会影响 10% 以上。
return fluid.layers.elementwise_add(x=short, y=conv2, act='relu',name=name+".add.output.5")
return fluid.layers.elementwise_add(x=short, y=conv1, act='relu')
修改为:
return fluid.layers.elementwise_add(x=conv2, y=short, act='relu',name=name+".add.output.5")
return fluid.layers.elementwise_add(x=conv2, y=short, act='relu')
显存占用从 5.3 G 降低到 4.8 G,请问是因为影响了显存复用导致的吗?

使用 Resnet 训练分类模型,发现
elementwise_addlayer 中变量x和y的顺序会影响 10% 以上。return fluid.layers.elementwise_add(x=short, y=conv2, act='relu',name=name+".add.output.5") return fluid.layers.elementwise_add(x=short, y=conv1, act='relu')修改为:
return fluid.layers.elementwise_add(x=conv2, y=short, act='relu',name=name+".add.output.5") return fluid.layers.elementwise_add(x=conv2, y=short, act='relu')显存占用从 5.3 G 降低到 4.8 G,请问是因为影响了显存复用导致的吗?
您好,这个的确是因为显存复用导致的。 我们正在测试我们的内存/显存garbage collection功能,后续版本启用之后,这个问题就不会再有了。