更新时间:2023-12-02 20:29:46
如果你想在 inp1
和 inp2
张量上应用相同的卷积层,那么你只需要首先创建层,然后在 inp1
和 inp2
上调用它:
If you want to apply the same convolution layer on inp1
and inp2
tensors, then you just need to first create the layer and then call it on inp1
and inp2
:
shared_conv = tf.keras.layers.Conv2D(32, 3, strides=(2,2), padding='same', activation='relu')
out1 = shared_conv(inp1)
out2 = shared_conv(inp2)
请参阅 Keras 文档中的共享层部分更多信息.
See shared layers section in Keras documentation for more information.