部分代码:

output3d = Dense(5*2, name='imediate_2d', activation='tanh')(output2d)
def f(x):
    # there are 10 numbers in input. 10 numbers are position information for 5 points.
    # this function should return a 32*32 heatmap, where some positions are labelled as 1.
    pass

proj_out = Lambda(lambda x:f(x), output_shape=(None, 32, 32), name='projection')(output2d)

我需要完成一个Keras自定义图层 . 输入为5(x,y) - 坐标为5点 . 我需要返回32 * 32的热图 . 但我是Keras的新手 . 如何填写上面的 f 函数 . 欢迎任何教程或提示 . 谢谢

UPDATE

我整夜搜索,输入 x 到Lambda图层是 tensor ,我不知道如何处理 . 我需要的是复杂的,所以我没有在keras / tensorflow文档中找到任何提示 . 任何想法怎么做?谢谢