write_png¶
- torchvision.io.write_png(input: Tensor, filename: str, compression_level: int = 6)[來源]¶
以 CHW 佈局(若是灰階圖像則為 HW)接收輸入張量,並將其儲存為 PNG 檔案。
- 參數:
input (Tensor[channels, image_height, image_width]) –
c
通道的 int8 圖像張量,其中c
必須為 1 或 3。filename (str 或
pathlib.Path
) – 儲存圖像的路徑。compression_level (int) – 結果檔案的壓縮係數,必須是介於 0 到 9 之間的數字。預設值:6