tf.contrib.tpu.keras_to_tpu_model
Stay organized with collections
Save and categorize content based on your preferences.
Copy model
along with weights to the TPU. (deprecated)
tf.contrib.tpu.keras_to_tpu_model(
model, strategy=None
)
Returns a TPU model.
Usage:
a = Input(shape=(32,))
b = Dense(32)(a)
model = Model(inputs=a, outputs=b)
# If `num_cores_per_host` is greater than one, batch parallelism will be used
# to run on multiple TPU cores.
strategy = keras_support.TPUDistributionStrategy(tpu_cluster_resolver)
model = keras_support.tpu_model(model, strategy)
model.compile(
optimizer=tf.compat.v1.train.GradientDescentOptimizer(learning_rate=1.0),
...)
Args |
model
|
A tf.keras.Model instance.
|
strategy
|
TPUDistributionStrategy . The strategy to use for replicating
model across multiple TPU cores.
|
Returns |
A new KerasTPUModel instance.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]