write_png¶
- torchvision.io.write_png(input: Tensor, filename: str, compression_level: int = 6)[原始碼]¶
接收一個 CHW 佈局(灰度影像為 HW 佈局)的輸入張量,並將其儲存為 PNG 檔案。
- 引數:
input (Tensor[通道數, 影像高度, 影像寬度]) –
c通道的 int8 影像張量,其中c必須為 1 或 3。filename (str 或
pathlib.Path) – 儲存影像的路徑。compression_level (int) – 生成檔案的壓縮因子,必須是 0 到 9 之間的數字。預設為 6