I am using Keras to build a Network. During the process, I need a layer, which takes an LSTM input, doing nothing, just output exactly the same as input. i.e. if each input record of LSTM is like [[A_t1, A_t2, A_t3, A_t4, A_t5, A_t6]], I am looking for a layer:
我正在使用Keras建立一个网络。在这个过程中,我需要一个层,它接受LSTM输入,什么也不做,只输出与输入完全相同。即如果LSTM的每个输入记录都像[[A_t1,A_t2,A_t3,A_t4,A_t5,A_t6]]那样,我正在寻找一个层:
model.add(SomeIdentityLayer(x))
SomeIdentityLayer(x) will take [[A_t1, A_t2, A_t3, A_t4, A_t5, A_t6]]
as input and output [[A_t1, A_t2, A_t3, A_t4, A_t5, A_t6]]
. Is such layer/structure available in Keras? Thanks!
SomeIdentityLayer(x)将[[A_t1,A_t2,A_t3,A_t4,A_t5,A_t6]]作为输入和输出[[A_t1,A_t2,A_t3,A_t4,A_t5,A_t6]]。 Keras有这样的层/结构吗?谢谢!
1 个解决方案
#1
1
For a simpler operation like identity, you can just use a Lambda layer like:
对于像identity这样的简单操作,您可以使用Lambda层,如:
model.add(Lambda(lambda x: x))
model.add(Lambda(lambda x:x))
This will return an output exactly the same as your input.
这将返回与输入完全相同的输出。
#1
1
For a simpler operation like identity, you can just use a Lambda layer like:
对于像identity这样的简单操作,您可以使用Lambda层,如:
model.add(Lambda(lambda x: x))
model.add(Lambda(lambda x:x))
This will return an output exactly the same as your input.
这将返回与输入完全相同的输出。