at 7:41 in video why we indexed xi by [0], ie in video the following statement was written:
xi = pad_sequences([xi],maxlen=max_len,value=0,padding=‘post’)[0]
why we wrote [0] at the end of this statement?
Doubt in video of making custom data loader in image Capstone Project
Hi @saksham_thukral,
This is because pad_sequences expects a list of sequences as input and returns a 2D matrix. But, we are passing only a single sample and only need a single sample transformed. Hence, we access the first sample of the output (which is also the only one) by using this [0].
Checkout this documentation for more info.
Hope this helps!