Two variables being assigned at the same time
There can be two major cases while executing the line img_tensor, label = dataset[0].
Case 1: If dataset[0] has a length of 2. As per comments it would assign the first index of dataset[0] to img_tensor and second index to label.
Case 2: If len(dataset[0]) > 2 or len(dataset[0]) < 2. The line would produce ValueError yelling either "too many values to unpack" or "not enough values to unpack".
It can also result in a TypeError if dataset[0] is not an iterable
There might be other scenarios that are possible depending upon the type of dataset[0].
In python, if there are two variables being assigned a value in the same line, for example here
img_tensor, label = dataset[0]
Where dataset[0] is an array, what is actually going on? What does this do?