Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Chanan <gchanan@fb.com>2017-05-25 23:35:20 +0300
committerSoumith Chintala <soumith@gmail.com>2017-06-11 11:32:08 +0300
commit6bc0d4055d08d726a6529c596414b342f17f3150 (patch)
tree1be00d6174ab35608d5ca52e31ecbd5241a12b26
parentf5813da6c5b180aa943aa3321c47c8ef95fd6089 (diff)
Use THSize_isSameSizeAs, instead of THTensor_(isSameSizeAs) in order to compare sizes of tensors with different data types.
-rw-r--r--lib/TH/CMakeLists.txt5
-rw-r--r--lib/TH/TH.h1
-rw-r--r--lib/TH/THSize.c11
-rw-r--r--lib/TH/THSize.h8
4 files changed, 23 insertions, 2 deletions
diff --git a/lib/TH/CMakeLists.txt b/lib/TH/CMakeLists.txt
index 22cdf33..dd0b75d 100644
--- a/lib/TH/CMakeLists.txt
+++ b/lib/TH/CMakeLists.txt
@@ -250,11 +250,11 @@ IF(C_AVX2_FOUND)
ENDIF(C_AVX2_FOUND)
SET(hdr
- THGeneral.h THHalf.h THAllocator.h THStorage.h THTensor.h THTensorApply.h THBlas.h THMath.h
+ THGeneral.h THHalf.h THAllocator.h THSize.h THStorage.h THTensor.h THTensorApply.h THBlas.h THMath.h
THLapack.h THLogAdd.h THRandom.h THVector.h THAtomic.h )
SET(src
- THGeneral.c THHalf.c THAllocator.c THStorage.c THTensor.c THBlas.c THLapack.c
+ THGeneral.c THHalf.c THAllocator.c THSize.c THStorage.c THTensor.c THBlas.c THLapack.c
THLogAdd.c THRandom.c THFile.c THDiskFile.c THMemoryFile.c THAtomic.c THVector.c)
SET(src ${src} ${hdr} ${simd})
@@ -401,6 +401,7 @@ INSTALL(FILES
THLogAdd.h
THMemoryFile.h
THRandom.h
+ THSize.h
THStorage.h
THTensor.h
THTensorApply.h
diff --git a/lib/TH/TH.h b/lib/TH/TH.h
index cdf331d..11f208c 100644
--- a/lib/TH/TH.h
+++ b/lib/TH/TH.h
@@ -12,6 +12,7 @@
#include "THVector.h"
#include "THLogAdd.h"
#include "THRandom.h"
+#include "THSize.h"
#include "THStorage.h"
#include "THTensor.h"
#include "THTensorApply.h"
diff --git a/lib/TH/THSize.c b/lib/TH/THSize.c
new file mode 100644
index 0000000..f95d333
--- /dev/null
+++ b/lib/TH/THSize.c
@@ -0,0 +1,11 @@
+int THLongStorage_isSameSizeAs(const long *sizeA, long dimsA, const long *sizeB, long dimsB) {
+ int d;
+ if (dimsA != dimsB)
+ return 0;
+ for(d = 0; d < dimsA; ++d)
+ {
+ if(sizeA[d] != sizeB[d])
+ return 0;
+ }
+ return 1;
+}
diff --git a/lib/TH/THSize.h b/lib/TH/THSize.h
new file mode 100644
index 0000000..e582977
--- /dev/null
+++ b/lib/TH/THSize.h
@@ -0,0 +1,8 @@
+#ifndef TH_SIZE_INC
+#define TH_SIZE_INC
+
+#include "THGeneral.h"
+
+TH_API int THSize_isSameSizeAs(const long *sizeA, long dimsA, const long *sizeB, long dimsB);
+
+#endif