Unverified Commit 7d831a2f authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Restructuring C++ project: (#3146)

Summary:
* Reduce unnecessary header inclusions in models and io.

* Move autocast to separate folder and hide autograd implementation in an anonymous namespace.

* Moving files in subfolders.

Reviewed By: fmassa

Differential Revision: D25461523

fbshipit-source-id: 756eeb6848aacaa474de4825ed4c1045d17e2cea
parent 4d3a3093
#include "readjpeg_cpu.h"
#include <ATen/ATen.h>
#if !JPEG_FOUND
torch::Tensor decodeJPEG(const torch::Tensor& data, ImageReadMode mode) {
TORCH_CHECK(
false, "decodeJPEG: torchvision not compiled with libjpeg support");
}
#else
#include <jpeglib.h>
#include <setjmp.h>
#include "jpegcommon.h"
#include "../jpegcommon.h"
struct torch_jpeg_mgr {
struct jpeg_source_mgr pub;
......
#pragma once
#include <torch/torch.h>
#include "image_read_mode.h"
#include <torch/types.h>
#include "../image_read_mode.h"
C10_EXPORT torch::Tensor decodeJPEG(
const torch::Tensor& data,
......
#include "readpng_cpu.h"
#include <ATen/ATen.h>
#if !PNG_FOUND
torch::Tensor decodePNG(const torch::Tensor& data, ImageReadMode mode) {
TORCH_CHECK(false, "decodePNG: torchvision not compiled with libPNG support");
......
#pragma once
#include <torch/torch.h>
#include "image_read_mode.h"
#include <torch/types.h>
#include "../image_read_mode.h"
C10_EXPORT torch::Tensor decodePNG(
const torch::Tensor& data,
......
#include "writejpeg_cpu.h"
#include <setjmp.h>
#include <string>
#if !JPEG_FOUND
torch::Tensor encodeJPEG(const torch::Tensor& data, int64_t quality) {
......@@ -11,9 +8,7 @@ torch::Tensor encodeJPEG(const torch::Tensor& data, int64_t quality) {
}
#else
#include <jpeglib.h>
#include "jpegcommon.h"
#include "../jpegcommon.h"
torch::Tensor encodeJPEG(const torch::Tensor& data, int64_t quality) {
// Define compression structures and error handling
......
#pragma once
#include <torch/torch.h>
#include <torch/types.h>
C10_EXPORT torch::Tensor encodeJPEG(const torch::Tensor& data, int64_t quality);
#include "writejpeg_cpu.h"
#include <setjmp.h>
#include <string>
#if !PNG_FOUND
torch::Tensor encodePNG(const torch::Tensor& data, int64_t compression_level) {
......@@ -10,8 +7,8 @@ torch::Tensor encodePNG(const torch::Tensor& data, int64_t compression_level) {
}
#else
#include <png.h>
#include <setjmp.h>
struct torch_mem_encode {
char* buffer;
......
#pragma once
#include <torch/torch.h>
#include <torch/types.h>
C10_EXPORT torch::Tensor encodePNG(
const torch::Tensor& data,
......
#include "image.h"
#include <ATen/ATen.h>
#include <Python.h>
// If we are in a Windows environment, we need to define
......
#pragma once
#include "cpu/read_image_cpu.h"
#include "cpu/read_write_file_cpu.h"
#include "cpu/readjpeg_cpu.h"
#include "cpu/readpng_cpu.h"
#include "cpu/writejpeg_cpu.h"
#include "cpu/writepng_cpu.h"
#if JPEG_FOUND
#include "jpegcommon.h"
#include <string>
#if JPEG_FOUND
void torch_jpeg_error_exit(j_common_ptr cinfo) {
/* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce
* pointer */
......
......@@ -8,7 +8,6 @@
#if JPEG_FOUND
#include <jpeglib.h>
#include <setjmp.h>
#include <string>
static const JOCTET EOI_BUFFER[1] = {JPEG_EOI};
struct torch_jpeg_error_mgr {
......
#pragma once
#include <torch/torch.h>
#include <torch/nn.h>
#include "../macros.h"
namespace vision {
......
#pragma once
#include <torch/torch.h>
#include <torch/nn.h>
#include "../macros.h"
namespace vision {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment