Skip to content

Commit 9962bfb

Browse files
peterbell10facebook-github-bot
authored andcommitted
Remove THTensor (pytorch#69040)
Summary: Pull Request resolved: pytorch#69040 Test Plan: Imported from OSS Reviewed By: anjali411 Differential Revision: D32872478 Pulled By: ngimel fbshipit-source-id: f93e16509d64308d91e374744410a6a811e7f4e3
1 parent 531b045 commit 9962bfb

16 files changed

+3
-175
lines changed

BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ filegroup(
352352
name = "th_srcs",
353353
srcs = [
354354
"aten/src/TH/THGeneral.cpp",
355-
"aten/src/TH/THTensor.cpp",
356355
],
357356
)
358357

aten/src/TH/CMakeLists.txt

-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set(hdr
55

66
set(ATen_TH_SRCS
77
${CMAKE_CURRENT_SOURCE_DIR}/THGeneral.cpp
8-
${CMAKE_CURRENT_SOURCE_DIR}/THTensor.cpp
98
)
109
# Remember that PARENT_SCOPE variables are not in the current scope
1110
set(ATen_TH_SRCS ${ATen_TH_SRCS} PARENT_SCOPE)
@@ -34,13 +33,5 @@ install(FILES
3433
TH.h
3534
${CMAKE_CURRENT_BINARY_DIR}/THGeneral.h
3635
THGenerateByteType.h
37-
THTensor.h
3836
THHalf.h
39-
THTensor.hpp
4037
DESTINATION "${ATEN_INSTALL_INCLUDE_SUBDIR}/TH")
41-
42-
install(FILES
43-
generic/THTensor.cpp
44-
generic/THTensor.h
45-
# See Note [TH abstraction violation]
46-
DESTINATION "${ATEN_INSTALL_INCLUDE_SUBDIR}/TH/generic")

aten/src/TH/TH.h

-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
#define TH_INC
33

44
#include <TH/THGeneral.h>
5-
#include <TH/THTensor.h>
65

76
#endif

aten/src/TH/THTensor.cpp

-22
This file was deleted.

aten/src/TH/THTensor.h

-12
This file was deleted.

aten/src/TH/THTensor.hpp

-21
This file was deleted.

aten/src/TH/generic/THTensor.cpp

-31
This file was deleted.

aten/src/TH/generic/THTensor.h

-30
This file was deleted.

tools/build_variables.bzl

-1
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,6 @@ aten_native_source_non_codegen_list = [
12501250
"aten/src/ATen/native/sparse/SparseUnaryOps.cpp",
12511251
"aten/src/ATen/native/sparse/SparseCsrTensorMath.cpp",
12521252
"aten/src/TH/THGeneral.cpp",
1253-
"aten/src/TH/THTensor.cpp",
12541253
"aten/src/ATen/native/utils/Factory.cpp",
12551254
"aten/src/ATen/native/xnnpack/Activation.cpp",
12561255
"aten/src/ATen/native/xnnpack/ChannelShuffle.cpp",

torch/csrc/PythonTypes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace torch {
77

88
struct THPVoidTensor {
99
PyObject_HEAD
10-
THVoidTensor *cdata;
10+
c10::TensorImpl *cdata;
1111
char device_type;
1212
char data_type;
1313
};

torch/csrc/THP.h

-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <torch/csrc/python_headers.h>
55
#include <TH/TH.h>
6-
#include <TH/THTensor.hpp>
76

87
#include <torch/csrc/Export.h>
98

@@ -17,15 +16,6 @@
1716
#define PyInt_Type PyLong_Type
1817
#endif
1918

20-
// By default, don't specify library state (TH doesn't use one)
21-
#define LIBRARY_STATE
22-
#define LIBRARY_STATE_NOARGS
23-
#define LIBRARY_STATE_TYPE
24-
#define LIBRARY_STATE_TYPE_NOARGS
25-
26-
#define THWTensor THTensor
27-
#define THWTensor_(NAME) THTensor_(NAME)
28-
2919
#include <torch/csrc/Exceptions.h>
3020
#include <torch/csrc/Generator.h>
3121
#include <torch/csrc/Module.h>

torch/csrc/Types.h

-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,4 @@
1010

1111
template <typename T> struct THPTypeInfo {};
1212

13-
namespace torch {
14-
15-
typedef THTensor THVoidTensor;
16-
17-
} // namespace torch
18-
1913
#endif

torch/csrc/cuda/Storage.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include <structmember.h>
55
#include <fmt/format.h>
66

7-
// See Note [TH abstraction violation]
8-
// - Used to get at allocator from storage
9-
#include <TH/THTensor.hpp>
107
#include <torch/csrc/cuda/THCP.h>
118

129
#include <torch/csrc/cuda/override_macros.h>

torch/csrc/cuda/override_macros.h

-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <torch/csrc/cuda/undef_macros.h>
22

33
#define THPStoragePtr THCPStoragePtr
4-
#define THWTensorPtr THCTensorPtr
54
#define THPTensorPtr THCPTensorPtr
65

76
#define THWTensor THCTensor
@@ -39,11 +38,4 @@
3938
#define THSPTensorStateless THCSPTensorStateless
4039

4140

42-
#define LIBRARY_STATE_NOARGS state
43-
#define LIBRARY_STATE state,
44-
#define LIBRARY_STATE_TYPE THCState*,
45-
#define LIBRARY_STATE_TYPE_NOARGS THCState*
4641
#define TH_GENERIC_FILE THC_GENERIC_FILE
47-
48-
#define THHostTensor TH_CONCAT_3(TH,Real,Tensor)
49-
#define THHostTensor_(NAME) TH_CONCAT_4(TH,Real,Tensor_,NAME)

torch/csrc/cuda/undef_macros.h

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
#undef TH_GENERIC_FILE
2-
#undef LIBRARY_STATE
3-
#undef LIBRARY_STATE_NOARGS
4-
#undef LIBRARY_STATE_TYPE
5-
#undef LIBRARY_STATE_TYPE_NOARGS
62

73
#undef THPTensor_
84
#undef THPTensor_stateless_
@@ -21,13 +17,11 @@
2117
#undef THPStorageClass
2218
#undef THPStorageType
2319

24-
#undef THWTensor
25-
#undef THWTensor_
26-
2720
#undef THPStoragePtr
28-
#undef THWTensorPtr
2921
#undef THPTensorPtr
3022

23+
#undef THWTensor
24+
#undef THWTensor_
3125

3226
#undef THSPTensor_
3327
#undef THSPTensor_stateless_
@@ -41,7 +35,3 @@
4135
#undef THSPTensorType
4236

4337
#undef THSPTensorPtr
44-
45-
46-
#undef THHostTensor
47-
#undef THHostTensor_

torch/csrc/utils.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,6 @@ bool maybeThrowBackCompatKeepdimWarn(char *func) {
176176
return true;
177177
}
178178

179-
template<>
180-
void THPPointer<THTensor>::free() {
181-
if (ptr) {
182-
c10::raw::intrusive_ptr::decref(ptr);
183-
}
184-
}
185-
186179
template<>
187180
void THPPointer<THPStorage>::free() {
188181
if (ptr)

0 commit comments

Comments
 (0)