In Week4 assignment, I successfully trained the model and see the generated 31 images
I selected 16 images and then run the sample code you have for zipping those images
from PIL import Image
from zipfile import ZipFile
denormalized_images = grading_images * 255
denormalized_images = tf.dtypes.cast(denormalized_images, dtype = tf.uint8)
file_paths = []
for this_image in range(0,16):
i = tf.reshape(denormalized_images[this_image], [28,28])
im = Image.fromarray(i.numpy())
im = im.convert("L")
filename = "hand" + str(this_image) + ".png"
file_paths.append(filename)
im.save(filename)
with ZipFile('my-signs.zip', 'w') as zip:
for file in file_paths:
zip.write(file)
But this gives me error in this line i = tf.reshape(denormalized_images[this_image], [28,28])
and says that
InvalidArgumentError: Input to reshape is a tensor with 1 values, but the requested shape has 784 [Op:Reshape]
What am I missing?