image.cpp 768 Bytes
Newer Older
1
#include "image.h"
2

3
4
5
6
7
8
9
10
11
12
13
#include <Python.h>

// If we are in a Windows environment, we need to define
// initialization functions for the _custom_ops extension
#ifdef _WIN32
PyMODINIT_FUNC PyInit_image(void) {
  // No need to do anything.
  return NULL;
}
#endif

14
15
static auto registry = torch::RegisterOperators()
                           .op("image::decode_png", &decodePNG)
16
                           .op("image::encode_png", &encodePNG)
17
18
                           .op("image::decode_jpeg", &decodeJPEG)
                           .op("image::encode_jpeg", &encodeJPEG)
Francisco Massa's avatar
Francisco Massa committed
19
                           .op("image::read_file", &read_file)
Francisco Massa's avatar
Francisco Massa committed
20
                           .op("image::write_file", &write_file)
Francisco Massa's avatar
Francisco Massa committed
21
                           .op("image::decode_image", &decode_image);