ktrk115 commited on
Commit
a5db638
1 Parent(s): 5b3f018

Upload image_processing_vqmodel.py

Browse files
Files changed (1) hide show
  1. image_processing_vqmodel.py +2 -1
image_processing_vqmodel.py CHANGED
@@ -51,7 +51,8 @@ class VQModelImageProcessor(BaseImageProcessor): # type: ignore
51
  width: int | None = None,
52
  height: int | None = None,
53
  ) -> Image.Image:
54
- x_np = x.numpy().transpose(1, 2, 0)
 
55
  x_np = (x_np + 1.0) * 127.5
56
  x_np = np.clip(x_np, 0, 255).astype(np.uint8)
57
  image = Image.fromarray(x_np)
 
51
  width: int | None = None,
52
  height: int | None = None,
53
  ) -> Image.Image:
54
+ x_np = x.detach().cpu().numpy()
55
+ x_np = x_np.transpose(1, 2, 0)
56
  x_np = (x_np + 1.0) * 127.5
57
  x_np = np.clip(x_np, 0, 255).astype(np.uint8)
58
  image = Image.fromarray(x_np)