def eltwise(layer, layer_in, layerId):
out = {}
if (layer['params']['layer_type'] == 'Multiply'):
# This input reverse is to handle visualization
out[layerId] = multiply(layer_in[::-1])
elif (layer['params']['layer_type'] == 'Sum'):
out[layerId] = add(layer_in[::-1])
elif (layer['params']['layer_type'] == 'Average'):
out[layerId] = average(layer_in[::-1])
elif (layer['params']['layer_type'] == 'Dot'):
out[layerId] = dot(layer_in[::-1], -1)
else:
out[layerId] = maximum(layer_in[::-1])
return out
评论列表
文章目录