@@ -57,7 +57,7 @@ def show_images_and_labels(images,
5757 The matplotlib figure with the plotted info.
5858 """
5959 if images is not None and labels is None :
60- if is_array_like (images [0 ]):
60+ if is_array_like (images [0 ], no_list = True ):
6161 if images [0 ].ndim >= 3 :
6262 images , labels = images [0 ], images [1 ]
6363 else :
@@ -82,8 +82,9 @@ def show_images_and_labels(images,
8282
8383 # Check if the labels are converted to one-hot, and re-convert them back.
8484 if is_array_like (labels ):
85- if labels .ndim == 2 : # noqa
86- labels = np .argmax (labels , axis = - 1 )
85+ if not isinstance (labels , (list , tuple )):
86+ if labels .ndim == 2 : # noqa
87+ labels = np .argmax (labels , axis = - 1 )
8788
8889 # If a prime number is passed, e.g. 23, then the `_inference_best_shape`
8990 # method will return the shape of (23, 1). Likely, the user is expecting
@@ -118,7 +119,7 @@ def show_images_and_labels(images,
118119 # Display and return the image.
119120 image = convert_figure_to_image ()
120121 if not kwargs .get ('no_show' , False ):
121- display_image (image )
122+ _ = display_image (image )
122123 return image
123124
124125
0 commit comments