cleanup unused include (#93359)

Using `include-what-you-use` tool to find out and remove some unused includes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/93359
Approved by: https://github.com/malfet
This commit is contained in:
cyy 2023-02-04 02:15:50 +00:00 committed by PyTorch MergeBot
parent 27efdc5eed
commit fa65ae8f56
29 changed files with 11 additions and 60 deletions

View File

@ -1,7 +1,6 @@
#include <ATen/CPUGeneratorImpl.h> #include <ATen/CPUGeneratorImpl.h>
#include <ATen/Utils.h> #include <ATen/Utils.h>
#include <ATen/core/MT19937RNGEngine.h> #include <ATen/core/MT19937RNGEngine.h>
#include <c10/util/C++17.h>
#include <c10/util/MathConstants.h> #include <c10/util/MathConstants.h>
#include <algorithm> #include <algorithm>

View File

@ -2,18 +2,12 @@
#include <ATen/Context.h> #include <ATen/Context.h>
#include <c10/core/TensorOptions.h>
#include <c10/core/CPUAllocator.h> #include <c10/core/CPUAllocator.h>
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <mutex>
#include <sstream>
#include <stdexcept>
#include <string> #include <string>
#include <thread>
#include <ATen/Tensor.h>
#include <ATen/cpu/FlushDenormal.h> #include <ATen/cpu/FlushDenormal.h>
#ifdef USE_FBGEMM #ifdef USE_FBGEMM

View File

@ -3,7 +3,6 @@
#include <ATen/EmptyTensor.h> #include <ATen/EmptyTensor.h>
#include <ATen/FunctionalTensorWrapper.h> #include <ATen/FunctionalTensorWrapper.h>
#include <ATen/core/LegacyTypeDispatch.h> #include <ATen/core/LegacyTypeDispatch.h>
#include <c10/core/CPUAllocator.h>
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <vector> #include <vector>

View File

@ -1,8 +1,6 @@
#pragma once #pragma once
#include <c10/macros/Macros.h> #include <c10/macros/Export.h>
#include <cstdint>
namespace c10 { namespace c10 {

View File

@ -5,6 +5,7 @@
#include <c10/core/impl/alloc_cpu.h> #include <c10/core/impl/alloc_cpu.h>
#include <c10/mobile/CPUCachingAllocator.h> #include <c10/mobile/CPUCachingAllocator.h>
#include <c10/mobile/CPUProfilingAllocator.h> #include <c10/mobile/CPUProfilingAllocator.h>
#include <c10/util/Logging.h>
// TODO: rename flag to C10 // TODO: rename flag to C10
C10_DEFINE_bool( C10_DEFINE_bool(

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include <cstring> #include <cstring>
#include <mutex>
#include <unordered_map> #include <unordered_map>
#include <c10/core/Allocator.h> #include <c10/core/Allocator.h>
#include <c10/core/alignment.h> // legacy, update dependents to include this directly #include <c10/util/Flags.h>
#include <c10/util/Logging.h>
// TODO: rename to c10 // TODO: rename to c10
C10_DECLARE_bool(caffe2_report_cpu_memory_usage); C10_DECLARE_bool(caffe2_report_cpu_memory_usage);

View File

@ -8,7 +8,6 @@
#include <exception> #include <exception>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <tuple>
#include <vector> #include <vector>
namespace c10 { namespace c10 {

View File

@ -1,8 +1,6 @@
#include <c10/core/DeviceType.h> #include <c10/core/DeviceType.h>
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <atomic> #include <atomic>
#include <memory>
#include <mutex> #include <mutex>
namespace c10 { namespace c10 {

View File

@ -2,11 +2,8 @@
#include <c10/core/DeviceType.h> #include <c10/core/DeviceType.h>
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/ArrayRef.h>
#include <c10/util/Exception.h>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <vector>
namespace c10 { namespace c10 {

View File

@ -1,5 +1,4 @@
#include <c10/core/GeneratorImpl.h> #include <c10/core/GeneratorImpl.h>
#include <chrono>
#include <random> #include <random>
#if defined(__SGX_ENABLED__) #if defined(__SGX_ENABLED__)
@ -9,6 +8,7 @@
#ifndef _WIN32 #ifndef _WIN32
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <chrono>
#endif #endif
namespace c10 { namespace c10 {

View File

@ -1,17 +1,12 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include <atomic>
#include <deque>
#include <mutex> #include <mutex>
#include <typeinfo>
#include <utility>
#include <c10/core/Device.h> #include <c10/core/Device.h>
#include <c10/core/DispatchKeySet.h> #include <c10/core/DispatchKeySet.h>
#include <c10/core/TensorImpl.h> #include <c10/core/TensorImpl.h>
#include <c10/util/C++17.h> #include <c10/macros/Export.h>
#include <c10/util/Exception.h>
#include <c10/util/intrusive_ptr.h> #include <c10/util/intrusive_ptr.h>
#include <c10/util/python_stub.h> #include <c10/util/python_stub.h>

View File

@ -1,7 +1,5 @@
#include <c10/core/GradMode.h> #include <c10/core/GradMode.h>
#include <stdexcept>
namespace c10 { namespace c10 {
bool GradMode::is_enabled() { bool GradMode::is_enabled() {

View File

@ -1,5 +1,4 @@
#include <c10/core/InferenceMode.h> #include <c10/core/InferenceMode.h>
#include <stdexcept>
namespace c10 { namespace c10 {
// Invariant: // Invariant:

View File

@ -1,5 +1,4 @@
#include <c10/core/SafePyObject.h> #include <c10/core/SafePyObject.h>
#include <c10/core/TensorImpl.h>
namespace c10 { namespace c10 {

View File

@ -5,9 +5,6 @@
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/intrusive_ptr.h> #include <c10/util/intrusive_ptr.h>
#include <limits>
#include <memory>
namespace c10 { namespace c10 {
class C10_API SymBool { class C10_API SymBool {

View File

@ -4,11 +4,8 @@
#include <c10/core/SymNodeImpl.h> #include <c10/core/SymNodeImpl.h>
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/intrusive_ptr.h>
#include <memory>
#include <numeric> #include <numeric>
#include <utility>
namespace c10 { namespace c10 {

View File

@ -5,11 +5,6 @@
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/Optional.h> #include <c10/util/Optional.h>
#include <array>
#include <initializer_list>
#include <iterator>
#include <vector>
namespace c10 { namespace c10 {
using SymIntArrayRef = ArrayRef<SymInt>; using SymIntArrayRef = ArrayRef<SymInt>;

View File

@ -5,8 +5,6 @@
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/intrusive_ptr.h> #include <c10/util/intrusive_ptr.h>
#include <memory> #include <memory>
#include <mutex>
#include <vector>
namespace c10 { namespace c10 {

View File

@ -2,8 +2,6 @@
#include <c10/core/SafePyObject.h> #include <c10/core/SafePyObject.h>
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/ArrayRef.h>
#include <c10/util/Optional.h>
namespace c10 { namespace c10 {
namespace impl { namespace impl {

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <atomic>
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>
#include <mutex> #include <mutex>
@ -7,8 +8,6 @@
#include <thread> #include <thread>
#include <utility> #include <utility>
#include <c10/util/Optional.h>
#include <c10/util/intrusive_ptr.h>
#include <c10/util/numa.h> #include <c10/util/numa.h>
#include <c10/util/thread_name.h> #include <c10/util/thread_name.h>

View File

@ -1,4 +1,3 @@
#include <c10/util/Exception.h>
#include <c10/util/StringUtil.h> #include <c10/util/StringUtil.h>
#include <cstring> #include <cstring>

View File

@ -1,3 +1,4 @@
#include <c10/util/Exception.h>
#include <c10/util/ThreadLocal.h> #include <c10/util/ThreadLocal.h>
#include <c10/util/ThreadLocalDebugInfo.h> #include <c10/util/ThreadLocalDebugInfo.h>

View File

@ -1,11 +1,9 @@
#pragma once #pragma once
#include <c10/macros/Export.h> #include <c10/macros/Export.h>
#include <c10/util/Exception.h>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map>
namespace c10 { namespace c10 {

View File

@ -35,7 +35,6 @@
#include <c10/util/int128.h> #include <c10/util/int128.h>
#include <iomanip> #include <iomanip>
#include <ostream> // NOLINT(readability/streams) #include <ostream> // NOLINT(readability/streams)
#include <sstream>
namespace c10 { namespace c10 {

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <c10/util/Logging.h> #include <c10/util/Logging.h>
#include <c10/util/Optional.h>
C10_DECLARE_bool(caffe2_cpu_numa_enabled); C10_DECLARE_bool(caffe2_cpu_numa_enabled);

View File

@ -16,7 +16,6 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <unordered_set>
#ifdef C10_ANDROID #ifdef C10_ANDROID
#ifndef SYS_gettid #ifndef SYS_gettid

View File

@ -4,15 +4,9 @@
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
#if !defined(_MSC_VER)
#include <cxxabi.h>
#endif
using std::string;
namespace caffe2 { namespace caffe2 {
namespace detail { namespace detail {
C10_EXPORT void _ThrowRuntimeTypeLogicError(const string& msg) { C10_EXPORT void _ThrowRuntimeTypeLogicError(const std::string& msg) {
// In earlier versions it used to be std::abort() but it's a bit hard-core // In earlier versions it used to be std::abort() but it's a bit hard-core
// for a library // for a library
TORCH_CHECK(false, msg); TORCH_CHECK(false, msg);

View File

@ -1,5 +1,6 @@
#include <random> #include <random>
#include <c10/core/alignment.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "caffe2/core/context.h" #include "caffe2/core/context.h"
#include "caffe2/proto/caffe2_pb.h" #include "caffe2/proto/caffe2_pb.h"

View File

@ -1,3 +1,4 @@
#include <c10/core/alignment.h>
#include <torch/csrc/jit/runtime/static/memory_planner.h> #include <torch/csrc/jit/runtime/static/memory_planner.h>
#include <ATen/Tensor.h> #include <ATen/Tensor.h>