Syntax of an image tensor

image = generator(to_tensor(codes))[‘image’]

image.shape
output:torch.Size([2, 3, 1024, 1024])

I cannot understand what [‘image’] means in the above line of code.

It seems the generator object returns a Python dict and ['image'] is indexing the 'image' key in this dict.
You could be able to check all keys via:

out = generator(to_tensor(codes))
print(out.keys())

or by checking the forward method.