From e055979dcf5111bcd34ddd0164e014b239dae3fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=BF=8A=E5=87=A1?= Date: Sun, 23 Aug 2026 17:39:41 +0800 Subject: [PATCH] Replace deprecated v2.ToTensor() with v2.ToImage() + v2.ToDtype(scale=True) v2.ToTensor() has emitted a UserWarning on construction since torchvision 0.15. Use the officially recommended replacement (output equivalent up to float precision). Co-Authored-By: Claude --- Matrix-Game-2/inference.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Matrix-Game-2/inference.py b/Matrix-Game-2/inference.py index f4df03b..3201b6d 100644 --- a/Matrix-Game-2/inference.py +++ b/Matrix-Game-2/inference.py @@ -40,7 +40,8 @@ def __init__(self, args): self.frame_process = v2.Compose([ v2.Resize(size=(352, 640), antialias=True), - v2.ToTensor(), + v2.ToImage(), + v2.ToDtype(torch.float32, scale=True), v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]), ])