I have an input tensor of shape (5, 2), representing five points in 2D space.
I would like to take the first point, then subtract it from all five points.
Reading around, I figured I can use K.gather to slice and repeat the first layer.
After applying it in a Lambda layer the batch dimension is overwritten:
_input = Input(shape=(5, 2))
x = Reshape((5 * 2,))(_input)
x_ = Lambda(lambda t: K.gather(t, [0, 1] * 5))(x)
results in:
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) (None, 5, 2) 0
__________________________________________________________________________________________________
reshape_1 (Reshape) (None, 10) 0 input_1[0][0]
__________________________________________________________________________________________________
lambda_1 (Lambda) (10, 10) 0 reshape_1[0][0]
__________________________________________________________________________________________________
What am I doing wrong?
Also, is there a simpler way to do this?