@chenchr: Thanks for your  suggestion. I could solve the problem using Smith’s method. But this alternative solution also helped me to understand performance of “unsqueeze”  better. I’m still new to pytorch. So taking sometime to grab the new concepts.