Torch.reshape(-1,784) what does the -1 mean?

Hey guys,

if my tensor shape is [128,1,28,28]

and when i call the reshape method .reshape(-1,784)

I get a tensor with the shape [128,784] which is what i want. But I don’t know what the -1 is doing? How does it reshape it like that?

it is a “wildcard”, i.e. auto-calculated single size