Skip to content

Commit cbbd0b7

Browse files
committed
save_images / [batch, h, w] --> [batch, h, w, 1]
1 parent 277f819 commit cbbd0b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tensorlayer/visualize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ def save_images(images, size, image_path=''):
7676
>>> images = np.random.rand(64, 100, 100, 3)
7777
>>> tl.visualize.save_images(images, [8, 8], 'temp.png')
7878
"""
79-
79+
if len(images.shape) == 3: # Greyscale [batch, h, w] --> [batch, h, w, 1]
80+
images = images[:,:,:,np.newaxis]
81+
8082
def merge(images, size):
8183
h, w = images.shape[1], images.shape[2]
8284
img = np.zeros((h * size[0], w * size[1], 3))

0 commit comments

Comments
 (0)