Zijian Kang
commited on
Update modeling_sailvl.py
Browse files- modeling_sailvl.py +2 -2
modeling_sailvl.py
CHANGED
|
@@ -191,11 +191,11 @@ class SailVLModel(PreTrainedModel):
|
|
| 191 |
def pixel_shuffle(self, x, scale_factor=0.5):
|
| 192 |
n, w, h, c = x.size()
|
| 193 |
# N, W, H, C --> N, W, H * scale, C // scale
|
| 194 |
-
x = x.
|
| 195 |
# N, W, H * scale, C // scale --> N, H * scale, W, C // scale
|
| 196 |
x = x.permute(0, 2, 1, 3).contiguous()
|
| 197 |
# N, H * scale, W, C // scale --> N, H * scale, W * scale, C // (scale ** 2)
|
| 198 |
-
x = x.
|
| 199 |
int(c / (scale_factor * scale_factor)))
|
| 200 |
if self.ps_version == 'v1':
|
| 201 |
warnings.warn("In ps_version 'v1', the height and width have not been swapped back, "
|
|
|
|
| 191 |
def pixel_shuffle(self, x, scale_factor=0.5):
|
| 192 |
n, w, h, c = x.size()
|
| 193 |
# N, W, H, C --> N, W, H * scale, C // scale
|
| 194 |
+
x = x.reshape(n, w, int(h * scale_factor), int(c / scale_factor))
|
| 195 |
# N, W, H * scale, C // scale --> N, H * scale, W, C // scale
|
| 196 |
x = x.permute(0, 2, 1, 3).contiguous()
|
| 197 |
# N, H * scale, W, C // scale --> N, H * scale, W * scale, C // (scale ** 2)
|
| 198 |
+
x = x.reshape(n, int(h * scale_factor), int(w * scale_factor),
|
| 199 |
int(c / (scale_factor * scale_factor)))
|
| 200 |
if self.ps_version == 'v1':
|
| 201 |
warnings.warn("In ps_version 'v1', the height and width have not been swapped back, "
|