May 2019
Intermediate to advanced
272 pages
7h 19m
English
We define a function to log text:
def log_text(texts, name, i, logger): # convert each text to string texts = [str(t) for t in texts] # use a plus sign and new line to mark a new sentence texts = ' +\n'.join(texts) # add them to the logger logger.add_text('{}'.format(name, i), texts, i)
We define a function to log images in a 4 x 4 grid:
def log_images(images, name, i, logger): images = (images.reshape(4, 4, 64, 64, 3) .transpose(0, 2, 1, 3, 4) .reshape(4*64, 4*64, 3)) images = ((images + 1) * 0.5) logger.add_image('{}'.format(name, i), images, i, dataformats='HWC')
Read now
Unlock full access