forked from pytorch/vision
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of mode and remove channels (pytorch#3024)
* Add support of mode and remove channels. * Replacing integer mode with define constants.
- Loading branch information
Showing
9 changed files
with
151 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
/* Should be kept in-sync with Python ImageReadMode enum */ | ||
using ImageReadMode = int64_t; | ||
#define IMAGE_READ_MODE_UNCHANGED 0 | ||
#define IMAGE_READ_MODE_GRAY 1 | ||
#define IMAGE_READ_MODE_GRAY_ALPHA 2 | ||
#define IMAGE_READ_MODE_RGB 3 | ||
#define IMAGE_READ_MODE_RGB_ALPHA 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#pragma once | ||
|
||
#include "readjpeg_cpu.h" | ||
#include "readpng_cpu.h" | ||
#include <torch/torch.h> | ||
#include "image_read_mode.h" | ||
|
||
C10_EXPORT torch::Tensor decode_image( | ||
const torch::Tensor& data, | ||
int64_t channels = 0); | ||
ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#pragma once | ||
|
||
#include <torch/torch.h> | ||
#include "image_read_mode.h" | ||
|
||
C10_EXPORT torch::Tensor decodeJPEG( | ||
const torch::Tensor& data, | ||
int64_t channels = 0); | ||
ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
#pragma once | ||
|
||
// Comment | ||
#include <torch/torch.h> | ||
#include <string> | ||
#include "image_read_mode.h" | ||
|
||
C10_EXPORT torch::Tensor decodePNG( | ||
const torch::Tensor& data, | ||
int64_t channels = 0); | ||
ImageReadMode mode = IMAGE_READ_MODE_UNCHANGED); |
Oops, something went wrong.