It looks like there is an n_channels member of the Unet class that is defined but never used, and in_channels is defined when the Unet is created (this value seems like it is set to 4). However, the input has only a single channel? I would check how these parameters are used and whether the input data is correct because the shape seems very strange.