共享层

使用 Keras 的高级深度学习

Zach Deane Mayer

Data Scientist

共享层

  • 需要使用函数式 API
  • 非常灵活

使用 Keras 的高级深度学习

共享层

input_tensor_1 = Input((1,))
input_tensor_2 = Input((1,))

使用 Keras 的高级深度学习

共享层

shared_layer = Dense(1)
output_tensor_1 = shared_layer(input_tensor_1)
output_tensor_2 = shared_layer(input_tensor_2)

使用 Keras 的高级深度学习

将多层作为模型共享

input_tensor = Input(shape=(1,))
n_teams = 10887
embed_layer = Embedding(input_dim=n_teams,
                        input_length=1,
                        output_dim=1,
                        name='Team-Strength-Lookup')
embed_tensor = embed_layer(input_tensor)
flatten_tensor = Flatten()(embed_tensor)
model = Model(input_tensor, flatten_tensor)
input_tensor_1 = Input((1,))
input_tensor_2 = Input((1,))
output_tensor_1 = model(input_tensor_1)
output_tensor_2 = model(input_tensor_2)
使用 Keras 的高级深度学习

将多层作为模型共享

使用 Keras 的高级深度学习

让我们练习!

使用 Keras 的高级深度学习

Preparing Video For Download...