【发布时间】:2020-12-18 14:21:34
【问题描述】:
在这里的代码中: https://www.kaggle.com/ryanholbrook/detecting-the-higgs-boson-with-tpus
在编译模型之前,使用以下代码制作模型:
with strategy.scope():
# Wide Network
wide = keras.experimental.LinearModel()
# Deep Network
inputs = keras.Input(shape=[28])
x = dense_block(UNITS, ACTIVATION, DROPOUT)(inputs)
x = dense_block(UNITS, ACTIVATION, DROPOUT)(x)
x = dense_block(UNITS, ACTIVATION, DROPOUT)(x)
x = dense_block(UNITS, ACTIVATION, DROPOUT)(x)
x = dense_block(UNITS, ACTIVATION, DROPOUT)(x)
outputs = layers.Dense(1)(x)
deep = keras.Model(inputs=inputs, outputs=outputs)
# Wide and Deep Network
wide_and_deep = keras.experimental.WideDeepModel(
linear_model=wide,
dnn_model=deep,
activation='sigmoid',
)
我不明白with strategy.scope() 在这里做了什么,以及它是否会以任何方式影响模型。它具体是做什么的?
将来我怎么能弄清楚这是做什么的?我需要研究哪些资源才能解决这个问题?
【问题讨论】:
标签: tensorflow tensorflow2.0 tpu