模型结构里面出现“常数乘以op”的情况导致训练速度变慢
Created by: kebinC
version1:
node_list.append(w * nodes[i])
version2:
var_w = fluid.layers.create_global_var(
shape=[scale, scale],
value=w,
dtype='float32',
persistable=True)
node_list.append(
fluid.layers.elementwise_mul(x=nodes[i], y=var_w))
version1速度要比version2 慢很多