The matrix a
has shape (4,3)
and z
has shape (4,)
.
My intent is I want to divide every 3 dim vector in a
with scalar in z
.
Consider the below example:
Input:
a = [[1,1,1],
[2,2,2],
[2,2,2],
[5,5,5]]
z = [10,10,10,5]
Expected Output:
[[.1,.1,.1],
[.2,.2,.2],
[.2,.2,.2],
[1,1,1]]
Below is my attempt to do the same using keras Lambda
layer where K.sum(xin[0], axis=1)
would be a
and xin[1]
would be z
x = Lambda(lambda xin: K.sum(xin[0], axis=1) / xin[1], name='mean')([x1,x2])
But when I run this code, I am getting the following error:
InvalidArgumentError (see above for traceback): Incompatible shapes: [4,3] vs. [4]