Closed ziyi-zhang closed 6 months ago
Add the optional flag align_corners to upsample. This is in line with PyTorch upsample.
align_corners
To upsample the following 2D texture (bi-linear interp) to be 5x5
[[1 2] [3 4]]
With align_corners = False (default), the result is
align_corners = False
[[1. 1.1000001 1.5 1.9000001 2.0000002] [1.2 1.3000001 1.7 2.1 2.2000003] [2. 2.1000001 2.5 2.9 3. ] [2.8000002 2.9 3.3 3.6999998 3.8000002] [3. 3.1000004 3.5 3.9 3.9999998]]
With align_corners = True, the result is
align_corners = True
[[1. 1.25 1.5 1.75 2. ] [1.5 1.75 2. 2.25 2.5 ] [2. 2.25 2.5 2.75 3. ] [2.5 2.75 3. 3.25 3.5 ] [3. 3.25 3.5 3.75 4. ]]
Add the optional flag
align_corners
to upsample. This is in line with PyTorch upsample.To upsample the following 2D texture (bi-linear interp) to be 5x5
With
align_corners = False
(default), the result isWith
align_corners = True
, the result is