Create variables on correct devices and with correct types#292
Create variables on correct devices and with correct types#292
Conversation
Codecov Report
@@ Coverage Diff @@
## master #292 +/- ##
==========================================
- Coverage 93.35% 91.02% -2.34%
==========================================
Files 33 33
Lines 2289 2284 -5
==========================================
- Hits 2137 2079 -58
- Misses 152 205 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Great fix!
- For BRISQUE, '_natural_scene_statistics' uses gaussian kernel (line 178), which is generated as 'torch.FloatTensor' losing the precision for 'torch.DoubleTensor' input. I suggest to propagate type into the kernel generation or use 'torch.float64' as default for generating kernels.
- For DSS, I suggest type assignment in line 90 to avoid implicit type upgrade in following loop. Function '_dct_matrix' and ‘gaussian_fliter’ produce 'torch.FloatTensor's losing the precision if 'torch.DoubleTensor's are used as the input. Therefore, I suggest, to add type propagation inside.
- For FSIM, '_lowpassfilter' amd ‘scharr_filter’ are 'torch.FloatTensor'. Similar suggestion to the previous. Propagate types or generate 'torch.float64' as default with following reduction to 'torch.float32'. Same for ‘_construct_filters’ in lines 154-158.
- For MS-SSIM and SSIM, we use gaussian filter, generated using ‘torch.FloatTensor’ in line 73 (MS-ssim) and in line 64 (SSIM).
- For VSI, ‘scharr_filter’ and ‘_log_gabor’ are generated as ‘torch.FloatTensor’.
- For other functionality, that wasn't changed with presented commits, could contain same issues.
Concluding on the above, ‘functional/filters.py’ could be upgraded to ‘torch.float64’ as default precision, which could be reduces after.
|
Kudos, SonarCloud Quality Gate passed!
|
|
As discussed with Denis and Sergei, we won't create kernels as Reasoning: This PR adds support for float64 input inference and slight loss of precision due to kernel's dtype is not considered important. @denproc please review again and merge. |








Related to #288
Proposed Changes