
397
10
장
케라스를 사용한 인공 신경망 소개
test_logdir = get_run_logdir()
writer = tf.summary.create_file_writer(test_logdir)
with writer.as_default():
for step in range(1, 1000 + 1):
tf.summary.scalar("my_scalar", np.sin(step / 10), step=step)
data = (np.random.randn(100) + 2) * step / 100
# 몇몇 랜덤 데이터
tf.summary.histogram("my_hist", data, buckets=50, step=step)
images = np.random.rand(2, 32,
32, 3)
# 32×32 RGB 이미지
tf.summary.image("my_images", images * step / 1000, step=step)
texts = ["The step is " + str(step), "Its square is " + str(step**2)]
tf.summary.text("my_text", texts, step=step)
sine_wave = tf.math.sin(tf.range(12000) / 48000 * 2 * np.pi * step)
audio ...