Hi I am trying to build a Mixture-of-experts neural network. I found a code here: http://blog.sina.com.cn/s/blog_dc3c53e90102x9xu.html. My goal is that the gate and expert come
Well, you need to put tf.multiply() inside a Lambda layer to get a Keras Tensor as output (and not a Tensor):
tf.multiply()
Lambda
output = Lambda(lambda x: tf.multiply(x[0], x[1]))([gate, expert])