简介 + 设置
TFRecords 存储一系列二进制记录,线性读取。它们是存储数据的有用格式,因为它们可以有效地读取。在此处了解有关 TFRecords 的更多信息 。
我们将探索如何轻松加载黑色素瘤分类器的 TFRecords。
import tensorflow as tf
from functools import partial
import matplotlib.pyplot as plttry:tpu = tf.distribute.cluster_resolver.TPUClusterResolver.connect()print("Device:", tpu.master())strategy = tf.distribute.TPUStrategy(tpu)
except:strategy = tf.distribute.get_strategy()
print("Number of replicas:", strategy.num_replicas_in_sync)