Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions aten/src/ATen/Declarations.cwrap
Original file line number Diff line number Diff line change
Expand Up @@ -2063,11 +2063,6 @@
]]
[[
name: neg
types:
- floating_point
- Long
- Int
- Short
backends:
- CPU
- CUDA
Expand All @@ -2084,11 +2079,6 @@
]]
[[
name: neg_
types:
- floating_point
- Long
- Int
- Short
backends:
- CPU
- CUDA
Expand Down
5 changes: 2 additions & 3 deletions aten/src/TH/generic/THTensorMath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2995,14 +2995,14 @@ TENSOR_IMPLEMENT_LOGICAL(ne,!=)
} \
}

LAB_IMPLEMENT_BASIC_FUNCTION(neg,-)

#if defined(TH_REAL_IS_LONG)
LAB_IMPLEMENT_BASIC_FUNCTION(abs,labs)
LAB_IMPLEMENT_BASIC_FUNCTION(neg,-)
#endif /* int64_t only part */

#if defined(TH_REAL_IS_SHORT) || defined(TH_REAL_IS_INT)
LAB_IMPLEMENT_BASIC_FUNCTION(abs,abs)
LAB_IMPLEMENT_BASIC_FUNCTION(neg,-)
#endif /* int only part */

#if defined(TH_REAL_IS_BYTE)
Expand Down Expand Up @@ -3053,7 +3053,6 @@ LAB_IMPLEMENT_BASIC_FUNCTION(round,TH_MATH_NAME(round))
LAB_IMPLEMENT_BASIC_FUNCTION(abs,TH_MATH_NAME(fabs))
LAB_IMPLEMENT_BASIC_FUNCTION(trunc,TH_MATH_NAME(trunc))
LAB_IMPLEMENT_BASIC_FUNCTION(frac,TH_MATH_NAME(TH_frac))
LAB_IMPLEMENT_BASIC_FUNCTION(neg,-)
LAB_IMPLEMENT_BASIC_FUNCTION(cinv, TH_MATH_NAME(1.0) / )


Expand Down
5 changes: 1 addition & 4 deletions aten/src/TH/generic/THVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ TH_API void THVector_(muls)(real *y, const real *x, const real c, const ptrdiff_
TH_API void THVector_(cdiv)(real *z, const real *x, const real *y, const ptrdiff_t n);
TH_API void THVector_(divs)(real *y, const real *x, const real c, const ptrdiff_t n);
TH_API void THVector_(copy)(real *y, const real *x, const ptrdiff_t n);
TH_API void THVector_(neg)(real *y, const real *x, const ptrdiff_t n);

#if defined(TH_REAL_IS_SHORT) || defined(TH_REAL_IS_INT) || defined(TH_REAL_IS_LONG)
TH_API void THVector_(abs)(real *y, const real *x, const ptrdiff_t n);
Expand Down Expand Up @@ -47,10 +48,6 @@ TH_API void THVector_(cinv)(real *y, const real *x, const ptrdiff_t n);

#endif /* floating point only part */

#ifndef TH_REAL_IS_BYTE
TH_API void THVector_(neg)(real *y, const real *x, const ptrdiff_t n);
#endif

/* Initialize the dispatch pointers */
TH_API void THVector_(vectorDispatchInit)(void);

Expand Down
2 changes: 0 additions & 2 deletions aten/src/TH/generic/THVectorDefault.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ VECTOR_IMPLEMENT_FUNCTION(cinv, TH_MATH_NAME(1.0) / )
#undef TH_MATH_NAME
#endif /* floating point only part */

#ifndef TH_REAL_IS_BYTE
VECTOR_IMPLEMENT_FUNCTION(neg,-)
#endif

#endif
1 change: 1 addition & 0 deletions aten/src/THC/THCNumerics.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct THCNumerics<uint8_t> {
static inline __host__ __device__ bool eq(uint8_t a, uint8_t b) { return a == b; }
static inline __host__ __device__ bool ne(uint8_t a, uint8_t b) { return a != b; }

static inline __host__ __device__ uint8_t neg(int8_t a) { return -a; }
static inline __host__ __device__ uint8_t add(uint8_t a, uint8_t b) { return a + b; }
static inline __host__ __device__ uint8_t mul(uint8_t a, uint8_t b) { return a * b; }
static inline __host__ __device__ uint8_t sub(uint8_t a, uint8_t b) { return a - b; }
Expand Down
6 changes: 0 additions & 6 deletions aten/src/THC/generic/THCTensorMathPointwise.cu
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ IMPLEMENT_CUDA_TENSOR_BASIC_FUNC( cinv, THCNumerics<real>::cinv, Real)

#endif

#if defined(THC_REAL_IS_FLOAT) || defined(THC_REAL_IS_DOUBLE) || defined(THC_REAL_IS_HALF) || \
defined(THC_REAL_IS_SHORT) || defined(THC_REAL_IS_INT) || defined(THC_REAL_IS_LONG)

IMPLEMENT_CUDA_TENSOR_BASIC_FUNC( neg, THCNumerics<real>::neg, Real)

#endif

IMPLEMENT_CUDA_TENSOR_BASIC_FUNC( abs, THCNumerics<real>::abs, Real)

#undef IMPLEMENT_CUDA_TENSOR_BASIC_FUNC_
Expand Down
6 changes: 0 additions & 6 deletions aten/src/THC/generic/THCTensorMathPointwise.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ THC_API void THCTensor_(cinv)(THCState *state, THCTensor *self, THCTensor *src);

#endif

#if defined(THC_REAL_IS_FLOAT) || defined(THC_REAL_IS_DOUBLE) || defined(THC_REAL_IS_HALF) || \
defined(THC_REAL_IS_SHORT) || defined(THC_REAL_IS_INT) || defined(THC_REAL_IS_LONG)

THC_API void THCTensor_(neg)(THCState *state, THCTensor *self, THCTensor *src);

#endif

THC_API void THCTensor_(abs)(THCState *state, THCTensor *self, THCTensor *src);
THC_API void THCTensor_(sign)(THCState *state, THCTensor *self, THCTensor *src);
THC_API void THCTensor_(clamp)(THCState *state, THCTensor *self, THCTensor *src, real min_value, real max_value);
Expand Down
5 changes: 2 additions & 3 deletions test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ def test_csub(self):
@staticmethod
def _test_neg(self, cast):
float_types = ['torch.DoubleTensor', 'torch.FloatTensor', 'torch.LongTensor']
int_types = ['torch.IntTensor', 'torch.ShortTensor']

This comment was marked as off-topic.

This comment was marked as off-topic.

int_types = ['torch.IntTensor', 'torch.ShortTensor', 'torch.ByteTensor',
'torch.CharTensor']

for t in float_types + int_types:
if t in float_types:
Expand All @@ -552,8 +553,6 @@ def test_neg(self):

def test_reciprocal(self):
a = torch.randn(100, 89)
zeros = torch.Tensor().resize_as_(a).zero_()

res_div = 1 / a
res_reciprocal = a.clone()
res_reciprocal.reciprocal_()
Expand Down
10 changes: 0 additions & 10 deletions torch/csrc/generic/methods/TensorMath.cwrap
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,6 @@

[[
name: neg
types:
- floating_point
- Long
- Int
- Short
backends:
- CPU
- CUDA
Expand All @@ -1061,11 +1056,6 @@

[[
name: neg_
types:
- floating_point
- Long
- Int
- Short
backends:
- CPU
- CUDA
Expand Down